[libvirt] [PATCH] virsh: change-media: Fix behavior with --update without a source

Docs state that it should behave like eject. Currently the code does not do that. This is a regression since f4b5f53027da4fed2250628e11bac4019. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1229592 --- tools/virsh-domain.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index a25b7ba..4c47473 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 -- 2.4.1

On 06/09/2015 05:41 AM, Peter Krempa wrote:
Docs state that it should behave like eject. Currently the code does not do that. This is a regression since f4b5f53027da4fed2250628e11bac4019.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1229592 --- tools/virsh-domain.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
ACK -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Tue, Jun 09, 2015 at 06:01:12 -0600, Eric Blake wrote:
On 06/09/2015 05:41 AM, Peter Krempa wrote:
Docs state that it should behave like eject. Currently the code does not do that. This is a regression since f4b5f53027da4fed2250628e11bac4019.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1229592 --- tools/virsh-domain.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
ACK
Pushed; thanks. Peter
participants (2)
-
Eric Blake
-
Peter Krempa