Hi

"virsh setmem" and "virsh setmexmem" have the problem of setting a very
big value in the domain when -1 is set in the domain. 

As a result, I detected the problem of doing abnormal operation of Xen
in 64bit machine. (virsh setmem)

Therefore, I contribute the patch that corrects the argument of the
function to guard a negative value. 

This treatment is based on [EMAIL PROTECTED]


Signed-off-by: Masayuki Sunou <[EMAIL PROTECTED]>

Thanks,
Masayuki Sunou.


-------------------------------------------------------------------------------
Index: include/libvirt/libvirt.h
===================================================================
RCS file: /data/cvs/libvirt/include/libvirt/libvirt.h,v
retrieving revision 1.41
diff -u -p -r1.41 libvirt.h
--- include/libvirt/libvirt.h   15 Mar 2007 17:24:57 -0000      1.41
+++ include/libvirt/libvirt.h   16 Mar 2007 01:37:25 -0000
@@ -314,9 +314,9 @@ int                 virDomainGetUUIDString  (virDomainP
 char *                 virDomainGetOSType      (virDomainPtr domain);
 unsigned long          virDomainGetMaxMemory   (virDomainPtr domain);
 int                    virDomainSetMaxMemory   (virDomainPtr domain,
-                                                unsigned long memory);
+                                                int memory);
 int                    virDomainSetMemory      (virDomainPtr domain,
-                                                unsigned long memory);
+                                                int memory);
 int                    virDomainGetMaxVcpus    (virDomainPtr domain);
 
 /*
Index: include/libvirt/libvirt.h.in
===================================================================
RCS file: /data/cvs/libvirt/include/libvirt/libvirt.h.in,v
retrieving revision 1.26
diff -u -p -r1.26 libvirt.h.in
--- include/libvirt/libvirt.h.in        15 Mar 2007 17:24:57 -0000      1.26
+++ include/libvirt/libvirt.h.in        16 Mar 2007 01:37:26 -0000
@@ -314,9 +314,9 @@ int                 virDomainGetUUIDString  (virDomainP
 char *                 virDomainGetOSType      (virDomainPtr domain);
 unsigned long          virDomainGetMaxMemory   (virDomainPtr domain);
 int                    virDomainSetMaxMemory   (virDomainPtr domain,
-                                                unsigned long memory);
+                                                int memory);
 int                    virDomainSetMemory      (virDomainPtr domain,
-                                                unsigned long memory);
+                                                int memory);
 int                    virDomainGetMaxVcpus    (virDomainPtr domain);
 
 /*
Index: src/libvirt.c
===================================================================
RCS file: /data/cvs/libvirt/src/libvirt.c,v
retrieving revision 1.63
diff -u -p -r1.63 libvirt.c
--- src/libvirt.c       15 Mar 2007 17:24:57 -0000      1.63
+++ src/libvirt.c       16 Mar 2007 01:37:31 -0000
@@ -1499,7 +1499,7 @@ virDomainGetMaxMemory(virDomainPtr domai
  * Returns 0 in case of success and -1 in case of failure.
  */
 int
-virDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
+virDomainSetMaxMemory(virDomainPtr domain, int memory)
 {
     int ret = -1 , i;
     virConnectPtr conn;
@@ -1553,7 +1553,7 @@ virDomainSetMaxMemory(virDomainPtr domai
  * Returns 0 in case of success and -1 in case of failure.
  */
 int
-virDomainSetMemory(virDomainPtr domain, unsigned long memory)
+virDomainSetMemory(virDomainPtr domain, int memory)
 {
     int ret = -1 , i;
     virConnectPtr conn;
-------------------------------------------------------------------------------

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

Reply via email to