Class: Libvirt::Interface

Inherits:
Object
  • Object
show all
Defined in:
ext/libvirt/interface.c

Constant Summary collapse

XML_INACTIVE =
INT2NUM(VIR_INTERFACE_XML_INACTIVE)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connection ⇒ Object (readonly)

Class Method Details

.new(*args) ⇒ Object

For classes where Ruby objects are just wrappers around C pointers, the only acceptable way to create new instances is to use Connect.create_domain_xml and similar. The use of Domain.new and friends is explicitly disallowed by providing this functions as implementation when defining the class



501
502
503
504
# File 'ext/libvirt/common.c', line 501

VALUE ruby_libvirt_new_not_allowed(int argc, VALUE *argv, VALUE obj)
{
    rb_raise(rb_eTypeError, "Not allowed for this class");
}

Instance Method Details

#active? ⇒ Array

Call virInterfaceIsActive to determine if this interface is currently active.

Returns:

  • (Array)


105
106
107
108
109
110
# File 'ext/libvirt/interface.c', line 105

static VALUE libvirt_interface_active_p(VALUE p)
{
    ruby_libvirt_generate_call_truefalse(virInterfaceIsActive,
                                         ruby_libvirt_connect_get(p),
                                         interface_get(p));
}

#create(flags = 0) ⇒ nil

Call virInterfaceCreate to start this interface.

Returns:

  • (nil)


67
68
69
70
71
72
73
74
75
76
77
# File 'ext/libvirt/interface.c', line 67

static VALUE libvirt_interface_create(int argc, VALUE *argv, VALUE i)
{
    VALUE flags = RUBY_Qnil;

    rb_scan_args(argc, argv, "01", &flags);

    ruby_libvirt_generate_call_nil(virInterfaceCreate,
                                   ruby_libvirt_connect_get(i),
                                   interface_get(i),
                                   ruby_libvirt_value_to_uint(flags));
}

#destroy(flags = 0) ⇒ nil

Call virInterfaceDestroy to shutdown this interface.

Returns:

  • (nil)


86
87
88
89
90
91
92
93
94
95
96
# File 'ext/libvirt/interface.c', line 86

static VALUE libvirt_interface_destroy(int argc, VALUE *argv, VALUE i)
{
    VALUE flags = RUBY_Qnil;

    rb_scan_args(argc, argv, "01", &flags);

    ruby_libvirt_generate_call_nil(virInterfaceDestroy,
                                   ruby_libvirt_connect_get(i),
                                   interface_get(i),
                                   ruby_libvirt_value_to_uint(flags));
}

#free ⇒ nil

Call virInterfaceFree to free this interface. The object will no longer be valid after this call.

Returns:

  • (nil)


166
167
168
169
# File 'ext/libvirt/interface.c', line 166

static VALUE libvirt_interface_free(VALUE i)
{
    ruby_libvirt_generate_call_free(Interface, i);
}

#mac ⇒ String

Call virInterfaceGetMACString to retrieve the MAC address of this interface.

Returns:

  • (String)


133
134
135
136
137
138
# File 'ext/libvirt/interface.c', line 133

static VALUE libvirt_interface_mac(VALUE i)
{
    ruby_libvirt_generate_call_string(virInterfaceGetMACString,
                                      ruby_libvirt_connect_get(i),
                                      0, interface_get(i));
}

#name ⇒ String

Call virInterfaceGetName to retrieve the name of this interface.

Returns:

  • (String)


119
120
121
122
123
124
# File 'ext/libvirt/interface.c', line 119

static VALUE libvirt_interface_name(VALUE i)
{
    ruby_libvirt_generate_call_string(virInterfaceGetName,
                                      ruby_libvirt_connect_get(i), 0,
                                      interface_get(i));
}

#undefine ⇒ nil

Call virInterfaceUndefine to undefine this interface.

Returns:

  • (nil)


53
54
55
56
57
58
# File 'ext/libvirt/interface.c', line 53

static VALUE libvirt_interface_undefine(VALUE i)
{
    ruby_libvirt_generate_call_nil(virInterfaceUndefine,
                                   ruby_libvirt_connect_get(i),
                                   interface_get(i));
}

#xml_desc ⇒ String

Call virInterfaceGetXMLDesc to retrieve the XML of this interface.

Returns:

  • (String)


147
148
149
150
151
152
153
154
155
156
157
# File 'ext/libvirt/interface.c', line 147

static VALUE libvirt_interface_xml_desc(int argc, VALUE *argv, VALUE i)
{
    VALUE flags = RUBY_Qnil;

    rb_scan_args(argc, argv, "01", &flags);

    ruby_libvirt_generate_call_string(virInterfaceGetXMLDesc,
                                      ruby_libvirt_connect_get(i),
                                      1, interface_get(i),
                                      ruby_libvirt_value_to_uint(flags));
}