libvirt/detach-disk.patch

65 lines
2.3 KiB
Diff

Index: libvirt-0.7.4/src/xen/xend_internal.c
===================================================================
--- libvirt-0.7.4.orig/src/xen/xend_internal.c
+++ libvirt-0.7.4/src/xen/xend_internal.c
@@ -4109,13 +4109,12 @@ xenDaemonAttachDevice(virDomainPtr domai
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
- /*
- * on older Xen without the inactive guests management
- * avoid doing this on inactive guests
- */
- if ((domain->id < 0) && (priv->xendConfigVersion < 3))
+ if (domain->id < 0) {
+ virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ "%s", _("cannot attach device on inactive domain"));
return -1;
-
+ }
+
if (!(def = xenDaemonDomainFetch(domain->conn,
domain->id,
domain->name,
@@ -4213,12 +4212,11 @@ xenDaemonDetachDevice(virDomainPtr domai
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
- /*
- * on older Xen without the inactive guests management
- * avoid doing this on inactive guests
- */
- if ((domain->id < 0) && (priv->xendConfigVersion < 3))
+ if (domain->id < 0) {
+ virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ "%s", _("cannot detach device on inactive domain"));
return -1;
+ }
if (!(def = xenDaemonDomainFetch(domain->conn,
domain->id,
Index: libvirt-0.7.4/src/libvirt.c
===================================================================
--- libvirt-0.7.4.orig/src/libvirt.c
+++ libvirt-0.7.4/src/libvirt.c
@@ -4919,7 +4919,8 @@ error:
* @domain: pointer to domain object
* @xml: pointer to XML description of one device
*
- * Create a virtual device attachment to backend.
+ * Create a virtual device attachment to backend. This function, having
+ * hotplug semantics, is only allowed on an active domain.
*
* Returns 0 in case of success, -1 in case of failure.
*/
@@ -4962,7 +4963,8 @@ error:
* @domain: pointer to domain object
* @xml: pointer to XML description of one device
*
- * Destroy a virtual device attachment to backend.
+ * Destroy a virtual device attachment to backend. This function, having
+ * hot-unplug semantics, is only allowed on an active domain.
*
* Returns 0 in case of success, -1 in case of failure.
*/