mirror of https://gitee.com/openkylin/libvirt.git
virDomainCreateXML: support new flag
* include/libvirt/libvirt.h.in (virDomainCreateFlags): Add VIR_DOMAIN_START_PAUSED. * src/libvirt.c (virDomainCreateXML): Update documentation. * src/lxc/lxc_driver.c (lxcDomainCreateAndStart): Reject new flag as unimplemented. * src/opennebula/one_driver.c (oneDomainCreateAndStart): Likewise. * src/openvz/openvz_driver.c (openvzDomainCreateXML): Likewise. * src/phyp/phyp_driver.c (phypDomainCreateAndStart): Likewise. * src/qemu/qemu_driver.c (qemudDomainCreate): Likewise. * src/test/test_driver.c (testDomainCreateXML): Likewise. * src/uml/uml_driver.c (umlDomainCreate): Likewise. * src/vbox/vbox_tmpl.c (vboxDomainCreateXML): Likewise. * src/xen/xend_internal.c (xenDaemonCreateXML): Likewise. * src/xenapi/xenapi_driver.c (xenapiDomainCreateXML): Likewise.
This commit is contained in:
parent
e7f3bad46e
commit
2502ebb30a
|
@ -121,7 +121,8 @@ typedef virDomainInfo *virDomainInfoPtr;
|
|||
* Domain.
|
||||
*/
|
||||
typedef enum {
|
||||
VIR_DOMAIN_NONE = 0
|
||||
VIR_DOMAIN_NONE = 0, /* Default behavior */
|
||||
VIR_DOMAIN_START_PAUSED = 1 << 0, /* Launch guest in paused state */
|
||||
} virDomainCreateFlags;
|
||||
|
||||
|
||||
|
|
|
@ -1917,7 +1917,7 @@ virDomainGetConnect (virDomainPtr dom)
|
|||
* virDomainCreateXML:
|
||||
* @conn: pointer to the hypervisor connection
|
||||
* @xmlDesc: string containing an XML description of the domain
|
||||
* @flags: callers should always pass 0
|
||||
* @flags: bitwise-or of supported virDomainCreateFlags
|
||||
*
|
||||
* Launch a new guest domain, based on an XML description similar
|
||||
* to the one returned by virDomainGetXMLDesc()
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright IBM Corp. 2008
|
||||
*
|
||||
* lxc_driver.c: linux container driver functions
|
||||
|
@ -1404,7 +1405,7 @@ cleanup:
|
|||
* lxcDomainCreateAndStart:
|
||||
* @conn: pointer to connection
|
||||
* @xml: XML definition of domain
|
||||
* @flags: Unused
|
||||
* @flags: Must be 0 for now
|
||||
*
|
||||
* Creates a domain based on xml and starts it
|
||||
*
|
||||
|
@ -1413,13 +1414,15 @@ cleanup:
|
|||
static virDomainPtr
|
||||
lxcDomainCreateAndStart(virConnectPtr conn,
|
||||
const char *xml,
|
||||
unsigned int flags ATTRIBUTE_UNUSED) {
|
||||
unsigned int flags) {
|
||||
lxc_driver_t *driver = conn->privateData;
|
||||
virDomainObjPtr vm = NULL;
|
||||
virDomainDefPtr def;
|
||||
virDomainPtr dom = NULL;
|
||||
virDomainEventPtr event = NULL;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
lxcDriverLock(driver);
|
||||
if (!(def = virDomainDefParseString(driver->caps, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/*---------------------------------------------------------------------------*/
|
||||
/* Copyright 2002-2009, Distributed Systems Architecture Group, Universidad
|
||||
/*
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright 2002-2009, Distributed Systems Architecture Group, Universidad
|
||||
* Complutense de Madrid (dsa-research.org)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -435,13 +437,15 @@ return_point:
|
|||
static virDomainPtr
|
||||
oneDomainCreateAndStart(virConnectPtr conn,
|
||||
const char *xml,
|
||||
unsigned int flags ATTRIBUTE_UNUSED) {
|
||||
unsigned int flags) {
|
||||
one_driver_t *driver = conn->privateData;
|
||||
virDomainObjPtr vm = NULL;
|
||||
virDomainDefPtr def;
|
||||
virDomainPtr dom = NULL;
|
||||
int oneid;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
oneDriverLock(driver);
|
||||
if (!(def = virDomainDefParseString(driver->caps, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
|
|
|
@ -873,7 +873,7 @@ cleanup:
|
|||
|
||||
static virDomainPtr
|
||||
openvzDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
unsigned int flags ATTRIBUTE_UNUSED)
|
||||
unsigned int flags)
|
||||
{
|
||||
struct openvz_driver *driver = conn->privateData;
|
||||
virDomainDefPtr vmdef = NULL;
|
||||
|
@ -881,6 +881,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
|
|||
virDomainPtr dom = NULL;
|
||||
const char *progstart[] = {VZCTL, "--quiet", "start", PROGRAM_SENTINAL, NULL};
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
openvzDriverLock(driver);
|
||||
if ((vmdef = virDomainDefParseString(driver->caps, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE)) == NULL)
|
||||
|
|
|
@ -1397,7 +1397,7 @@ phypDomainDestroy(virDomainPtr dom)
|
|||
static virDomainPtr
|
||||
phypDomainCreateAndStart(virConnectPtr conn,
|
||||
const char *xml,
|
||||
unsigned int flags ATTRIBUTE_UNUSED)
|
||||
unsigned int flags)
|
||||
{
|
||||
|
||||
ConnectionData *connection_data = conn->networkPrivateData;
|
||||
|
@ -1410,6 +1410,8 @@ phypDomainCreateAndStart(virConnectPtr conn,
|
|||
unsigned int i = 0;
|
||||
char *managed_system = phyp_driver->managed_system;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
if (!(def = virDomainDefParseString(phyp_driver->caps, xml,
|
||||
VIR_DOMAIN_XML_SECURE)))
|
||||
goto err;
|
||||
|
|
|
@ -4181,13 +4181,15 @@ static int qemudNumDomains(virConnectPtr conn) {
|
|||
}
|
||||
|
||||
static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
|
||||
unsigned int flags ATTRIBUTE_UNUSED) {
|
||||
unsigned int flags) {
|
||||
struct qemud_driver *driver = conn->privateData;
|
||||
virDomainDefPtr def;
|
||||
virDomainObjPtr vm = NULL;
|
||||
virDomainPtr dom = NULL;
|
||||
virDomainEventPtr event = NULL;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
qemuDriverLock(driver);
|
||||
if (!(def = virDomainDefParseString(driver->caps, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
|
|
|
@ -1287,7 +1287,7 @@ cleanup:
|
|||
|
||||
static virDomainPtr
|
||||
testDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
unsigned int flags ATTRIBUTE_UNUSED)
|
||||
unsigned int flags)
|
||||
{
|
||||
testConnPtr privconn = conn->privateData;
|
||||
virDomainPtr ret = NULL;
|
||||
|
@ -1295,6 +1295,8 @@ testDomainCreateXML(virConnectPtr conn, const char *xml,
|
|||
virDomainObjPtr dom = NULL;
|
||||
virDomainEventPtr event = NULL;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
testDriverLock(privconn);
|
||||
if ((def = virDomainDefParseString(privconn->caps, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE)) == NULL)
|
||||
|
|
|
@ -1262,12 +1262,14 @@ static int umlNumDomains(virConnectPtr conn) {
|
|||
return n;
|
||||
}
|
||||
static virDomainPtr umlDomainCreate(virConnectPtr conn, const char *xml,
|
||||
unsigned int flags ATTRIBUTE_UNUSED) {
|
||||
unsigned int flags) {
|
||||
struct uml_driver *driver = conn->privateData;
|
||||
virDomainDefPtr def;
|
||||
virDomainObjPtr vm = NULL;
|
||||
virDomainPtr dom = NULL;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
umlDriverLock(driver);
|
||||
if (!(def = virDomainDefParseString(driver->caps, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
|
|
|
@ -991,7 +991,7 @@ cleanup:
|
|||
}
|
||||
|
||||
static virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
unsigned int flags ATTRIBUTE_UNUSED) {
|
||||
unsigned int flags) {
|
||||
/* VirtualBox currently doesn't have support for running
|
||||
* virtual machines without actually defining them and thus
|
||||
* for time being just define new machine and start it.
|
||||
|
@ -1000,7 +1000,11 @@ static virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml,
|
|||
* change this behaviour to the expected one.
|
||||
*/
|
||||
|
||||
virDomainPtr dom = vboxDomainDefineXML(conn, xml);
|
||||
virDomainPtr dom;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
dom = vboxDomainDefineXML(conn, xml);
|
||||
if (dom == NULL)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -3788,7 +3788,7 @@ xenDaemonLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
|
|||
*/
|
||||
static virDomainPtr
|
||||
xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc,
|
||||
unsigned int flags ATTRIBUTE_UNUSED)
|
||||
unsigned int flags)
|
||||
{
|
||||
int ret;
|
||||
char *sexpr;
|
||||
|
@ -3796,6 +3796,8 @@ xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc,
|
|||
xenUnifiedPrivatePtr priv;
|
||||
virDomainDefPtr def;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
priv = (xenUnifiedPrivatePtr) conn->privateData;
|
||||
|
||||
if (!(def = virDomainDefParseString(priv->caps,
|
||||
|
|
|
@ -479,7 +479,7 @@ xenapiNumOfDomains (virConnectPtr conn)
|
|||
static virDomainPtr
|
||||
xenapiDomainCreateXML (virConnectPtr conn,
|
||||
const char *xmlDesc,
|
||||
unsigned int flags ATTRIBUTE_UNUSED)
|
||||
unsigned int flags)
|
||||
{
|
||||
xen_vm_record *record = NULL;
|
||||
xen_vm vm = NULL;
|
||||
|
@ -489,6 +489,8 @@ xenapiDomainCreateXML (virConnectPtr conn,
|
|||
if (!caps)
|
||||
return NULL;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
virDomainDefPtr defPtr = virDomainDefParseString(caps, xmlDesc, flags);
|
||||
createVMRecordFromXml(conn, defPtr, &record, &vm);
|
||||
virDomainDefFree(defPtr);
|
||||
|
|
Loading…
Reference in New Issue