[et-mgmt-tools] [PATCH] Check exclusive options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

When I install by virt-intall with some exclusive options
(e.g."--hvm --paravirt"), don't become an error.

So, here's the patch adds to check exclusive options:

  // the subject of check //
    * --hvm, --paravirt
    * --vnc, --sdl
    * --sdl, --nographics
    * --network, --bridge


Signed-off-by: Shigeki Sakamoto <fj0588di@xxxxxxxxxxxxxxxxx>


Thanks,
Shigeki Sakamoto.



==========================================================
diff -r 04ddef989ad7 virt-install
--- a/virt-install      Wed Apr 04 09:30:55 2007 -0400
+++ b/virt-install      Fri Apr 06 20:25:33 2007 +0900
@@ -208,6 +208,7 @@ def get_networks(macs, bridges, networks

     if bridges is not None and networks != None:
         print >> sys.stderr, "Cannot mix both --bridge and --network arguments"
+        sys.exit(1)

     # ensure we have equal length lists
     if bridges != None:
@@ -237,6 +238,10 @@ def get_graphics(vnc, vncport, nographic
 def get_graphics(vnc, vncport, nographics, sdl, keymap, guest):
     if vnc and nographics:
         raise ValueError, "Can't do both VNC graphics and nographics"
+    elif vnc and sdl:
+        raise ValueError, "Can't do both VNC graphics and SDL"
+    elif sdl and nographics:
+        raise ValueError, "Can't do both SDL and nographics"
     if nographics:
         guest.graphics = False
         return
@@ -376,7 +381,7 @@ def parse_args():
                       help="The CPU architecture to simulate")

     # paravirt options
-    parser.add_option("-p", "--paravirt", action="store_false", dest="fullvirt",
+    parser.add_option("-p", "--paravirt", action="store_false", dest="paravirt",
                       help="This guest should be a paravirtualized guest")
     parser.add_option("-l", "--location", type="string", dest="location",
                       action="callback", callback=check_before_store,
@@ -493,10 +498,21 @@ def main():
             sys.exit(1)

     # first things first, are we trying to create a fully virt guest?
-    hvm = False
     if conn.getType() == "Xen":
+        hvm = options.fullvirt
+        pv  = options.paravirt
         if virtinst.util.is_hvm_capable():
-            hvm = options.fullvirt
+            if hvm is not None and pv is not None:
+                print >> sys.stderr, "Can't do both --hvm and --paravirt"
+                sys.exit(1)
+            elif pv is not None:
+                hvm = False
+        else:
+            if hvm is not None:
+                print >> sys.stderr, "Can't do --hvm to this system: HVM guest is not supported by your CPU or enabled in your BIOS"
+                sys.exit(1)
+            else:
+                hvm = False
         if hvm is None:
             hvm = get_full_virt()
     else:


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux