forked from pool/libvirt
130 lines
4.2 KiB
Diff
130 lines
4.2 KiB
Diff
Index: libvirt-0.4.6/src/libvirt.c
|
|
===================================================================
|
|
--- libvirt-0.4.6.orig/src/libvirt.c
|
|
+++ libvirt-0.4.6/src/libvirt.c
|
|
@@ -2342,6 +2342,16 @@ virDomainMigrate (virDomainPtr domain,
|
|
return NULL;
|
|
}
|
|
|
|
+ if (domain->conn->flags & VIR_CONNECT_RO) {
|
|
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
+ return NULL;
|
|
+ }
|
|
+ if (dconn->flags & VIR_CONNECT_RO) {
|
|
+ /* NB, delibrately report error against source object, not dest here */
|
|
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
/* Check that migration is supported by both drivers. */
|
|
if (!VIR_DRV_SUPPORTS_FEATURE (conn->driver, conn,
|
|
VIR_DRV_FEATURE_MIGRATION_V1) ||
|
|
@@ -2419,6 +2429,11 @@ __virDomainMigratePrepare (virConnectPtr
|
|
return -1;
|
|
}
|
|
|
|
+ if (dconn->flags & VIR_CONNECT_RO) {
|
|
+ virLibConnError(dconn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
if (dconn->driver->domainMigratePrepare)
|
|
return dconn->driver->domainMigratePrepare (dconn, cookie, cookielen,
|
|
uri_in, uri_out,
|
|
@@ -2449,6 +2464,11 @@ __virDomainMigratePerform (virDomainPtr
|
|
}
|
|
conn = domain->conn;
|
|
|
|
+ if (domain->conn->flags & VIR_CONNECT_RO) {
|
|
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
if (conn->driver->domainMigratePerform)
|
|
return conn->driver->domainMigratePerform (domain, cookie, cookielen,
|
|
uri,
|
|
@@ -2476,6 +2496,11 @@ __virDomainMigrateFinish (virConnectPtr
|
|
return NULL;
|
|
}
|
|
|
|
+ if (dconn->flags & VIR_CONNECT_RO) {
|
|
+ virLibConnError(dconn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
if (dconn->driver->domainMigrateFinish)
|
|
return dconn->driver->domainMigrateFinish (dconn, dname,
|
|
cookie, cookielen,
|
|
@@ -2833,6 +2858,11 @@ virDomainBlockPeek (virDomainPtr dom,
|
|
}
|
|
conn = dom->conn;
|
|
|
|
+ if (dom->conn->flags & VIR_CONNECT_RO) {
|
|
+ virLibDomainError(dom, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
+ return (-1);
|
|
+ }
|
|
+
|
|
if (!path) {
|
|
virLibDomainError (dom, VIR_ERR_INVALID_ARG,
|
|
_("path is NULL"));
|
|
@@ -2908,6 +2938,11 @@ virDomainMemoryPeek (virDomainPtr dom,
|
|
}
|
|
conn = dom->conn;
|
|
|
|
+ if (dom->conn->flags & VIR_CONNECT_RO) {
|
|
+ virLibDomainError(dom, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
+ return (-1);
|
|
+ }
|
|
+
|
|
/* Flags must be VIR_MEMORY_VIRTUAL at the moment.
|
|
*
|
|
* Note on access to physical memory: A VIR_MEMORY_PHYSICAL flag is
|
|
@@ -3175,6 +3210,11 @@ virDomainSetAutostart(virDomainPtr domai
|
|
|
|
conn = domain->conn;
|
|
|
|
+ if (domain->conn->flags & VIR_CONNECT_RO) {
|
|
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
+ return (-1);
|
|
+ }
|
|
+
|
|
if (conn->driver->domainSetAutostart)
|
|
return conn->driver->domainSetAutostart (domain, autostart);
|
|
|
|
@@ -4125,6 +4165,11 @@ virNetworkSetAutostart(virNetworkPtr net
|
|
return (-1);
|
|
}
|
|
|
|
+ if (network->conn->flags & VIR_CONNECT_RO) {
|
|
+ virLibNetworkError(network, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
+ return (-1);
|
|
+ }
|
|
+
|
|
conn = network->conn;
|
|
|
|
if (conn->networkDriver && conn->networkDriver->networkSetAutostart)
|
|
@@ -4323,6 +4368,11 @@ virConnectFindStoragePoolSources(virConn
|
|
return NULL;
|
|
}
|
|
|
|
+ if (conn->flags & VIR_CONNECT_RO) {
|
|
+ virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
if (conn->storageDriver && conn->storageDriver->findPoolSources)
|
|
return conn->storageDriver->findPoolSources(conn, type, srcSpec, flags);
|
|
|
|
@@ -4996,6 +5046,11 @@ virStoragePoolSetAutostart(virStoragePoo
|
|
return (-1);
|
|
}
|
|
|
|
+ if (pool->conn->flags & VIR_CONNECT_RO) {
|
|
+ virLibStoragePoolError(pool, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
+ return (-1);
|
|
+ }
|
|
+
|
|
conn = pool->conn;
|
|
|
|
if (conn->storageDriver && conn->storageDriver->poolSetAutostart)
|