Re: [libvirt] [PATCH 45/66] vbox: Rewrite vboxDomainAttachDeviceFlags

2014-08-12 Thread Michal Privoznik

On 11.08.2014 12:06, Taowei wrote:

---
  src/vbox/vbox_common.c|   14 ++
  src/vbox/vbox_tmpl.c  |   15 ---
  src/vbox/vbox_uniformed_api.h |2 ++
  3 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 84d82d7..f22cb5b 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -4155,3 +4155,17 @@ int vboxDomainAttachDevice(virDomainPtr dom, const char 
*xml)
  {
  return vboxDomainAttachDeviceImpl(dom, xml, 0);
  }
+
+int vboxDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
+unsigned int flags)
+{
+virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+if (flags  VIR_DOMAIN_AFFECT_CONFIG) {
+virReportError(VIR_ERR_OPERATION_INVALID, %s,
+   _(cannot modify the persistent configuration of a 
domain));
+return -1;
+}


I know you're just copying pre-existing code, but this doesn't make much 
sense to me. I'd just drop VIR_DOMAIN_AFFECT_CONFIG flag from the 
virCheckFlags().


Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 45/66] vbox: Rewrite vboxDomainAttachDeviceFlags

2014-08-11 Thread Taowei
---
 src/vbox/vbox_common.c|   14 ++
 src/vbox/vbox_tmpl.c  |   15 ---
 src/vbox/vbox_uniformed_api.h |2 ++
 3 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 84d82d7..f22cb5b 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -4155,3 +4155,17 @@ int vboxDomainAttachDevice(virDomainPtr dom, const char 
*xml)
 {
 return vboxDomainAttachDeviceImpl(dom, xml, 0);
 }
+
+int vboxDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
+unsigned int flags)
+{
+virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+if (flags  VIR_DOMAIN_AFFECT_CONFIG) {
+virReportError(VIR_ERR_OPERATION_INVALID, %s,
+   _(cannot modify the persistent configuration of a 
domain));
+return -1;
+}
+
+return vboxDomainAttachDeviceImpl(dom, xml, 0);
+}
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index b80810d..5078f27 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -1649,21 +1649,6 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
 return ret;
 }
 
-static int
-vboxDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
-unsigned int flags)
-{
-virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
-
-if (flags  VIR_DOMAIN_AFFECT_CONFIG) {
-virReportError(VIR_ERR_OPERATION_INVALID, %s,
-   _(cannot modify the persistent configuration of a 
domain));
-return -1;
-}
-
-return vboxDomainAttachDeviceImpl(dom, xml, 0);
-}
-
 static int vboxDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
unsigned int flags)
 {
diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h
index 1f82616..69090f3 100644
--- a/src/vbox/vbox_uniformed_api.h
+++ b/src/vbox/vbox_uniformed_api.h
@@ -525,6 +525,8 @@ int vboxConnectListDefinedDomains(virConnectPtr conn,
   char ** const names, int maxnames);
 int vboxConnectNumOfDefinedDomains(virConnectPtr conn);
 int vboxDomainAttachDevice(virDomainPtr dom, const char *xml);
+int vboxDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
+unsigned int flags);
 
 /* Version specified functions for installing uniformed API */
 void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
-- 
1.7.9.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list