# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1212540049 25200
# Node ID 8fdff95eb25e04745c992a76a85f45039e5022a5
# Parent 345ed17b623f12a2befafa7841c2ae89b1a47dc7
Add KVM proc/mem check in _resource_dynamic().
KVM doesn't support VCPU / memory modification of running guests.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 345ed17b623f -r 8fdff95eb25e src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Tue Jun 03 11:48:18 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Tue Jun 03 17:40:49 2008 -0700
@@ -912,6 +912,7 @@
virConnectPtr conn;
virDomainPtr dom;
int (*func)(virDomainPtr, struct virt_device *);
+ char *prefix = NULL;
if (action == RESOURCE_ADD)
func = attach_device;
@@ -951,6 +952,17 @@
goto out;
}
+ prefix = class_prefix_name(refcn);
+
+ if (((dev->type == CIM_RES_TYPE_PROC) ||
+ (dev->type == CIM_RES_TYPE_MEM)) && (STREQ(prefix,
"KVM"))) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Running guest cannot modify resource type %"
PRIu16,
+ dev->type);
+ goto out;
+ }
+
CU_DEBUG("Doing dynamic device update for `%s'",
dominfo->name);
if (func(dom, dev) == 0) {
@@ -963,6 +975,7 @@
"");
}
out:
+ free(prefix);
virDomainFree(dom);
virConnectClose(conn);
Show replies by date
KR> + if (((dev->type == CIM_RES_TYPE_PROC) ||
KR> + (dev->type == CIM_RES_TYPE_MEM)) && (STREQ(prefix,
"KVM"))) {
KR> + cu_statusf(_BROKER, &s,
KR> + CMPI_RC_ERR_FAILED,
KR> + "Running guest cannot modify resource type %"
PRIu16,
KR> + dev->type);
KR> + goto out;
KR> + }
Hmm, this means we need to update the provider code when KVM gains
specific features like that. Is there some way we can just ignore
failures to dynamically add/rem/mod resources, or perhaps ignore
ENOTSUPPORTED or something?
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms(a)us.ibm.com