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.
219 220 221 222 223 224 |
# File 'ext/libvirt/nodedevice.c', line 219
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.
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'ext/libvirt/nodedevice.c', line 156
static VALUE libvirt_nodedevice_detach(int argc, VALUE *argv, VALUE n)
{
VALUE driver, flags;
rb_scan_args(argc, argv, "02", &driver, &flags);
#if HAVE_VIRNODEDEVICEDETACHFLAGS
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
if (ruby_libvirt_value_to_uint(flags) != 0) {
rb_raise(e_NoSupportError, "Non-zero flags not supported");
}
if (ruby_libvirt_get_cstring_or_null(driver) != NULL) {
rb_raise(e_NoSupportError, "Non-NULL driver not supported");
}
ruby_libvirt_generate_call_nil(virNodeDeviceDettach,
ruby_libvirt_connect_get(n),
nodedevice_get(n));
#endif
}
|
#free ⇒ nil
Call virNodeDeviceFree to free the node device object. After this call the node device object is no longer valid.
235 236 237 238 |
# File 'ext/libvirt/nodedevice.c', line 235
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.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'ext/libvirt/nodedevice.c', line 107
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.
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File 'ext/libvirt/nodedevice.c', line 248
static VALUE libvirt_nodedevice_lookup_scsi_host_by_wwn(int argc, VALUE *argv,
VALUE n)
{
VALUE wwnn, wwpn, flags;
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.
54 55 56 57 58 59 |
# File 'ext/libvirt/nodedevice.c', line 54
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.
93 94 95 96 97 98 |
# File 'ext/libvirt/nodedevice.c', line 93
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.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'ext/libvirt/nodedevice.c', line 68
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.
190 191 192 193 194 195 |
# File 'ext/libvirt/nodedevice.c', line 190
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.
204 205 206 207 208 209 |
# File 'ext/libvirt/nodedevice.c', line 204
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.
137 138 139 140 141 142 143 144 145 146 147 |
# File 'ext/libvirt/nodedevice.c', line 137
static VALUE libvirt_nodedevice_xml_desc(int argc, VALUE *argv, VALUE n)
{
VALUE flags;
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));
}
|