[et-mgmt-tools] [PATCH] Fix memory check in interactive mode

Masayuki Sunou fj1826dm at aa.jp.fujitsu.com
Fri Jun 1 01:08:40 UTC 2007


Hi

When memory is interactively input to virt-install, memory is not checked.

------------------------------------------------------------
# virt-install --name TEST --hvm
How much RAM should be allocated (in megabytes)? 1
 What would you like to use as the disk (path)?
------------------------------------------------------------

This patch fixes it.


Signed-off-by: Masayuki Sunou <fj1826dm at aa.jp.fujitsu.com>

Thanks,
Masayuki Sunou.

-------------------------------------------------------------------------------
diff -r 7fd35e3303c6 virt-install
--- a/virt-install	Fri May 25 10:49:47 2007 -0400
+++ b/virt-install	Thu May 31 10:49:20 2007 +0900
@@ -87,14 +87,14 @@ def get_name(name, guest):
 
 def get_memory(memory, guest):
     while 1:
-        memory = prompt_for_input("How much RAM should be allocated (in megabytes)?", memory)
-        if memory < MIN_RAM:
-            print "ERROR: Installs currently require %d megs of RAM." %(MIN_RAM,)
-            print ""
-            memory = None
-            continue
-        try:
-            guest.memory = int(memory)
+        try:
+            memory = int(prompt_for_input("How much RAM should be allocated (in megabytes)?", memory))
+            if memory < MIN_RAM:
+                print "ERROR: Installs currently require %d megs of RAM." %(MIN_RAM,)
+                print ""
+                memory = None
+                continue
+            guest.memory = memory
             break
         except ValueError, e:
             print "ERROR: ", e
-------------------------------------------------------------------------------




More information about the et-mgmt-tools mailing list