Index: xen_unified.c
===================================================================
RCS file: /data/cvs/libvirt/src/xen_unified.c,v
retrieving revision 1.5
diff -u -p -r1.5 xen_unified.c
--- xen_unified.c	17 Apr 2007 09:33:52 -0000	1.5
+++ xen_unified.c	27 Apr 2007 10:21:56 -0000
@@ -442,6 +442,12 @@ xenUnifiedDomainSetMaxMemory (virDomainP
 }
 
 static int
+xenUnifiedDomainSetMaxMemoryScope (virDomainPtr dom, unsigned long memory, int scope)
+{
+    /* TODO */
+}
+
+static int
 xenUnifiedDomainSetMemory (virDomainPtr dom, unsigned long memory)
 {
     int i;
@@ -455,6 +461,19 @@ xenUnifiedDomainSetMemory (virDomainPtr 
 }
 
 static int
+xenUnifiedDomainSetMemoryScope (virDomainPtr dom, unsigned long memory, int scope)
+{
+    int i;
+
+    for (i = 0; i < nb_drivers; ++i)
+        if (drivers[i]->domainSetMemoryScope &&
+            drivers[i]->domainSetMemoryScope (dom, memory, scope) == 0)
+            return 0;
+
+    return -1;
+}
+
+static int
 xenUnifiedDomainGetInfo (virDomainPtr dom, virDomainInfoPtr info)
 {
     int i;
@@ -528,6 +547,12 @@ xenUnifiedDomainSetVcpus (virDomainPtr d
 }
 
 static int
+xenUnifiedDomainSetVcpusScope (virDomainPtr dom, unsigned int nvcpus, int scope)
+{
+    /* TODO */
+}
+
+static int
 xenUnifiedDomainPinVcpu (virDomainPtr dom, unsigned int vcpu,
                          unsigned char *cpumap, int maplen)
 {
@@ -742,12 +767,15 @@ static virDriver xenUnifiedDriver = {
     .domainGetOSType 		= xenUnifiedDomainGetOSType,
     .domainGetMaxMemory 		= xenUnifiedDomainGetMaxMemory,
     .domainSetMaxMemory 		= xenUnifiedDomainSetMaxMemory,
+    .domainSetMaxMemoryScope 		= xenUnifiedDomainSetMaxMemoryScope,
     .domainSetMemory 		= xenUnifiedDomainSetMemory,
+    .domainSetMemoryScope	= xenUnifiedDomainSetMemoryScope,
     .domainGetInfo 		= xenUnifiedDomainGetInfo,
     .domainSave 			= xenUnifiedDomainSave,
     .domainRestore 		= xenUnifiedDomainRestore,
     .domainCoreDump 		= xenUnifiedDomainCoreDump,
     .domainSetVcpus 		= xenUnifiedDomainSetVcpus,
+    .domainSetVcpusScope 	= xenUnifiedDomainSetVcpusScope,
     .domainPinVcpu 		= xenUnifiedDomainPinVcpu,
     .domainGetVcpus 		= xenUnifiedDomainGetVcpus,
     .domainGetMaxVcpus 		= xenUnifiedDomainGetMaxVcpus,
Index: xen_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xen_internal.c,v
retrieving revision 1.71
diff -u -p -r1.71 xen_internal.c
--- xen_internal.c	13 Apr 2007 00:43:57 -0000	1.71
+++ xen_internal.c	27 Apr 2007 10:22:00 -0000
@@ -561,12 +561,15 @@ virDriver xenHypervisorDriver = {
     NULL, /* domainGetOSType */
     xenHypervisorGetMaxMemory, /* domainGetMaxMemory */
     xenHypervisorSetMaxMemory, /* domainSetMaxMemory */
+    NULL, /* domainSetMaxMemoryScope */
     NULL, /* domainSetMemory */
+    NULL, /* domainSetMemoryScope */
     xenHypervisorGetDomainInfo, /* domainGetInfo */
     NULL, /* domainSave */
     NULL, /* domainRestore */
     NULL, /* domainCoreDump */
     xenHypervisorSetVcpus, /* domainSetVcpus */
+    NULL, /* domainSetVcpusScope */
     xenHypervisorPinVcpu, /* domainPinVcpu */
     xenHypervisorGetVcpus, /* domainGetVcpus */
     xenHypervisorGetVcpuMax, /* domainGetMaxVcpus */
Index: proxy_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/proxy_internal.c,v
retrieving revision 1.25
diff -u -p -r1.25 proxy_internal.c
--- proxy_internal.c	4 Apr 2007 14:19:49 -0000	1.25
+++ proxy_internal.c	27 Apr 2007 10:22:02 -0000
@@ -68,12 +68,15 @@ virDriver xenProxyDriver = {
     xenProxyDomainGetOSType, /* domainGetOSType */
     xenProxyDomainGetMaxMemory, /* domainGetMaxMemory */
     NULL, /* domainSetMaxMemory */
+    NULL, /* domainSetMaxMemoryScope */
     NULL, /* domainSetMemory */
+    NULL, /* domainSetMemoryScope */
     xenProxyDomainGetInfo, /* domainGetInfo */
     NULL, /* domainSave */
     NULL, /* domainRestore */
     NULL, /* domainCoreDump */
     NULL, /* domainSetVcpus */
+    NULL, /* domainSetVcpusScope */
     NULL, /* domainPinVcpu */
     NULL, /* domainGetVcpus */
     NULL, /* domainGetMaxVcpus */
Index: xend_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.c,v
retrieving revision 1.110
diff -u -p -r1.110 xend_internal.c
--- xend_internal.c	23 Apr 2007 07:41:23 -0000	1.110
+++ xend_internal.c	27 Apr 2007 10:22:06 -0000
@@ -89,12 +89,15 @@ virDriver xenDaemonDriver = {
     xenDaemonDomainGetOSType, /* domainGetOSType */
     xenDaemonDomainGetMaxMemory, /* domainGetMaxMemory */
     xenDaemonDomainSetMaxMemory, /* domainSetMaxMemory */
+    xenDaemonDomainSetMaxMemoryScope, /* domainSetMaxMemoryScope */
     xenDaemonDomainSetMemory, /* domainMaxMemory */
+    xenDaemonDomainSetMemoryScope, /* domainMaxMemoryScope */
     xenDaemonDomainGetInfo, /* domainGetInfo */
     xenDaemonDomainSave, /* domainSave */
     xenDaemonDomainRestore, /* domainRestore */
     xenDaemonDomainCoreDump, /* domainCoreDump */
     xenDaemonDomainSetVcpus, /* domainSetVcpus */
+    xenDaemonDomainSetVcpusScope, /* domainSetVcpusScope */
     xenDaemonDomainPinVcpu, /* domainPinVcpu */
     xenDaemonDomainGetVcpus, /* domainGetVcpus */
     NULL, /* domainGetMaxVcpus */
@@ -2316,6 +2319,12 @@ xenDaemonDomainSetMaxMemory(virDomainPtr
                    buf, NULL);
 }
 
+int
+xenDaemonDomainSetMaxMemoryScope(virDomainPtr domain, unsigned long memory, int scope)
+{
+    /* TODO */
+}
+
 /**
  * xenDaemonDomainSetMemory:
  * @domain: pointer to the Domain block
@@ -2354,6 +2363,18 @@ xenDaemonDomainSetMemory(virDomainPtr do
                    "target", buf, NULL);
 }
 
+int
+xenDaemonDomainSetMemoryScope(virDomainPtr domain, unsigned long memory, int scope)
+{
+    /* TODO 
+     * 1. get sexpr
+     *    using sexpr_get(conn, "/xend/domain/%s?detail=1", name);
+     * 2. change dynamically and statically
+     * 3. define sexpr
+     *    using xend_op(conn, "", "op", "new", "config", sexpr, NULL);
+     */
+}
+
 #endif /* ! PROXY */
 
 /* XXX change proxy to use Name instead of ID, then
@@ -2751,6 +2772,12 @@ xenDaemonDomainSetVcpus(virDomainPtr dom
                    buf, NULL));
 }
 
+int
+xenDaemonDomainSetVcpusScope(virDomainPtr domain, unsigned int vcpus, int scope)
+{
+    /* TODO */
+}
+
 /**
  * xenDaemonDomainPinCpu:
  * @domain: pointer to domain object
Index: xs_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xs_internal.c,v
retrieving revision 1.39
diff -u -p -r1.39 xs_internal.c
--- xs_internal.c	13 Apr 2007 00:43:57 -0000	1.39
+++ xs_internal.c	27 Apr 2007 10:22:07 -0000
@@ -63,12 +63,15 @@ virDriver xenStoreDriver = {
     xenStoreDomainGetOSType, /* domainGetOSType */
     xenStoreDomainGetMaxMemory, /* domainGetMaxMemory */
     NULL, /* domainSetMaxMemory */
+    NULL, /* domainSetMaxMemoryScope */
     xenStoreDomainSetMemory, /* domainSetMemory */
+    NULL, /* domainSetMemoryScope */
     xenStoreGetDomainInfo, /* domainGetInfo */
     NULL, /* domainSave */
     NULL, /* domainRestore */
     NULL, /* domainCoreDump */
     NULL, /* domainSetVcpus */
+    NULL, /* domainSetVcpusScope */
     NULL, /* domainPinVcpu */
     NULL, /* domainGetVcpus */
     NULL, /* domainGetMaxVcpus */
Index: xm_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xm_internal.c,v
retrieving revision 1.23
diff -u -p -r1.23 xm_internal.c
--- xm_internal.c	4 Apr 2007 14:19:49 -0000	1.23
+++ xm_internal.c	27 Apr 2007 10:22:11 -0000
@@ -94,12 +94,15 @@ virDriver xenXMDriver = {
     NULL, /* domainGetOSType */
     xenXMDomainGetMaxMemory, /* domainGetMaxMemory */
     xenXMDomainSetMaxMemory, /* domainSetMaxMemory */
+    NULL, /* domainSetMaxMemoryScope */
     xenXMDomainSetMemory, /* domainMaxMemory */
+    NULL, /* domainSetMemoryScope */
     xenXMDomainGetInfo, /* domainGetInfo */
     NULL, /* domainSave */
     NULL, /* domainRestore */
     NULL, /* domainCoreDump */
     xenXMDomainSetVcpus, /* domainSetVcpus */
+    NULL, /* domainSetVcpusScope */
     NULL, /* domainPinVcpu */
     NULL, /* domainGetVcpus */
     NULL, /* domainGetMaxVcpus */
Index: qemu_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_internal.c,v
retrieving revision 1.21
diff -u -p -r1.21 qemu_internal.c
--- qemu_internal.c	16 Apr 2007 13:10:05 -0000	1.21
+++ qemu_internal.c	27 Apr 2007 10:22:14 -0000
@@ -1318,12 +1318,15 @@ static virDriver qemuDriver = {
     qemuDomainGetOSType, /* domainGetOSType */
     NULL, /* domainGetMaxMemory */
     NULL, /* domainSetMaxMemory */
+    NULL, /* domainSetMaxMemoryScope */
     NULL, /* domainSetMemory */
+    NULL, /* domainSetMemoryScope */
     qemuGetDomainInfo, /* domainGetInfo */
     qemuSaveDomain, /* domainSave */
     qemuRestoreDomain, /* domainRestore */
     NULL, /* domainCoreDump */
     NULL, /* domainSetVcpus */
+    NULL, /* domainSetVcpusScope */
     NULL, /* domainPinVcpu */
     NULL, /* domainGetVcpus */
     NULL, /* domainGetMaxVcpus */
Index: test.c
===================================================================
RCS file: /data/cvs/libvirt/src/test.c,v
retrieving revision 1.28
diff -u -p -r1.28 test.c
--- test.c	18 Apr 2007 10:14:08 -0000	1.28
+++ test.c	27 Apr 2007 10:22:16 -0000
@@ -113,12 +113,15 @@ static virDriver testDriver = {
     testGetOSType, /* domainGetOSType */
     testGetMaxMemory, /* domainGetMaxMemory */
     testSetMaxMemory, /* domainSetMaxMemory */
+    NULL, /* domainSetMaxMemoryScope */
     testSetMemory, /* domainSetMemory */
+    NULL, /* domainSetMemoryScope */
     testGetDomainInfo, /* domainGetInfo */
     NULL, /* domainSave */
     NULL, /* domainRestore */
     NULL, /* domainCoreDump */
     testSetVcpus, /* domainSetVcpus */
+    NULL, /* domainSetVcpusScope */
     NULL, /* domainPinVcpu */
     NULL, /* domainGetVcpus */
     NULL, /* domainGetMaxVcpus */
Index: driver.h
===================================================================
RCS file: /data/cvs/libvirt/src/driver.h,v
retrieving revision 1.25
diff -u -p -r1.25 driver.h
--- driver.h	4 Apr 2007 14:19:49 -0000	1.25
+++ driver.h	27 Apr 2007 10:22:17 -0000
@@ -98,9 +98,15 @@ typedef int
 	(*virDrvDomainSetMaxMemory)	(virDomainPtr domain,
 					 unsigned long memory);
 typedef int
+        (*virDrvDomainSetMaxMemoryScope) (virDomainPtr domain,
+                                         unsigned long memory, int scope);
+typedef int
 	(*virDrvDomainSetMemory)	(virDomainPtr domain,
 					 unsigned long memory);
 typedef int
+        (*virDrvDomainSetMemoryScope)   (virDomainPtr domain,
+                                         unsigned long memory, int scope);
+typedef int
 	(*virDrvDomainGetInfo)		(virDomainPtr domain,
 					 virDomainInfoPtr info);
 typedef int
@@ -132,6 +138,9 @@ typedef int
 	(*virDrvDomainSetVcpus)		(virDomainPtr domain,
 					 unsigned int nvcpus);
 typedef int
+        (*virDrvDomainSetVcpusScope)    (virDomainPtr domain,
+                                         unsigned int nvcpus, int scope);
+typedef int
 	(*virDrvDomainPinVcpu)		(virDomainPtr domain,
 					 unsigned int vcpu,
 					 unsigned char *cpumap,
@@ -197,12 +206,15 @@ struct _virDriver {
 	virDrvDomainGetOSType		domainGetOSType;
 	virDrvDomainGetMaxMemory	domainGetMaxMemory;
 	virDrvDomainSetMaxMemory	domainSetMaxMemory;
+	virDrvDomainSetMaxMemoryScope	domainSetMaxMemoryScope;
 	virDrvDomainSetMemory		domainSetMemory;
+	virDrvDomainSetMemoryScope	domainSetMemoryScope;
 	virDrvDomainGetInfo		domainGetInfo;
 	virDrvDomainSave		domainSave;
 	virDrvDomainRestore		domainRestore;
 	virDrvDomainCoreDump		domainCoreDump;
 	virDrvDomainSetVcpus		domainSetVcpus;
+	virDrvDomainSetVcpusScope	domainSetVcpusScope;
 	virDrvDomainPinVcpu		domainPinVcpu;
 	virDrvDomainGetVcpus		domainGetVcpus;
 	virDrvDomainGetMaxVcpus		domainGetMaxVcpus;
