diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index a25b7ba969..4c4747369c 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -12411,6 +12411,15 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd) VSH_EXCLUSIVE_OPTIONS_VAR(eject, block); + if (vshCommandOptStringReq(ctl, cmd, "source", &source) < 0) + return false; + + /* Docs state that update without source is eject */ + if (update && !source) { + update = false; + eject = true; + } + if (eject) { update_type = VSH_UPDATE_DISK_XML_EJECT; action = "eject"; @@ -12445,9 +12454,6 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptStringReq(ctl, cmd, "path", &path) < 0) goto cleanup; - if (vshCommandOptStringReq(ctl, cmd, "source", &source) < 0) - goto cleanup; - if (flags & VIR_DOMAIN_AFFECT_CONFIG) doc = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_INACTIVE); else