Xen was the trickiest, since it supports two formats.
* src/esx/esx_driver.c (esxDomainNativeFormats): New function.
* src/libxl/libxl_driver.c (libxlDomainNativeFormats): Likewise.
* src/qemu/qemu_driver.c (qemuDomainNativeFormats): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainNativeFormats): Likewise.
---
src/esx/esx_driver.c | 20 +++++++++++++++++++-
src/libxl/libxl_driver.c | 22 ++++++++++++++++++++--
src/qemu/qemu_driver.c | 17 +++++++++++++++++
src/xen/xen_driver.c | 27 ++++++++++++++++++++++++++-
4 files changed, 82 insertions(+), 4 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 1e424eb..b29c642 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -2,7 +2,7 @@
/*
* esx_driver.c: core driver functions for managing VMware ESX hosts
*
- * Copyright (C) 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2010-2012 Red Hat, Inc.
* Copyright (C) 2009-2011 Matthias Bolte <matthias.bolte(a)googlemail.com>
* Copyright (C) 2009 Maximilian Wilhelm <max(a)rfc2324.org>
*
@@ -2941,6 +2941,23 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
}
+static int
+esxDomainNativeFormats(virConnectPtr conn ATTRIBUTE_UNUSED,
+ char **formats, int nformats, unsigned int flags)
+{
+ virCheckFlags(0, -1);
+
+ if (!nformats)
+ return 1;
+
+ if ((*formats = strdup("vmware-vmx")) == NULL) {
+ virReportOOMError();
+ return -1;
+ }
+
+ return 1;
+}
+
static int
esxListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
@@ -4978,6 +4995,7 @@ static virDriver esxDriver = {
.domainGetXMLDesc = esxDomainGetXMLDesc, /* 0.7.0 */
.domainXMLFromNative = esxDomainXMLFromNative, /* 0.7.0 */
.domainXMLToNative = esxDomainXMLToNative, /* 0.7.2 */
+ .domainNativeFormats = esxDomainNativeFormats, /* 0.9.10 */
.listDefinedDomains = esxListDefinedDomains, /* 0.7.0 */
.numOfDefinedDomains = esxNumberOfDefinedDomains, /* 0.7.0 */
.domainCreate = esxDomainCreate, /* 0.7.0 */
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 0500ed0..72b1d03 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------*/
-/* Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+/* Copyright (C) 2006-2012 Red Hat, Inc.
+ * Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
* Copyright (C) 2011 Univention GmbH.
- * Copyright (C) 2006-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -2633,6 +2633,23 @@ cleanup:
}
static int
+libxlDomainNativeFormats(virConnectPtr conn ATTRIBUTE_UNUSED,
+ char **formats, int nformats, unsigned int flags)
+{
+ virCheckFlags(0, -1);
+
+ if (!nformats)
+ return 1;
+
+ if ((*formats = strdup(LIBXL_CONFIG_FORMAT_XM)) == NULL) {
+ virReportOOMError();
+ return -1;
+ }
+
+ return 1;
+}
+
+static int
libxlListDefinedDomains(virConnectPtr conn,
char **const names, int nnames)
{
@@ -3900,6 +3917,7 @@ static virDriver libxlDriver = {
.domainGetXMLDesc = libxlDomainGetXMLDesc, /* 0.9.0 */
.domainXMLFromNative = libxlDomainXMLFromNative, /* 0.9.0 */
.domainXMLToNative = libxlDomainXMLToNative, /* 0.9.0 */
+ .domainNativeFormats = libxlDomainNativeFormats, /* 0.9.10 */
.listDefinedDomains = libxlListDefinedDomains, /* 0.9.0 */
.numOfDefinedDomains = libxlNumDefinedDomains, /* 0.9.0 */
.domainCreate = libxlDomainCreate, /* 0.9.0 */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 712f1fc..c3f4510 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4544,6 +4544,22 @@ cleanup:
return ret;
}
+static int
+qemuDomainNativeFormats(virConnectPtr conn ATTRIBUTE_UNUSED,
+ char **formats, int nformats, unsigned int flags)
+{
+ virCheckFlags(0, -1);
+
+ if (!nformats)
+ return 1;
+
+ if ((*formats = strdup(QEMU_CONFIG_FORMAT_ARGV)) == NULL) {
+ virReportOOMError();
+ return -1;
+ }
+
+ return 1;
+}
static int qemudListDefinedDomains(virConnectPtr conn,
char **const names, int nnames) {
@@ -11890,6 +11906,7 @@ static virDriver qemuDriver = {
.domainGetXMLDesc = qemuDomainGetXMLDesc, /* 0.2.0 */
.domainXMLFromNative = qemuDomainXMLFromNative, /* 0.6.4 */
.domainXMLToNative = qemuDomainXMLToNative, /* 0.6.4 */
+ .domainNativeFormats = qemuDomainNativeFormats, /* 0.9.10 */
.listDefinedDomains = qemudListDefinedDomains, /* 0.2.0 */
.numOfDefinedDomains = qemudNumDefinedDomains, /* 0.2.0 */
.domainCreate = qemuDomainStart, /* 0.2.0 */
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 20671c0..1cec988 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1,7 +1,7 @@
/*
* xen_driver.c: Unified Xen driver.
*
- * Copyright (C) 2007-2011 Red Hat, Inc.
+ * Copyright (C) 2007-2012 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
@@ -1352,6 +1352,30 @@ cleanup:
return ret;
}
+static int
+xenUnifiedDomainNativeFormats(virConnectPtr conn ATTRIBUTE_UNUSED,
+ char **formats, int nformats,
+ unsigned int flags)
+{
+ virCheckFlags(0, -1);
+
+ if (!nformats)
+ return 2;
+
+ if ((formats[0] = strdup(XEN_CONFIG_FORMAT_XM)) == NULL)
+ goto memory;
+ if (nformats > 1 &&
+ (formats[1] = strdup(XEN_CONFIG_FORMAT_SEXPR)) == NULL)
+ goto memory;
+
+ return nformats < 2 ? nformats : 2;
+
+memory:
+ virReportOOMError();
+ VIR_FREE(formats[0]);
+ return -1;
+}
+
static int
xenUnifiedDomainMigratePrepare (virConnectPtr dconn,
@@ -2210,6 +2234,7 @@ static virDriver xenUnifiedDriver = {
.domainGetXMLDesc = xenUnifiedDomainGetXMLDesc, /* 0.0.3 */
.domainXMLFromNative = xenUnifiedDomainXMLFromNative, /* 0.6.4 */
.domainXMLToNative = xenUnifiedDomainXMLToNative, /* 0.6.4 */
+ .domainNativeFormats = xenUnifiedDomainNativeFormats, /* 0.9.10 */
.listDefinedDomains = xenUnifiedListDefinedDomains, /* 0.1.1 */
.numOfDefinedDomains = xenUnifiedNumOfDefinedDomains, /* 0.1.5 */
.domainCreate = xenUnifiedDomainCreate, /* 0.1.1 */
--
1.7.7.5