From cee47aace104346ef975cb1fb3f7126a88c03244 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 25 Jan 2011 18:31:00 +0100 Subject: [PATCH] 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. --- AUTHORS | 3 ++- tools/virsh.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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;