mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
Remove VIR_CONNECT_RO checks from xen drivers
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@redhat.com>
This commit is contained in:
parent
a855556f88
commit
8b7cb0025b
@ -565,8 +565,7 @@ xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory)
|
|||||||
xenXMConfCachePtr entry;
|
xenXMConfCachePtr entry;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (domain->conn->flags & VIR_CONNECT_RO || domain->id != -1 ||
|
if (domain->id != -1 || memory < 1024 * MIN_XEN_GUEST_SIZE)
|
||||||
memory < 1024 * MIN_XEN_GUEST_SIZE)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
@ -604,7 +603,7 @@ xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
|
|||||||
xenXMConfCachePtr entry;
|
xenXMConfCachePtr entry;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (domain->conn->flags & VIR_CONNECT_RO || domain->id != -1)
|
if (domain->id != -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
@ -686,10 +685,6 @@ xenXMDomainSetVcpusFlags(virDomainPtr domain,
|
|||||||
VIR_DOMAIN_VCPU_CONFIG |
|
VIR_DOMAIN_VCPU_CONFIG |
|
||||||
VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||||
|
|
||||||
if (domain->conn->flags & VIR_CONNECT_RO) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (domain->id != -1)
|
if (domain->id != -1)
|
||||||
return -2;
|
return -2;
|
||||||
if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
||||||
@ -814,11 +809,6 @@ xenXMDomainPinVcpu(virDomainPtr domain,
|
|||||||
virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (domain->conn->flags & VIR_CONNECT_RO) {
|
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
|
||||||
"%s", _("read only connection"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (domain->id != -1) {
|
if (domain->id != -1) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
"%s", _("not inactive domain"));
|
"%s", _("not inactive domain"));
|
||||||
@ -1003,9 +993,6 @@ xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
|
|||||||
xenXMConfCachePtr entry = NULL;
|
xenXMConfCachePtr entry = NULL;
|
||||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
|
|
||||||
if (conn->flags & VIR_CONNECT_RO)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
|
|
||||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh(conn) < 0) {
|
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh(conn) < 0) {
|
||||||
@ -1140,8 +1127,6 @@ xenXMDomainUndefine(virDomainPtr domain)
|
|||||||
|
|
||||||
if (domain->id != -1)
|
if (domain->id != -1)
|
||||||
return -1;
|
return -1;
|
||||||
if (domain->conn->flags & VIR_CONNECT_RO)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
|
|
||||||
@ -1292,9 +1277,6 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain,
|
|||||||
|
|
||||||
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
|
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) ||
|
if ((flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) ||
|
||||||
(domain->id != -1 && flags == VIR_DOMAIN_DEVICE_MODIFY_CURRENT)) {
|
(domain->id != -1 && flags == VIR_DOMAIN_DEVICE_MODIFY_CURRENT)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
@ -1386,9 +1368,6 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain,
|
|||||||
|
|
||||||
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
|
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) ||
|
if ((flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) ||
|
||||||
(domain->id != -1 && flags == VIR_DOMAIN_DEVICE_MODIFY_CURRENT)) {
|
(domain->id != -1 && flags == VIR_DOMAIN_DEVICE_MODIFY_CURRENT)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
|
@ -133,7 +133,7 @@ virDomainDoStoreWrite(virDomainPtr domain, const char *path, const char *value)
|
|||||||
xenUnifiedPrivatePtr priv = domain->conn->privateData;
|
xenUnifiedPrivatePtr priv = domain->conn->privateData;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (priv->xshandle == NULL || domain->conn->flags & VIR_CONNECT_RO)
|
if (priv->xshandle == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
snprintf(s, 255, "/local/domain/%d/%s", domain->id, path);
|
snprintf(s, 255, "/local/domain/%d/%s", domain->id, path);
|
||||||
|
Loading…
Reference in New Issue
Block a user