mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
api: add public virNetworkCreateXMLFlags() and remote protocol
This new API creates network with given flags. Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
ddba9f1dc9
commit
6a0a2840cf
@ -118,6 +118,9 @@ virNetworkPtr virNetworkLookupByUUIDString (virConnectPtr conn,
|
|||||||
*/
|
*/
|
||||||
virNetworkPtr virNetworkCreateXML (virConnectPtr conn,
|
virNetworkPtr virNetworkCreateXML (virConnectPtr conn,
|
||||||
const char *xmlDesc);
|
const char *xmlDesc);
|
||||||
|
virNetworkPtr virNetworkCreateXMLFlags(virConnectPtr conn,
|
||||||
|
const char *xmlDesc,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VIR_NETWORK_DEFINE_VALIDATE = 1 << 0, /* Validate the XML document against schema */
|
VIR_NETWORK_DEFINE_VALIDATE = 1 << 0, /* Validate the XML document against schema */
|
||||||
|
@ -69,6 +69,11 @@ typedef virNetworkPtr
|
|||||||
(*virDrvNetworkCreateXML)(virConnectPtr conn,
|
(*virDrvNetworkCreateXML)(virConnectPtr conn,
|
||||||
const char *xmlDesc);
|
const char *xmlDesc);
|
||||||
|
|
||||||
|
typedef virNetworkPtr
|
||||||
|
(*virDrvNetworkCreateXMLFlags)(virConnectPtr conn,
|
||||||
|
const char *xmlDesc,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
typedef virNetworkPtr
|
typedef virNetworkPtr
|
||||||
(*virDrvNetworkDefineXML)(virConnectPtr conn,
|
(*virDrvNetworkDefineXML)(virConnectPtr conn,
|
||||||
const char *xml);
|
const char *xml);
|
||||||
@ -176,6 +181,7 @@ struct _virNetworkDriver {
|
|||||||
virDrvNetworkLookupByUUID networkLookupByUUID;
|
virDrvNetworkLookupByUUID networkLookupByUUID;
|
||||||
virDrvNetworkLookupByName networkLookupByName;
|
virDrvNetworkLookupByName networkLookupByName;
|
||||||
virDrvNetworkCreateXML networkCreateXML;
|
virDrvNetworkCreateXML networkCreateXML;
|
||||||
|
virDrvNetworkCreateXMLFlags networkCreateXMLFlags;
|
||||||
virDrvNetworkDefineXML networkDefineXML;
|
virDrvNetworkDefineXML networkDefineXML;
|
||||||
virDrvNetworkDefineXMLFlags networkDefineXMLFlags;
|
virDrvNetworkDefineXMLFlags networkDefineXMLFlags;
|
||||||
virDrvNetworkUndefine networkUndefine;
|
virDrvNetworkUndefine networkUndefine;
|
||||||
|
@ -427,6 +427,47 @@ virNetworkCreateXML(virConnectPtr conn, const char *xmlDesc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virNetworkCreateXMLFlags:
|
||||||
|
* @conn: pointer to the hypervisor connection
|
||||||
|
* @xmlDesc: an XML description of the network
|
||||||
|
* @flags: extra flags; not used yet, so callers should always pass 0
|
||||||
|
*
|
||||||
|
* Create and start a new virtual network, based on an XML description
|
||||||
|
* similar to the one returned by virNetworkGetXMLDesc()
|
||||||
|
*
|
||||||
|
* virNetworkFree should be used to free the resources after the
|
||||||
|
* network object is no longer needed.
|
||||||
|
*
|
||||||
|
* Returns a new network object or NULL in case of failure
|
||||||
|
*/
|
||||||
|
virNetworkPtr
|
||||||
|
virNetworkCreateXMLFlags(virConnectPtr conn, const char *xmlDesc, unsigned int flags)
|
||||||
|
{
|
||||||
|
VIR_DEBUG("conn=%p, xmlDesc=%s, flags=0x%x", conn, NULLSTR(xmlDesc), flags);
|
||||||
|
|
||||||
|
virResetLastError();
|
||||||
|
|
||||||
|
virCheckConnectReturn(conn, NULL);
|
||||||
|
virCheckNonNullArgGoto(xmlDesc, error);
|
||||||
|
virCheckReadOnlyGoto(conn->flags, error);
|
||||||
|
|
||||||
|
if (conn->networkDriver && conn->networkDriver->networkCreateXMLFlags) {
|
||||||
|
virNetworkPtr ret;
|
||||||
|
ret = conn->networkDriver->networkCreateXMLFlags(conn, xmlDesc, flags);
|
||||||
|
if (!ret)
|
||||||
|
goto error;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
virReportUnsupportedError();
|
||||||
|
|
||||||
|
error:
|
||||||
|
virDispatchError(conn);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virNetworkDefineXML:
|
* virNetworkDefineXML:
|
||||||
* @conn: pointer to the hypervisor connection
|
* @conn: pointer to the hypervisor connection
|
||||||
|
@ -908,6 +908,7 @@ LIBVIRT_7.8.0 {
|
|||||||
virNodeDeviceGetAutostart;
|
virNodeDeviceGetAutostart;
|
||||||
virNodeDeviceIsPersistent;
|
virNodeDeviceIsPersistent;
|
||||||
virNodeDeviceIsActive;
|
virNodeDeviceIsActive;
|
||||||
|
virNetworkCreateXMLFlags;
|
||||||
} LIBVIRT_7.7.0;
|
} LIBVIRT_7.7.0;
|
||||||
|
|
||||||
# .... define new API here using predicted next version number ....
|
# .... define new API here using predicted next version number ....
|
||||||
|
@ -8552,6 +8552,7 @@ static virNetworkDriver network_driver = {
|
|||||||
.networkLookupByUUID = remoteNetworkLookupByUUID, /* 0.3.0 */
|
.networkLookupByUUID = remoteNetworkLookupByUUID, /* 0.3.0 */
|
||||||
.networkLookupByName = remoteNetworkLookupByName, /* 0.3.0 */
|
.networkLookupByName = remoteNetworkLookupByName, /* 0.3.0 */
|
||||||
.networkCreateXML = remoteNetworkCreateXML, /* 0.3.0 */
|
.networkCreateXML = remoteNetworkCreateXML, /* 0.3.0 */
|
||||||
|
.networkCreateXMLFlags = remoteNetworkCreateXMLFlags, /* 7.8.0 */
|
||||||
.networkDefineXML = remoteNetworkDefineXML, /* 0.3.0 */
|
.networkDefineXML = remoteNetworkDefineXML, /* 0.3.0 */
|
||||||
.networkDefineXMLFlags = remoteNetworkDefineXMLFlags, /* 7.7.0 */
|
.networkDefineXMLFlags = remoteNetworkDefineXMLFlags, /* 7.7.0 */
|
||||||
.networkUndefine = remoteNetworkUndefine, /* 0.3.0 */
|
.networkUndefine = remoteNetworkUndefine, /* 0.3.0 */
|
||||||
|
@ -1530,6 +1530,15 @@ struct remote_network_create_xml_ret {
|
|||||||
remote_nonnull_network net;
|
remote_nonnull_network net;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct remote_network_create_xml_flags_args {
|
||||||
|
remote_nonnull_string xml;
|
||||||
|
unsigned int flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_network_create_xml_flags_ret {
|
||||||
|
remote_nonnull_network net;
|
||||||
|
};
|
||||||
|
|
||||||
struct remote_network_define_xml_args {
|
struct remote_network_define_xml_args {
|
||||||
remote_nonnull_string xml;
|
remote_nonnull_string xml;
|
||||||
};
|
};
|
||||||
@ -6875,6 +6884,13 @@ enum remote_procedure {
|
|||||||
* @priority: high
|
* @priority: high
|
||||||
* @acl: node_device:read
|
* @acl: node_device:read
|
||||||
*/
|
*/
|
||||||
REMOTE_PROC_NODE_DEVICE_IS_ACTIVE = 436
|
REMOTE_PROC_NODE_DEVICE_IS_ACTIVE = 436,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generate: both
|
||||||
|
* @priority: high
|
||||||
|
* @acl: network:write
|
||||||
|
* @acl: network:start
|
||||||
|
*/
|
||||||
|
REMOTE_PROC_NETWORK_CREATE_XML_FLAGS = 437
|
||||||
};
|
};
|
||||||
|
@ -1098,6 +1098,13 @@ struct remote_network_create_xml_args {
|
|||||||
struct remote_network_create_xml_ret {
|
struct remote_network_create_xml_ret {
|
||||||
remote_nonnull_network net;
|
remote_nonnull_network net;
|
||||||
};
|
};
|
||||||
|
struct remote_network_create_xml_flags_args {
|
||||||
|
remote_nonnull_string xml;
|
||||||
|
u_int flags;
|
||||||
|
};
|
||||||
|
struct remote_network_create_xml_flags_ret {
|
||||||
|
remote_nonnull_network net;
|
||||||
|
};
|
||||||
struct remote_network_define_xml_args {
|
struct remote_network_define_xml_args {
|
||||||
remote_nonnull_string xml;
|
remote_nonnull_string xml;
|
||||||
};
|
};
|
||||||
@ -3665,4 +3672,5 @@ enum remote_procedure {
|
|||||||
REMOTE_PROC_NODE_DEVICE_SET_AUTOSTART = 434,
|
REMOTE_PROC_NODE_DEVICE_SET_AUTOSTART = 434,
|
||||||
REMOTE_PROC_NODE_DEVICE_IS_PERSISTENT = 435,
|
REMOTE_PROC_NODE_DEVICE_IS_PERSISTENT = 435,
|
||||||
REMOTE_PROC_NODE_DEVICE_IS_ACTIVE = 436,
|
REMOTE_PROC_NODE_DEVICE_IS_ACTIVE = 436,
|
||||||
|
REMOTE_PROC_NETWORK_CREATE_XML_FLAGS = 437,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user