[PATCH 02/40] Remove VIR_CONNECT_RO checks from xen drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Some of the Xen sub-drivers have checks against the
VIR_CONNECT_RO flag. This is not required, since such
checks are done at the top level before the driver
methods are invoked

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/xen/xm_internal.c | 24 ++----------------------
 src/xen/xs_internal.c |  2 +-
 2 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 8ac7cb0..8580793 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -565,7 +565,7 @@ xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory)
     xenXMConfCachePtr entry;
     int ret = -1;
 
-    if (domain->conn->flags & VIR_CONNECT_RO || domain->id != -1 ||
+    if (domain->id != -1 ||
         memory < 1024 * MIN_XEN_GUEST_SIZE)
         return -1;
 
@@ -604,7 +604,7 @@ xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
     xenXMConfCachePtr entry;
     int ret = -1;
 
-    if (domain->conn->flags & VIR_CONNECT_RO || domain->id != -1)
+    if (domain->id != -1)
         return -1;
 
     xenUnifiedLock(priv);
@@ -686,10 +686,6 @@ xenXMDomainSetVcpusFlags(virDomainPtr domain,
                   VIR_DOMAIN_VCPU_CONFIG |
                   VIR_DOMAIN_VCPU_MAXIMUM, -1);
 
-    if (domain->conn->flags & VIR_CONNECT_RO) {
-        virReportError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
-        return -1;
-    }
     if (domain->id != -1)
         return -2;
     if (flags & VIR_DOMAIN_VCPU_LIVE) {
@@ -814,11 +810,6 @@ xenXMDomainPinVcpu(virDomainPtr domain,
         virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
-    if (domain->conn->flags & VIR_CONNECT_RO) {
-        virReportError(VIR_ERR_INVALID_ARG,
-                       "%s", _("read only connection"));
-        return -1;
-    }
     if (domain->id != -1) {
         virReportError(VIR_ERR_INVALID_ARG,
                        "%s", _("not inactive domain"));
@@ -1003,9 +994,6 @@ xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
     xenXMConfCachePtr entry = NULL;
     xenUnifiedPrivatePtr priv = conn->privateData;
 
-    if (conn->flags & VIR_CONNECT_RO)
-        return NULL;
-
     xenUnifiedLock(priv);
 
     if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh(conn) < 0) {
@@ -1140,8 +1128,6 @@ xenXMDomainUndefine(virDomainPtr domain)
 
     if (domain->id != -1)
         return -1;
-    if (domain->conn->flags & VIR_CONNECT_RO)
-        return -1;
 
     xenUnifiedLock(priv);
 
@@ -1292,9 +1278,6 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain,
 
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
 
-    if (domain->conn->flags & VIR_CONNECT_RO)
-        return -1;
-
     if ((flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) ||
         (domain->id != -1 && flags == VIR_DOMAIN_DEVICE_MODIFY_CURRENT)) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
@@ -1386,9 +1369,6 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain,
 
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
 
-    if (domain->conn->flags & VIR_CONNECT_RO)
-        return -1;
-
     if ((flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) ||
         (domain->id != -1 && flags == VIR_DOMAIN_DEVICE_MODIFY_CURRENT)) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index 5f0df63..393e5f9 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -133,7 +133,7 @@ virDomainDoStoreWrite(virDomainPtr domain, const char *path, const char *value)
     xenUnifiedPrivatePtr priv = domain->conn->privateData;
     int ret = -1;
 
-    if (priv->xshandle == NULL || domain->conn->flags & VIR_CONNECT_RO)
+    if (priv->xshandle == NULL)
         return -1;
 
     snprintf(s, 255, "/local/domain/%d/%s", domain->id, path);
-- 
1.8.1.4

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]