mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
vbox: Rewrite vboxDomainCreateXML
This commit is contained in:
parent
e979ad3991
commit
856ceb8cb3
@ -2160,3 +2160,31 @@ int vboxDomainCreate(virDomainPtr dom)
|
||||
{
|
||||
return vboxDomainCreateWithFlags(dom, 0);
|
||||
}
|
||||
|
||||
virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
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.
|
||||
*
|
||||
* TODO: After the appropriate API's are added in VirtualBox
|
||||
* change this behaviour to the expected one.
|
||||
*/
|
||||
|
||||
virDomainPtr dom;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
dom = vboxDomainDefineXML(conn, xml);
|
||||
if (dom == NULL)
|
||||
return NULL;
|
||||
|
||||
if (vboxDomainCreate(dom) < 0) {
|
||||
vboxDomainUndefineFlags(dom, 0);
|
||||
virObjectUnref(dom);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return dom;
|
||||
}
|
||||
|
@ -933,34 +933,6 @@ vboxSocketParseAddrUtf16(vboxGlobalData *data, const PRUnichar *utf16,
|
||||
return result;
|
||||
}
|
||||
|
||||
static virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
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.
|
||||
*
|
||||
* TODO: After the appropriate API's are added in VirtualBox
|
||||
* change this behaviour to the expected one.
|
||||
*/
|
||||
|
||||
virDomainPtr dom;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
dom = vboxDomainDefineXML(conn, xml);
|
||||
if (dom == NULL)
|
||||
return NULL;
|
||||
|
||||
if (vboxDomainCreate(dom) < 0) {
|
||||
vboxDomainUndefineFlags(dom, 0);
|
||||
virObjectUnref(dom);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return dom;
|
||||
}
|
||||
|
||||
static virDomainPtr
|
||||
vboxDomainLookupByName(virConnectPtr conn, const char *name)
|
||||
{
|
||||
|
@ -407,6 +407,8 @@ virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml);
|
||||
int vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags);
|
||||
int vboxDomainCreateWithFlags(virDomainPtr dom, unsigned int flags);
|
||||
int vboxDomainCreate(virDomainPtr dom);
|
||||
virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
unsigned int flags);
|
||||
|
||||
/* Version specified functions for installing uniformed API */
|
||||
void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
|
||||
|
Loading…
x
Reference in New Issue
Block a user