]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fri Feb 23 10:26:24 IST 2007 Mark McLoughlin <markmc@redhat.com>
authorMark McLoughlin <markmc@redhat.com>
Fri, 23 Feb 2007 10:27:53 +0000 (10:27 +0000)
committerMark McLoughlin <markmc@redhat.com>
Fri, 23 Feb 2007 10:27:53 +0000 (10:27 +0000)
        * src/virsh.c: in "start" and "net-start" use e.g.
        vshCommandOptDomainBy() so that we actually get an
        error message if the domain/network isn't found.

ChangeLog
src/virsh.c

index 9507e17654516f5af37712b6f74b6835e83f1627..dacdc51514e0a52be4bd1f147f8d964a4d8e52f6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Feb 23 10:26:24 IST 2007 Mark McLoughlin <markmc@redhat.com>
+
+       * src/virsh.c: in "start" and "net-start" use e.g.
+       vshCommandOptDomainBy() so that we actually get an
+       error message if the domain/network isn't found.
+       
 Fri Feb 23 09:11:53 IST 2007 Mark McLoughlin <markmc@redhat.com>
 
        * qemud/conf.c: actually autostart guests/networks at startup
index 010f70f353d449edfeb04a4002f7b723b699331e..f232d8ead4ea8081b16d2658342ceb80959185d0 100644 (file)
@@ -814,19 +814,12 @@ static int
 cmdStart(vshControl * ctl, vshCmd * cmd)
 {
     virDomainPtr dom;
-    char *name;
-    int found;
     int ret = TRUE;
 
     if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
         return FALSE;
 
-    name = vshCommandOptString(cmd, "name", &found);
-    if (!found)
-        return FALSE;
-
-    dom = virDomainLookupByName(ctl->conn, name);
-    if (!dom)
+    if (!(dom = vshCommandOptDomainBy(ctl, cmd, "name", NULL, VSH_BYNAME)))
         return FALSE;
 
     if (virDomainGetID(dom) != (unsigned int)-1) {
@@ -836,9 +829,10 @@ cmdStart(vshControl * ctl, vshCmd * cmd)
 
     if (virDomainCreate(dom) == 0) {
         vshPrint(ctl, _("Domain %s started\n"),
-                 name);
+                 virDomainGetName(dom));
     } else {
-        vshError(ctl, FALSE, _("Failed to start domain %s"), name);
+        vshError(ctl, FALSE, _("Failed to start domain %s"),
+                 virDomainGetName(dom));
         ret = FALSE;
     }
     return ret;
@@ -2085,26 +2079,20 @@ static int
 cmdNetworkStart(vshControl * ctl, vshCmd * cmd)
 {
     virNetworkPtr network;
-    char *name;
-    int found;
     int ret = TRUE;
 
     if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
         return FALSE;
 
-    name = vshCommandOptString(cmd, "name", &found);
-    if (!found)
-        return FALSE;
-
-    network = virNetworkLookupByName(ctl->conn, name);
-    if (!network)
-        return FALSE;
+    if (!(network = vshCommandOptNetworkBy(ctl, cmd, "name", NULL, VSH_BYNAME)))
+         return FALSE;
 
     if (virNetworkCreate(network) == 0) {
         vshPrint(ctl, _("Network %s started\n"),
-                 name);
+                 virNetworkGetName(network));
     } else {
-      vshError(ctl, FALSE, _("Failed to start network %s"), name);
+        vshError(ctl, FALSE, _("Failed to start network %s"),
+                 virNetworkGetName(network));
         ret = FALSE;
     }
     return ret;