The API documentation now explicitly states that attaching and detaching devices is only permitted on active domains. This is already the case in the qemu driver, make it so in the Xen driver. --- src/xen/xend_internal.c | 22 ++++++++++------------ 1 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index d61e9e6..67d011e 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -4109,12 +4109,11 @@ xenDaemonAttachDevice(virDomainPtr domain, const char *xml) 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)) - return -1; + 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, @@ -4213,12 +4212,11 @@ xenDaemonDetachDevice(virDomainPtr domain, const char *xml) 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)) - return -1; + 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, -- 1.6.0.2 -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list