mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
Mon Jun 25 16:55:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* include/libvirt/libvirt.h.in, src/libvirt.c, src/libvirt_sym.version, python/generator.py: Added virDomainGetConnect and virNetworkGetConnect to allow us to get the "hidden" connection associated with each domain or network.
This commit is contained in:
parent
83471f1ec5
commit
aa053ba2c5
@ -1,3 +1,10 @@
|
||||
Mon Jun 25 16:55:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
|
||||
|
||||
* include/libvirt/libvirt.h.in, src/libvirt.c, src/libvirt_sym.version,
|
||||
python/generator.py: Added virDomainGetConnect and
|
||||
virNetworkGetConnect to allow us to get the "hidden"
|
||||
connection associated with each domain or network.
|
||||
|
||||
Mon Jun 25 14:30:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
|
||||
|
||||
* include/libvirt/libvirt.h, include/libvirt/libvirt.h.in,
|
||||
|
@ -295,6 +295,11 @@ int virConnectListDomains (virConnectPtr conn,
|
||||
int virConnectNumOfDomains (virConnectPtr conn);
|
||||
|
||||
|
||||
/*
|
||||
* Get connection from domain.
|
||||
*/
|
||||
virConnectPtr virDomainGetConnect (virDomainPtr domain);
|
||||
|
||||
/*
|
||||
* Domain creation and destruction
|
||||
*/
|
||||
@ -523,6 +528,11 @@ typedef struct _virNetwork virNetwork;
|
||||
*/
|
||||
typedef virNetwork *virNetworkPtr;
|
||||
|
||||
/*
|
||||
* Get connection from network.
|
||||
*/
|
||||
virConnectPtr virNetworkGetConnect (virNetworkPtr network);
|
||||
|
||||
/*
|
||||
* List active networks
|
||||
*/
|
||||
|
@ -295,6 +295,11 @@ int virConnectListDomains (virConnectPtr conn,
|
||||
int virConnectNumOfDomains (virConnectPtr conn);
|
||||
|
||||
|
||||
/*
|
||||
* Get connection from domain.
|
||||
*/
|
||||
virConnectPtr virDomainGetConnect (virDomainPtr domain);
|
||||
|
||||
/*
|
||||
* Domain creation and destruction
|
||||
*/
|
||||
@ -523,6 +528,11 @@ typedef struct _virNetwork virNetwork;
|
||||
*/
|
||||
typedef virNetwork *virNetworkPtr;
|
||||
|
||||
/*
|
||||
* Get connection from network.
|
||||
*/
|
||||
virConnectPtr virNetworkGetConnect (virNetworkPtr network);
|
||||
|
||||
/*
|
||||
* List active networks
|
||||
*/
|
||||
|
@ -870,6 +870,10 @@ def buildWrappers():
|
||||
txt.write("Class %s()\n" % (classname))
|
||||
classes.write("class %s:\n" % (classname))
|
||||
if classname == "virDomain" or classname == "virNetwork":
|
||||
# NB: Earlier versions of libvirt did not provide
|
||||
# vir{Domain,Network}GetConnect, so we had to explicitly
|
||||
# store the connection object in _conn. In future
|
||||
# we won't need to do this.
|
||||
classes.write(" def __init__(self, conn, _obj=None):\n")
|
||||
else:
|
||||
classes.write(" def __init__(self, _obj=None):\n")
|
||||
|
@ -545,6 +545,26 @@ virConnectNumOfDomains(virConnectPtr conn)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* virDomainGetConnect:
|
||||
* @dom: pointer to a domain
|
||||
*
|
||||
* Returns the connection pointer associated with a domain. The
|
||||
* reference counter on the connection is not increased by this
|
||||
* call.
|
||||
*
|
||||
* Returns the virConnectPtr or NULL in case of failure.
|
||||
*/
|
||||
virConnectPtr
|
||||
virDomainGetConnect (virDomainPtr dom)
|
||||
{
|
||||
if (!VIR_IS_DOMAIN (dom)) {
|
||||
virLibDomainError (dom, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
return dom->conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* virDomainCreateLinux:
|
||||
* @conn: pointer to the hypervisor connection
|
||||
@ -2036,6 +2056,26 @@ virDomainDetachDevice(virDomainPtr domain, char *xml)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* virNetworkGetConnect:
|
||||
* @net: pointer to a network
|
||||
*
|
||||
* Returns the connection pointer associated with a network. The
|
||||
* reference counter on the connection is not increased by this
|
||||
* call.
|
||||
*
|
||||
* Returns the virConnectPtr or NULL in case of failure.
|
||||
*/
|
||||
virConnectPtr
|
||||
virNetworkGetConnect (virNetworkPtr net)
|
||||
{
|
||||
if (!VIR_IS_NETWORK (net)) {
|
||||
virLibNetworkError (net, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
return net->conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* virConnectNumOfNetworks:
|
||||
* @conn: pointer to the hypervisor connection
|
||||
|
@ -1,13 +1,14 @@
|
||||
{
|
||||
global:
|
||||
virInitialize;
|
||||
virConnectOpen;
|
||||
virConnectOpenReadOnly;
|
||||
virConnectClose;
|
||||
virConnectGetType;
|
||||
virConnectGetVersion;
|
||||
virDomainGetConnect;
|
||||
virConnectListDomains;
|
||||
virConnectNumOfDomains;
|
||||
virConnectOpen;
|
||||
virConnectOpenReadOnly;
|
||||
virDomainCreate;
|
||||
virDomainCreateLinux;
|
||||
virDomainDefineXML;
|
||||
@ -66,6 +67,7 @@
|
||||
virDomainAttachDevice;
|
||||
virDomainDetachDevice;
|
||||
|
||||
virNetworkGetConnect;
|
||||
virConnectNumOfNetworks;
|
||||
virConnectListNetworks;
|
||||
virConnectNumOfDefinedNetworks;
|
||||
|
Loading…
x
Reference in New Issue
Block a user