diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 5468365c45..506baf44cc 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -10175,7 +10175,12 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptStringReq(ctl, cmd, "target", &target) < 0) goto cleanup; - if (!(doc = virDomainGetXMLDesc(dom, 0))) + if (flags == VIR_DOMAIN_AFFECT_CONFIG) + doc = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_INACTIVE); + else + doc = virDomainGetXMLDesc(dom, 0); + + if (!doc) goto cleanup; if (persistent &&