Re: [PATCH 1/3] virsh-domain: Add --live, --config, --current logic to cmdAttachDevice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/28/2013 06:52 PM, Peter Krempa wrote:
Use the approach established in commit
69ce3ffa8d431e9810607c6e00b7cfcc481b491d to improve this function too.
---
  tools/virsh-domain.c | 41 ++++++++++++++++++++++++++++++++---------
  tools/virsh.pod      | 16 +++++++++++++---
  2 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 0402aef..b965c11 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -173,13 +173,21 @@ static const vshCmdOptDef opts_attach_device[] = {
       .help = N_("XML file")
      },
      {.name = "persistent",
-     .type = VSH_OT_ALIAS,
-     .help = "config"
+     .type = VSH_OT_BOOL,
+     .help = N_("make live change persistent")
      },
      {.name = "config",
       .type = VSH_OT_BOOL,
       .help = N_("affect next boot")
      },
+    {.name = "live",
+     .type = VSH_OT_BOOL,
+     .help = N_("affect running domain")
+    },
+    {.name = "current",
+     .type = VSH_OT_BOOL,
+     .help = N_("affect current domain")
+    },
      {.name = NULL}
  };

@@ -191,7 +199,21 @@ cmdAttachDevice(vshControl *ctl, const vshCmd *cmd)
      char *buffer;
      int rv;
      bool ret = false;
-    unsigned int flags;
+    unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
+    bool current = vshCommandOptBool(cmd, "current");
+    bool config = vshCommandOptBool(cmd, "config");
+    bool live = vshCommandOptBool(cmd, "live");
+    bool persistent = vshCommandOptBool(cmd, "persistent");
+
+    VSH_EXCLUSIVE_OPTIONS_VAR(persistent, current);


   VSH_EXCLUSIVE_OPTIONS_VAR(current, persistent)
   could be a little more consistent with the following two lines.



+
+    VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+    VSH_EXCLUSIVE_OPTIONS_VAR(current, config);

ACK.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]