Index: virsh.c
===================================================================
RCS file: /data/cvs/libvirt/src/virsh.c,v
retrieving revision 1.73
diff -u -p -r1.73 virsh.c
--- virsh.c	13 Apr 2007 08:04:08 -0000	1.73
+++ virsh.c	27 Apr 2007 08:04:27 -0000
@@ -1387,7 +1387,7 @@ cmdVcpupin(vshControl * ctl, vshCmd * cm
  * "setvcpus" command
  */
 static vshCmdInfo info_setvcpus[] = {
-    {"syntax", "setvcpus <domain> <count>"},
+    {"syntax", "setvcpus <domain> <count> [ --static | --dynamic ]"},
     {"help", gettext_noop("change number of virtual CPUs")},
     {"desc", gettext_noop("Change the number of virtual CPUs active in the guest domain.")},
     {NULL, NULL}
@@ -1396,6 +1396,8 @@ static vshCmdInfo info_setvcpus[] = {
 static vshCmdOptDef opts_setvcpus[] = {
     {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("domain name, id or uuid")},
     {"count", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("number of virtual CPUs")},
+    {"static", VSH_OT_BOOL, 0, gettext_noop("static change")},
+    {"dynamic", VSH_OT_BOOL, 0, gettext_noop("dynamic change")},
     {NULL, 0, 0, NULL}
 };
 
@@ -1406,6 +1408,9 @@ cmdSetvcpus(vshControl * ctl, vshCmd * c
     int count;
     int maxcpu;
     int ret = TRUE;
+    int op_static = vshCommandOptBool(cmd, "static");
+    int op_dynamic = vshCommandOptBool(cmd, "dynamic");
+    int flag = VIR_DOMAIN_SCOPE_CURRENT;
 
     if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
         return FALSE;
@@ -1431,7 +1436,14 @@ cmdSetvcpus(vshControl * ctl, vshCmd * c
         return FALSE;
     }
 
-    if (virDomainSetVcpus(dom, count) != 0) {
+    if (op_static && op_dynamic) {
+        flag = VIR_DOMAIN_SCOPE_BOTH;
+    } else if (op_static) {
+        flag = VIR_DOMAIN_SCOPE_STATIC;
+    } else if (op_dynamic) {
+        flag = VIR_DOMAIN_SCOPE_DYNAMIC;
+    }
+    if (virDomainSetVcpusScope(dom, count, flag) !=0) {
         ret = FALSE;
     }
 
@@ -1443,7 +1455,7 @@ cmdSetvcpus(vshControl * ctl, vshCmd * c
  * "setmemory" command
  */
 static vshCmdInfo info_setmem[] = {
-    {"syntax", "setmem <domain> <kilobytes>"},
+    {"syntax", "setmem <domain> <kilobytes> [ --static | --dynamic ]"},
     {"help", gettext_noop("change memory allocation")},
     {"desc", gettext_noop("Change the current memory allocation in the guest domain.")},
     {NULL, NULL}
@@ -1452,6 +1464,8 @@ static vshCmdInfo info_setmem[] = {
 static vshCmdOptDef opts_setmem[] = {
     {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("domain name, id or uuid")},
     {"kilobytes", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("number of kilobytes of memory")},
+    {"static", VSH_OT_BOOL, 0, gettext_noop("static change")},
+    {"dynamic", VSH_OT_BOOL, 0, gettext_noop("dynamic change")},
     {NULL, 0, 0, NULL}
 };
 
@@ -1461,6 +1475,9 @@ cmdSetmem(vshControl * ctl, vshCmd * cmd
     virDomainPtr dom;
     int kilobytes;
     int ret = TRUE;
+    int op_static = vshCommandOptBool(cmd, "static");
+    int op_dynamic = vshCommandOptBool(cmd, "dynamic");
+    int flag = VIR_DOMAIN_SCOPE_CURRENT;
 
     if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
         return FALSE;
@@ -1475,7 +1492,14 @@ cmdSetmem(vshControl * ctl, vshCmd * cmd
         return FALSE;
     }
 
-    if (virDomainSetMemory(dom, kilobytes) != 0) {
+    if (op_static && op_dynamic) {
+        flag = VIR_DOMAIN_SCOPE_BOTH;
+    } else if (op_static) {
+        flag = VIR_DOMAIN_SCOPE_STATIC;
+    } else if (op_dynamic) {
+        flag = VIR_DOMAIN_SCOPE_DYNAMIC;
+    }
+    if (virDomainSetMemoryScope(dom, kilobytes, flag) !=0) {
         ret = FALSE;
     }
 
@@ -1487,7 +1511,7 @@ cmdSetmem(vshControl * ctl, vshCmd * cmd
  * "setmaxmem" command
  */
 static vshCmdInfo info_setmaxmem[] = {
-    {"syntax", "setmaxmem <domain> <kilobytes>"},
+    {"syntax", "setmaxmem <domain> <kilobytes> [ --static | --dynamic ]"},
     {"help", gettext_noop("change maximum memory limit")},
     {"desc", gettext_noop("Change the maximum memory allocation limit in the guest domain.")},
     {NULL, NULL}
@@ -1496,6 +1520,8 @@ static vshCmdInfo info_setmaxmem[] = {
 static vshCmdOptDef opts_setmaxmem[] = {
     {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("domain name, id or uuid")},
     {"kilobytes", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("maximum memory limit in kilobytes")},
+    {"static", VSH_OT_BOOL, 0, gettext_noop("static change")},
+    {"dynamic", VSH_OT_BOOL, 0, gettext_noop("dynamic change")},
     {NULL, 0, 0, NULL}
 };
 
@@ -1505,6 +1531,9 @@ cmdSetmaxmem(vshControl * ctl, vshCmd * 
     virDomainPtr dom;
     int kilobytes;
     int ret = TRUE;
+    int op_static = vshCommandOptBool(cmd, "static");
+    int op_dynamic = vshCommandOptBool(cmd, "dynamic");
+    int flag = VIR_DOMAIN_SCOPE_CURRENT;
 
     if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
         return FALSE;
@@ -1519,7 +1548,14 @@ cmdSetmaxmem(vshControl * ctl, vshCmd * 
         return FALSE;
     }
 
-    if (virDomainSetMaxMemory(dom, kilobytes) != 0) {
+    if (op_static && op_dynamic) {
+        flag = VIR_DOMAIN_SCOPE_BOTH;
+    } else if (op_static) {
+        flag = VIR_DOMAIN_SCOPE_STATIC;
+    } else if (op_dynamic) {
+        flag = VIR_DOMAIN_SCOPE_DYNAMIC;
+    }
+    if (virDomainSetMaxMemoryScope(dom, kilobytes, flag) !=0) {
         ret = FALSE;
     }
 
