mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 10:31:16 +00:00
QEMU domain XML conversion from QEMU argv
This commit is contained in:
parent
7828b5ccb0
commit
3d4a0ccbc6
@ -1,3 +1,9 @@
|
||||
Thu May 21 15:16:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/qemu_driver.c, src/qemu_conf.c, src/qemu_conf.h: Add new
|
||||
APIs for converting from QEMU argv into domain XML, and use for
|
||||
domain XML conversion APIs.
|
||||
|
||||
Thu May 21 15:15:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/domain_conf.h, src/vbox/vbox_tmp.c: Fix typo s/ES97/AC97/
|
||||
|
1226
src/qemu_conf.c
1226
src/qemu_conf.c
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* config.h: VM configuration management
|
||||
* qemu_conf.h: QEMU configuration management
|
||||
*
|
||||
* Copyright (C) 2006, 2007, 2009 Red Hat, Inc.
|
||||
* Copyright (C) 2006 Daniel P. Berrange
|
||||
@ -135,6 +135,12 @@ int qemudBuildCommandLine (virConnectPtr conn,
|
||||
int *ntapfds,
|
||||
const char *migrateFrom);
|
||||
|
||||
virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
|
||||
const char **progenv,
|
||||
const char **progargv);
|
||||
virDomainDefPtr qemuParseCommandLineString(virConnectPtr conn,
|
||||
const char *args);
|
||||
|
||||
const char *qemudVirtTypeToString (int type);
|
||||
qemudDomainStatusPtr qemudDomainStatusParseFile(virConnectPtr conn,
|
||||
virCapsPtr caps,
|
||||
|
@ -3422,6 +3422,30 @@ cleanup:
|
||||
}
|
||||
|
||||
|
||||
static char *qemuDomainXMLFromNative(virConnectPtr conn,
|
||||
const char *format,
|
||||
const char *config,
|
||||
unsigned int flags ATTRIBUTE_UNUSED) {
|
||||
virDomainDefPtr def = NULL;
|
||||
char *xml = NULL;
|
||||
|
||||
if (STRNEQ(format, QEMU_CONFIG_FORMAT_ARGV)) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_ARG,
|
||||
_("unsupported config type %s"), format);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
def = qemuParseCommandLineString(conn, config);
|
||||
if (!def)
|
||||
goto cleanup;
|
||||
|
||||
xml = virDomainDefFormat(conn, def, VIR_DOMAIN_XML_INACTIVE);
|
||||
|
||||
cleanup:
|
||||
virDomainDefFree(def);
|
||||
return xml;
|
||||
}
|
||||
|
||||
static char *qemuDomainXMLToNative(virConnectPtr conn,
|
||||
const char *format,
|
||||
const char *xmlData,
|
||||
@ -3438,6 +3462,8 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
|
||||
char *ret = NULL;
|
||||
int i;
|
||||
|
||||
qemuDriverLock(driver);
|
||||
|
||||
if (STRNEQ(format, QEMU_CONFIG_FORMAT_ARGV)) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_ARG,
|
||||
_("unsupported config type %s"), format);
|
||||
@ -3536,6 +3562,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
|
||||
ret = virBufferContentAndReset(&buf);
|
||||
|
||||
cleanup:
|
||||
qemuDriverUnlock(driver);
|
||||
for (tmp = retargv ; tmp && *tmp ; tmp++)
|
||||
VIR_FREE(*tmp);
|
||||
VIR_FREE(retargv);
|
||||
@ -5351,7 +5378,7 @@ static virDriver qemuDriver = {
|
||||
qemudDomainGetSecurityLabel, /* domainGetSecurityLabel */
|
||||
qemudNodeGetSecurityModel, /* nodeGetSecurityModel */
|
||||
qemudDomainDumpXML, /* domainDumpXML */
|
||||
NULL, /* domainXmlFromNative */
|
||||
qemuDomainXMLFromNative, /* domainXmlFromNative */
|
||||
qemuDomainXMLToNative, /* domainXMLToNative */
|
||||
qemudListDefinedDomains, /* listDefinedDomains */
|
||||
qemudNumDefinedDomains, /* numOfDefinedDomains */
|
||||
|
Loading…
Reference in New Issue
Block a user