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
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceDestroy] to shutdown the node device. -
#detach ⇒ nil
Call
virNodeDeviceDettach
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceDettach] to detach the node device from the node. -
#free ⇒ nil
Call
virNodeDeviceFree
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceFree] to free the node device object. -
#list_caps ⇒ Object
Call
virNodeDeviceListCaps
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceListCaps] to retrieve a list of capabilities of the node device. -
#name ⇒ String
Call
virNodeDeviceGetName
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceGetName] to retrieve the name of the node device. -
#num_of_caps ⇒ Fixnum
Call
virNodeDeviceNumOfCaps
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceNumOfCaps] to retrieve the number of capabilities of the node device. -
#parent ⇒ String
Call
virNodeDeviceGetParent
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceGetParent] to retrieve the parent of the node device. -
#reattach ⇒ nil
Call
virNodeDeviceReAttach
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceReAttach] to reattach the node device to the node. -
#reset ⇒ nil
Call
virNodeDeviceReset
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceReset] to reset the node device. -
#xml_desc(flags = 0) ⇒ String
Call
virNodeDeviceGetXMLDesc
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceGetXMLDesc] to retrieve the XML for the node device.
Instance Attribute Details
#connection ⇒ Object (readonly)
Instance Method Details
#destroy ⇒ nil
Call virNodeDeviceDestroy
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceDestroy] to shutdown the node device.
177 178 179 |
# File 'ext/libvirt/nodedevice.c', line 177 static VALUE libvirt_nodedevice_destroy(VALUE s) { gen_call_void(virNodeDeviceDestroy, conn(s), nodedevice_get(s)); } |
#detach ⇒ nil
Call virNodeDeviceDettach
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceDettach] to detach the node device from the node.
143 144 145 |
# File 'ext/libvirt/nodedevice.c', line 143 static VALUE libvirt_nodedevice_detach(VALUE s) { gen_call_void(virNodeDeviceDettach, conn(s), nodedevice_get(s)); } |
#free ⇒ nil
Call virNodeDeviceFree
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceFree] to free the node device object. After this call the node device object is no longer valid.
190 191 192 |
# File 'ext/libvirt/nodedevice.c', line 190 static VALUE libvirt_nodedevice_free(VALUE s) { gen_call_free(NodeDevice, s); } |
#list_caps ⇒ Object
Call virNodeDeviceListCaps
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceListCaps] to retrieve a list of capabilities of the node device.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'ext/libvirt/nodedevice.c', line 94 static VALUE libvirt_nodedevice_list_caps(VALUE c) { int r, num; virConnectPtr conn = connect_get(c); virNodeDevicePtr nodedev = nodedevice_get(c); char **names; num = virNodeDeviceNumOfCaps(nodedev); _E(num < 0, create_error(e_RetrieveError, "virNodeDeviceNumOfCaps", conn)); if (num == 0) /* if num is 0, don't call virNodeDeviceListCaps function */ return rb_ary_new2(num); names = ALLOC_N(char *, num); r = virNodeDeviceListCaps(nodedev, names, num); if (r < 0) { xfree(names); rb_exc_raise(create_error(e_RetrieveError, "virNodeDeviceListCaps", conn)); } return gen_list(num, &names); } |
#name ⇒ String
Call virNodeDeviceGetName
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceGetName] to retrieve the name of the node device.
50 51 52 |
# File 'ext/libvirt/nodedevice.c', line 50 static VALUE libvirt_nodedevice_name(VALUE c) { gen_call_string(virNodeDeviceGetName, conn(c), 0, nodedevice_get(c)); } |
#num_of_caps ⇒ Fixnum
Call virNodeDeviceNumOfCaps
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceNumOfCaps] to retrieve the number of capabilities of the node device.
83 84 85 |
# File 'ext/libvirt/nodedevice.c', line 83 static VALUE libvirt_nodedevice_num_of_caps(VALUE c) { gen_call_int(virNodeDeviceNumOfCaps, conn(c), nodedevice_get(c)); } |
#parent ⇒ String
Call virNodeDeviceGetParent
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceGetParent] to retrieve the parent of the node device.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'ext/libvirt/nodedevice.c', line 61 static VALUE libvirt_nodedevice_parent(VALUE c) { /* unfortunately we can't use gen_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
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceReAttach] to reattach the node device to the node.
154 155 156 |
# File 'ext/libvirt/nodedevice.c', line 154 static VALUE libvirt_nodedevice_reattach(VALUE s) { gen_call_void(virNodeDeviceReAttach, conn(s), nodedevice_get(s)); } |
#reset ⇒ nil
Call virNodeDeviceReset
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceReset] to reset the node device.
165 166 167 |
# File 'ext/libvirt/nodedevice.c', line 165 static VALUE libvirt_nodedevice_reset(VALUE s) { gen_call_void(virNodeDeviceReset, conn(s), nodedevice_get(s)); } |
#xml_desc(flags = 0) ⇒ String
Call virNodeDeviceGetXMLDesc
[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceGetXMLDesc] to retrieve the XML for the node device.
124 125 126 127 128 129 130 131 132 133 134 |
# File 'ext/libvirt/nodedevice.c', line 124 static VALUE libvirt_nodedevice_xml_desc(int argc, VALUE *argv, VALUE s) { VALUE flags; rb_scan_args(argc, argv, "01", &flags); if (NIL_P(flags)) flags = INT2NUM(0); gen_call_string(virNodeDeviceGetXMLDesc, conn(s), 1, nodedevice_get(s), NUM2UINT(flags)); } |