Class: Libvirt::NodeDevice
- Inherits:
-
Object
- Object
- Libvirt::NodeDevice
- Defined in:
- ext/libvirt/nodedevice.c
Instance Attribute Summary collapse
- #connection ⇒ Object readonly
Instance Method Summary collapse
-
#destroy ⇒ nil
Call virNodeDeviceDestroy to shutdown the node device.
-
#detach(driver = nil, flags = 0) ⇒ nil
Call virNodeDeviceDettach to detach the node device from the node.
-
#free ⇒ nil
Call virNodeDeviceFree to free the node device object.
-
#list_caps ⇒ Object
Call virNodeDeviceListCaps to retrieve a list of capabilities of the node device.
-
#lookup_scsi_host_by_wwn(wwnn, wwpn, flags = 0) ⇒ Libvirt::NodeDevice
Call virNodeDeviceLookupSCSIHostByWWN to look up a SCSI host by its WWNN and WWPN.
-
#name ⇒ String
Call virNodeDeviceGetName to retrieve the name of the node device.
-
#num_of_caps ⇒ Fixnum
Call virNodeDeviceNumOfCaps to retrieve the number of capabilities of the node device.
-
#parent ⇒ String
Call virNodeDeviceGetParent to retrieve the parent of the node device.
-
#reattach ⇒ nil
Call virNodeDeviceReAttach to reattach the node device to the node.
-
#reset ⇒ nil
Call virNodeDeviceReset to reset the node device.
-
#xml_desc(flags = 0) ⇒ String
Call virNodeDeviceGetXMLDesc to retrieve the XML for the node device.
Instance Attribute Details
#connection ⇒ Object (readonly)
Instance Method Details
#destroy ⇒ nil
Call virNodeDeviceDestroy to shutdown the node device.
210 211 212 213 214 215 |
# File 'ext/libvirt/nodedevice.c', line 210
static VALUE libvirt_nodedevice_destroy(VALUE n)
{
ruby_libvirt_generate_call_nil(virNodeDeviceDestroy,
ruby_libvirt_connect_get(n),
nodedevice_get(n));
}
|
#detach(driver = nil, flags = 0) ⇒ nil
Call virNodeDeviceDettach to detach the node device from the node.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'ext/libvirt/nodedevice.c', line 155
static VALUE libvirt_nodedevice_detach(int argc, VALUE *argv, VALUE n)
{
VALUE driver = RUBY_Qnil, flags = RUBY_Qnil;
rb_scan_args(argc, argv, "02", &driver, &flags);
if (ruby_libvirt_value_to_uint(flags) != 0 ||
ruby_libvirt_get_cstring_or_null(driver) != NULL) {
ruby_libvirt_generate_call_nil(virNodeDeviceDetachFlags,
ruby_libvirt_connect_get(n),
nodedevice_get(n),
ruby_libvirt_get_cstring_or_null(driver),
ruby_libvirt_value_to_uint(flags));
} else {
ruby_libvirt_generate_call_nil(virNodeDeviceDettach,
ruby_libvirt_connect_get(n),
nodedevice_get(n));
}
}
|
#free ⇒ nil
Call virNodeDeviceFree to free the node device object. After this call the node device object is no longer valid.
225 226 227 228 |
# File 'ext/libvirt/nodedevice.c', line 225
static VALUE libvirt_nodedevice_free(VALUE n)
{
ruby_libvirt_generate_call_free(NodeDevice, n);
}
|
#list_caps ⇒ Object
Call virNodeDeviceListCaps to retrieve a list of capabilities of the node device.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'ext/libvirt/nodedevice.c', line 106
static VALUE libvirt_nodedevice_list_caps(VALUE c)
{
int r, num;
char **names;
num = virNodeDeviceNumOfCaps(nodedevice_get(c));
ruby_libvirt_raise_error_if(num < 0, e_RetrieveError,
"virNodeDeviceNumOfCaps",
ruby_libvirt_connect_get(c));
if (num == 0) {
/* if num is 0, don't call virNodeDeviceListCaps function */
return rb_ary_new2(num);
}
names = alloca(sizeof(char *) * num);
r = virNodeDeviceListCaps(nodedevice_get(c), names, num);
ruby_libvirt_raise_error_if(r < 0, e_RetrieveError,
"virNodeDeviceListCaps",
ruby_libvirt_connect_get(c));
return ruby_libvirt_generate_list(r, names);
}
|
#lookup_scsi_host_by_wwn(wwnn, wwpn, flags = 0) ⇒ Libvirt::NodeDevice
Call virNodeDeviceLookupSCSIHostByWWN to look up a SCSI host by its WWNN and WWPN.
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'ext/libvirt/nodedevice.c', line 237
static VALUE libvirt_nodedevice_lookup_scsi_host_by_wwn(int argc, VALUE *argv,
VALUE n)
{
VALUE wwnn, wwpn, flags = RUBY_Qnil;
virNodeDevicePtr nd;
rb_scan_args(argc, argv, "21", &wwnn, &wwpn, &flags);
nd = virNodeDeviceLookupSCSIHostByWWN(ruby_libvirt_connect_get(n),
StringValueCStr(wwnn),
StringValueCStr(wwpn),
ruby_libvirt_value_to_uint(flags));
if (nd == NULL) {
return Qnil;
}
return ruby_libvirt_nodedevice_new(nd, ruby_libvirt_conn_attr(n));
}
|
#name ⇒ String
Call virNodeDeviceGetName to retrieve the name of the node device.
53 54 55 56 57 58 |
# File 'ext/libvirt/nodedevice.c', line 53
static VALUE libvirt_nodedevice_name(VALUE c)
{
ruby_libvirt_generate_call_string(virNodeDeviceGetName,
ruby_libvirt_connect_get(c), 0,
nodedevice_get(c));
}
|
#num_of_caps ⇒ Fixnum
Call virNodeDeviceNumOfCaps to retrieve the number of capabilities of the node device.
92 93 94 95 96 97 |
# File 'ext/libvirt/nodedevice.c', line 92
static VALUE libvirt_nodedevice_num_of_caps(VALUE c)
{
ruby_libvirt_generate_call_int(virNodeDeviceNumOfCaps,
ruby_libvirt_connect_get(c),
nodedevice_get(c));
}
|
#parent ⇒ String
Call virNodeDeviceGetParent to retrieve the parent of the node device.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'ext/libvirt/nodedevice.c', line 67
static VALUE libvirt_nodedevice_parent(VALUE c)
{
/* unfortunately we can't use ruby_libvirt_generate_call_string() here
* because virNodeDeviceGetParent() returns NULL as a valid value (when this
* device has no parent). Hand-code it instead
*/
const char *str;
str = virNodeDeviceGetParent(nodedevice_get(c));
if (str == NULL) {
return Qnil;
}
else {
return rb_str_new2(str);
}
}
|
#reattach ⇒ nil
Call virNodeDeviceReAttach to reattach the node device to the node.
182 183 184 185 186 187 |
# File 'ext/libvirt/nodedevice.c', line 182
static VALUE libvirt_nodedevice_reattach(VALUE n)
{
ruby_libvirt_generate_call_nil(virNodeDeviceReAttach,
ruby_libvirt_connect_get(n),
nodedevice_get(n));
}
|
#reset ⇒ nil
Call virNodeDeviceReset to reset the node device.
196 197 198 199 200 201 |
# File 'ext/libvirt/nodedevice.c', line 196
static VALUE libvirt_nodedevice_reset(VALUE n)
{
ruby_libvirt_generate_call_nil(virNodeDeviceReset,
ruby_libvirt_connect_get(n),
nodedevice_get(n));
}
|
#xml_desc(flags = 0) ⇒ String
Call virNodeDeviceGetXMLDesc to retrieve the XML for the node device.
136 137 138 139 140 141 142 143 144 145 146 |
# File 'ext/libvirt/nodedevice.c', line 136
static VALUE libvirt_nodedevice_xml_desc(int argc, VALUE *argv, VALUE n)
{
VALUE flags = RUBY_Qnil;
rb_scan_args(argc, argv, "01", &flags);
ruby_libvirt_generate_call_string(virNodeDeviceGetXMLDesc,
ruby_libvirt_connect_get(n),
1, nodedevice_get(n),
ruby_libvirt_value_to_uint(flags));
}
|