On Thu, Jan 08, 2015 at 15:48:12 +0000, Daniel Berrange wrote:
The virDomainDefineXML method is one of the few that still lacks
an 'unsigned int flags' parameter. This will be needed for adding
XML validation to this API. virDomainCreateXML fortunately already
has flags.
---
include/libvirt/libvirt-domain.h | 4 ++++
src/driver-hypervisor.h | 5 +++++
src/libvirt-domain.c | 48 ++++++++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 5 +++++
src/remote/remote_driver.c | 1 +
src/remote/remote_protocol.x | 19 +++++++++++++++-
src/remote_protocol-structs | 8 +++++++
7 files changed, 89 insertions(+), 1 deletion(-)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 0b1a2d6..3a83571 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -1422,6 +1422,10 @@ int virDomainMemoryPeek (virDomainPtr dom,
*/
virDomainPtr virDomainDefineXML (virConnectPtr conn,
const char *xml);
+
+virDomainPtr virDomainDefineXMLFlags (virConnectPtr conn,
+ const char *xml,
+ unsigned int flags);
int virDomainUndefine (virDomainPtr domain);
typedef enum {
diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h
index 9f26b13..a1d2a0a 100644
--- a/src/driver-hypervisor.h
+++ b/src/driver-hypervisor.h
@@ -314,6 +314,10 @@ typedef int
typedef virDomainPtr
(*virDrvDomainDefineXML)(virConnectPtr conn,
const char *xml);
+typedef virDomainPtr
+(*virDrvDomainDefineXMLFlags)(virConnectPtr conn,
+ const char *xml,
+ unsigned int flags);
typedef int
(*virDrvDomainUndefine)(virDomainPtr dom);
@@ -1265,6 +1269,7 @@ struct _virHypervisorDriver {
virDrvDomainCreateWithFlags domainCreateWithFlags;
virDrvDomainCreateWithFiles domainCreateWithFiles;
virDrvDomainDefineXML domainDefineXML;
+ virDrvDomainDefineXMLFlags domainDefineXMLFlags;
virDrvDomainUndefine domainUndefine;
virDrvDomainUndefineFlags domainUndefineFlags;
virDrvDomainAttachDevice domainAttachDevice;
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 6ec68aa..e211fac 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -6476,6 +6476,54 @@ virDomainDefineXML(virConnectPtr conn, const char *xml)
/**
+ * virDomainDefineXMLFlags:
+ * @conn: pointer to the hypervisor connection
+ * @xml: the XML description for the domain, preferably in UTF-8
+ * @flags: bitwise OR of virDomainDefineFlags
Strictly speaking, @flags should be documented as unused until 10/11
where it should be changed to virDomainDefineFlags since this enum does
not exist until then.
The rest of the patch looks good. ACK.
Jirka