From: Michal Privoznik Date: Tue, 25 Jan 2011 17:31:00 +0000 (+0100) Subject: virsh: require --mac to avoid detach-interface ambiguity X-Git-Tag: v0.8.8~147 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cee47aace104346ef975cb1fb3f7126a88c03244;p=thirdparty%2Flibvirt.git virsh: require --mac to avoid detach-interface ambiguity bugfix for https://bugzilla.redhat.com/show_bug.cgi?id=671050 virsh simply refutes to detach-interface in case when multiple interfaces are attached and --mac is not specified. --- diff --git a/AUTHORS b/AUTHORS index c704a41626..4bc02b65b6 100644 --- a/AUTHORS +++ b/AUTHORS @@ -23,7 +23,7 @@ The primary maintainers and people with commit access rights: Guido Günther John Levon Matthias Bolte - Jiri Denemark + Jiří Denemark Dave Allan Laine Stump Stefan Berger @@ -144,6 +144,7 @@ Patches have also been contributed by: Paweł Krześniak Kay Schubert Marc-André Lureau + Michal Prívozník [....send patches to get your name here....] diff --git a/tools/virsh.c b/tools/virsh.c index aba794520b..4533d3899e 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -8557,6 +8557,12 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd) goto cleanup; } + if ((!mac) && (obj->nodesetval->nodeNr > 1)) { + vshError(ctl, _("Domain has %d interfaces. Please specify which one " + "to detach using --mac"), obj->nodesetval->nodeNr); + goto cleanup; + } + if (!mac) goto hit;