libvirt/detach-disk.patch

65 lines
2.3 KiB
Diff

Index: libvirt-0.7.5/src/xen/xend_internal.c
===================================================================
--- libvirt-0.7.5.orig/src/xen/xend_internal.c
+++ libvirt-0.7.5/src/xen/xend_internal.c
@@ -4123,13 +4123,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,
@@ -4229,12 +4228,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.5/src/libvirt.c
===================================================================
--- libvirt-0.7.5.orig/src/libvirt.c
+++ libvirt-0.7.5/src/libvirt.c
@@ -5066,7 +5066,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.
*/
@@ -5109,7 +5110,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.
*/