684
688
__tmp = virNetwork(self, _obj=ret)
692
def __init__(self, conn, _obj=None):
694
if _obj != None:self._o = _obj;return
699
libvirtmod.virInterfaceFree(self._o)
703
# virInterface functions from module libvirt
706
def ceCreate(self, flags):
707
"""Activate an interface (ie call "ifup") """
708
ret = libvirtmod.virInterfaceCreate(self._o, flags)
709
if ret == -1: raise libvirtError ('virInterfaceCreate() failed', net=self)
712
def ceDestroy(self, flags):
713
"""deactivate an interface (ie call "ifdown") This does not
714
remove the interface from the config, and does not free the
715
associated virInterfacePtr object. """
716
ret = libvirtmod.virInterfaceDestroy(self._o, flags)
717
if ret == -1: raise libvirtError ('virInterfaceDestroy() failed', net=self)
721
"""Increment the reference count on the interface. For each
722
additional call to this method, there shall be a
723
corresponding call to virInterfaceFree to release the
724
reference count, once the caller no longer needs the
725
reference to this object. This method is typically useful
726
for applications where multiple threads are using a
727
connection, and it is required that the connection remain
728
open until all threads have finished using it. ie, each new
729
thread using a interface would increment the reference
731
ret = libvirtmod.virInterfaceRef(self._o)
732
if ret == -1: raise libvirtError ('virInterfaceRef() failed', net=self)
735
def ceUndefine(self):
736
"""Undefine an interface, ie remove it from the config. This
737
does not free the associated virInterfacePtr object. """
738
ret = libvirtmod.virInterfaceUndefine(self._o)
739
if ret == -1: raise libvirtError ('virInterfaceUndefine() failed', net=self)
743
"""Provides the connection pointer associated with an
744
interface. The reference counter on the connection is not
745
increased by this call. WARNING: When writing libvirt
746
bindings in other languages, do not use this function.
747
Instead, store the connection and the interface object
749
ret = libvirtmod.virInterfaceGetConnect(self._o)
750
if ret is None:raise libvirtError('virInterfaceGetConnect() failed', net=self)
751
__tmp = virConnect(_obj=ret)
754
def etMACString(self):
755
"""Get the MAC for a interface as string. For more information
756
about MAC see RFC4122. """
757
ret = libvirtmod.virInterfaceGetMACString(self._o)
758
if ret is None: raise libvirtError ('virInterfaceGetMACString() failed', net=self)
762
"""Get the public name for that interface """
763
ret = libvirtmod.virInterfaceGetName(self._o)
766
def etXMLDesc(self, flags):
767
"""Provide an XML description of the interface. The
768
description may be reused later to recreate the interface
769
with virInterfaceCreateXML(). """
770
ret = libvirtmod.virInterfaceGetXMLDesc(self._o, flags)
771
if ret is None: raise libvirtError ('virInterfaceGetXMLDesc() failed', net=self)
687
774
class virStoragePool:
688
775
def __init__(self, conn, _obj=None):
689
776
self._conn = conn
740
827
__tmp = virStorageVol(self, _obj=ret)
830
def createXMLFrom(self, xmldesc, clonevol, flags):
831
"""Create a storage volume in the parent pool, using the
832
'clonevol' volume as input. Information for the new volume
833
(name, perms) are passed via a typical volume XML
835
if clonevol is None: clonevol__o = None
836
else: clonevol__o = clonevol._o
837
ret = libvirtmod.virStorageVolCreateXMLFrom(self._o, xmldesc, clonevol__o, flags)
838
if ret is None:raise libvirtError('virStorageVolCreateXMLFrom() failed', pool=self)
839
__tmp = virStorageVol(self, _obj=ret)
743
842
def delete(self, flags):
744
843
"""Delete the underlying pool resources. This is a
745
844
non-recoverable operation. The virStoragePoolPtr object
978
1077
def createXML(self, xmlDesc, flags):
1078
"""Create a new device on the VM host machine, for example,
1079
virtual HBAs created using vport_create. """
1080
ret = libvirtmod.virNodeDeviceCreateXML(self._o, xmlDesc, flags)
1081
if ret is None:raise libvirtError('virNodeDeviceCreateXML() failed', conn=self)
1082
__tmp = virNodeDevice(self, _obj=ret)
1085
def createXML(self, xmlDesc, flags):
979
1086
"""Launch a new guest domain, based on an XML description
980
1087
similar to the one returned by virDomainGetXMLDesc() This
981
1088
function may requires privileged access to the hypervisor.
990
1097
def defineXML(self, xml):
991
1098
"""Define a domain, but does not start it. This definition is
992
1099
persistent, until explicitly undefined with
993
virDomainUndefine(). """
1100
virDomainUndefine(). A previous definition for this domain
1101
would be overriden if it already exists. """
994
1102
ret = libvirtmod.virDomainDefineXML(self._o, xml)
995
1103
if ret is None:raise libvirtError('virDomainDefineXML() failed', conn=self)
996
1104
__tmp = virDomain(self,_obj=ret)
1107
def domainXMLFromNative(self, nativeFormat, nativeConfig, flags):
1108
"""Reads native configuration data describing a domain, and
1109
generates libvirt domain XML. The format of the native data
1110
is hypervisor dependant. """
1111
ret = libvirtmod.virConnectDomainXMLFromNative(self._o, nativeFormat, nativeConfig, flags)
1112
if ret is None: raise libvirtError ('virConnectDomainXMLFromNative() failed', conn=self)
1115
def domainXMLToNative(self, nativeFormat, domainXml, flags):
1116
"""Reads a domain XML configuration document, and generates
1117
generates a native configuration file describing the
1118
domain. The format of the native data is hypervisor
1120
ret = libvirtmod.virConnectDomainXMLToNative(self._o, nativeFormat, domainXml, flags)
1121
if ret is None: raise libvirtError ('virConnectDomainXMLToNative() failed', conn=self)
999
1124
def findStoragePoolSources(self, type, srcSpec, flags):
1000
1125
"""Talks to a storage backend and attempts to auto-discover
1001
1126
the set of available storage pool sources. e.g. For iSCSI
1056
1184
if ret is None: raise libvirtError ('virConnectGetURI() failed', conn=self)
1187
def interfaceDefineXML(self, xml, flags):
1188
"""Define an interface (or modify existing interface
1190
ret = libvirtmod.virInterfaceDefineXML(self._o, xml, flags)
1191
if ret is None:raise libvirtError('virInterfaceDefineXML() failed', conn=self)
1192
__tmp = virInterface(self, _obj=ret)
1195
def interfaceLookupByMACString(self, macstr):
1196
"""Try to lookup an interface on the given hypervisor based on
1198
ret = libvirtmod.virInterfaceLookupByMACString(self._o, macstr)
1199
if ret is None:raise libvirtError('virInterfaceLookupByMACString() failed', conn=self)
1200
__tmp = virInterface(self, _obj=ret)
1203
def interfaceLookupByName(self, name):
1204
"""Try to lookup an interface on the given hypervisor based on
1206
ret = libvirtmod.virInterfaceLookupByName(self._o, name)
1207
if ret is None:raise libvirtError('virInterfaceLookupByName() failed', conn=self)
1208
__tmp = virInterface(self, _obj=ret)
1211
def listInterfaces(self, names, maxnames):
1212
"""Collect the list of physical host interfaces, and store
1213
their names in @names """
1214
ret = libvirtmod.virConnectListInterfaces(self._o, names, maxnames)
1215
if ret == -1: raise libvirtError ('virConnectListInterfaces() failed', conn=self)
1059
1218
def lookupByID(self, id):
1060
1219
"""Try to find a domain based on the hypervisor ID number Note
1061
1220
that this won't work for inactive domains which have an ID
1442
1607
if ret is None: raise libvirtError ('virNodeDeviceGetXMLDesc() failed')
1611
"""Destroy the device object. The virtual device is removed
1612
from the host operating system. This function may require
1613
privileged access """
1614
ret = libvirtmod.virNodeDeviceDestroy(self._o)
1615
if ret == -1: raise libvirtError ('virNodeDeviceDestroy() failed')
1445
1618
def dettach(self):
1619
"""Dettach the node device from the node itself so that it may
1620
be assigned to a guest domain. Depending on the
1621
hypervisor, this may involve operations such as unbinding
1622
any device drivers from the device, binding the device to a
1623
dummy device driver and resetting the device. If the
1624
device is currently in use by the node, this method may
1625
fail. Once the device is not assigned to any guest, it may
1626
be re-attached to the node using the
1627
virNodeDeviceReattach() method. """
1446
1628
ret = libvirtmod.virNodeDeviceDettach(self._o)
1447
1629
if ret == -1: raise libvirtError ('virNodeDeviceDettach() failed')