|
|
c401cc |
From 33fd5cc8aab72a2a4d59fc3264700f0fee45ddd0 Mon Sep 17 00:00:00 2001
|
|
|
c401cc |
Message-Id: <33fd5cc8aab72a2a4d59fc3264700f0fee45ddd0.1389183250.git.jdenemar@redhat.com>
|
|
|
c401cc |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
c401cc |
Date: Wed, 8 Jan 2014 10:47:22 +0100
|
|
|
c401cc |
Subject: [PATCH] virsh: Don't use legacy API if --current is used on device
|
|
|
c401cc |
hot(un)plug
|
|
|
c401cc |
|
|
|
c401cc |
https://bugzilla.redhat.com/show_bug.cgi?id=1049529
|
|
|
c401cc |
|
|
|
c401cc |
The legacy virDomainAttachDevice and virDomainDetachDevice operate only
|
|
|
c401cc |
on active domains. When a user specified --current flag with an inactive
|
|
|
c401cc |
domain the old API was used and reported an error. Fix it by calling the
|
|
|
c401cc |
new API if --current is specified explicitly.
|
|
|
c401cc |
|
|
|
c401cc |
(cherry picked from commit 0bb64df1fcbf8248d8b71c44c8c882ae7b17d846)
|
|
|
c401cc |
|
|
|
c401cc |
Conflicts:
|
|
|
c401cc |
tools/virsh-domain.c - commit 3df33d7ad52d27bf9a41ab07e2c0ab6313
|
|
|
c401cc |
|
|
|
c401cc |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c401cc |
---
|
|
|
c401cc |
tools/virsh-domain.c | 12 ++++++------
|
|
|
c401cc |
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
c401cc |
|
|
|
c401cc |
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
|
|
|
c401cc |
index b017ec3..132b359 100644
|
|
|
c401cc |
--- a/tools/virsh-domain.c
|
|
|
c401cc |
+++ b/tools/virsh-domain.c
|
|
|
c401cc |
@@ -230,7 +230,7 @@ cmdAttachDevice(vshControl *ctl, const vshCmd *cmd)
|
|
|
c401cc |
goto cleanup;
|
|
|
c401cc |
}
|
|
|
c401cc |
|
|
|
c401cc |
- if (flags)
|
|
|
c401cc |
+ if (flags || current)
|
|
|
c401cc |
rv = virDomainAttachDeviceFlags(dom, buffer, flags);
|
|
|
c401cc |
else
|
|
|
c401cc |
rv = virDomainAttachDevice(dom, buffer);
|
|
|
c401cc |
@@ -672,7 +672,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
|
|
|
c401cc |
virDomainIsActive(dom) == 1)
|
|
|
c401cc |
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
|
|
c401cc |
|
|
|
c401cc |
- if (flags)
|
|
|
c401cc |
+ if (flags || current)
|
|
|
c401cc |
ret = virDomainAttachDeviceFlags(dom, xml, flags);
|
|
|
c401cc |
else
|
|
|
c401cc |
ret = virDomainAttachDevice(dom, xml);
|
|
|
c401cc |
@@ -926,7 +926,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
|
|
|
c401cc |
|
|
|
c401cc |
xml = virBufferContentAndReset(&buf;;
|
|
|
c401cc |
|
|
|
c401cc |
- if (flags)
|
|
|
c401cc |
+ if (flags || current)
|
|
|
c401cc |
ret = virDomainAttachDeviceFlags(dom, xml, flags);
|
|
|
c401cc |
else
|
|
|
c401cc |
ret = virDomainAttachDevice(dom, xml);
|
|
|
c401cc |
@@ -9425,7 +9425,7 @@ cmdDetachDevice(vshControl *ctl, const vshCmd *cmd)
|
|
|
c401cc |
goto cleanup;
|
|
|
c401cc |
}
|
|
|
c401cc |
|
|
|
c401cc |
- if (flags != 0)
|
|
|
c401cc |
+ if (flags != 0 || current)
|
|
|
c401cc |
ret = virDomainDetachDeviceFlags(dom, buffer, flags);
|
|
|
c401cc |
else
|
|
|
c401cc |
ret = virDomainDetachDevice(dom, buffer);
|
|
|
c401cc |
@@ -9706,7 +9706,7 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
|
|
|
c401cc |
goto cleanup;
|
|
|
c401cc |
}
|
|
|
c401cc |
|
|
|
c401cc |
- if (flags != 0) {
|
|
|
c401cc |
+ if (flags != 0 || current) {
|
|
|
c401cc |
ret = virDomainDetachDeviceFlags(dom,
|
|
|
c401cc |
(char *)xmlBufferContent(xml_buf),
|
|
|
c401cc |
flags);
|
|
|
c401cc |
@@ -10036,7 +10036,7 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd)
|
|
|
c401cc |
VSH_PREPARE_DISK_XML_NONE)))
|
|
|
c401cc |
goto cleanup;
|
|
|
c401cc |
|
|
|
c401cc |
- if (flags != 0)
|
|
|
c401cc |
+ if (flags != 0 || current)
|
|
|
c401cc |
ret = virDomainDetachDeviceFlags(dom, disk_xml, flags);
|
|
|
c401cc |
else
|
|
|
c401cc |
ret = virDomainDetachDevice(dom, disk_xml);
|
|
|
c401cc |
--
|
|
|
c401cc |
1.8.5.2
|
|
|
c401cc |
|