Blame SOURCES/koan-virt-install-options.patch

1330ca
diff -rupN cobbler-2.0.7.old/koan/app.py cobbler-2.0.7.new/koan/app.py
1330ca
--- cobbler-2.0.7.old/koan/app.py	2014-11-06 15:02:37.476914876 -0500
1330ca
+++ cobbler-2.0.7.new/koan/app.py	2014-11-06 15:14:29.830881393 -0500
1330ca
@@ -182,6 +182,22 @@ def main():
1330ca
                  dest="embed_kickstart",
1330ca
                  action="store_true",
1330ca
                  help="When used with  --replace-self, embed the kickstart in the initrd to overcome potential DHCP timeout issues. (seldom needed)")
1330ca
+    p.add_option("", "--qemu-disk-type",
1330ca
+                 dest="qemu_disk_type",
1330ca
+                 help="when used with --virt_type=qemu, add select of disk driver types: ide,scsi,virtio")
1330ca
+    p.add_option("", "--qemu-net-type",
1330ca
+                 dest="qemu_net_type",
1330ca
+                 help="when used with --virt_type=qemu, select type of network device to use: e1000, ne2k_pci, pcnet, rtl8139, virtio")
1330ca
+    p.add_option("", "--wait",
1330ca
+                 dest="wait", type='int', default=0,    # default to 0 for koan backwards compatibility
1330ca
+                 help="pass the --wait=<INT> argument to virt-install")
1330ca
+    p.add_option("", "--cpu",
1330ca
+                 dest="cpu",
1330ca
+                 help="pass the --cpu argument to virt-install")
1330ca
+    p.add_option("", "--noreboot",
1330ca
+                 dest="noreboot", default=False,        # default to False for koan backwards compatibility
1330ca
+                 action="store_true",
1330ca
+                 help="pass the --noreboot argument to virt-install")
1330ca
 
1330ca
     (options, args) = p.parse_args()
1330ca
 
1330ca
@@ -209,6 +225,11 @@ def main():
1330ca
         k.should_poll         = options.should_poll
1330ca
         k.embed_kickstart     = options.embed_kickstart
1330ca
         k.virt_auto_boot      = options.virt_auto_boot
1330ca
+        k.qemu_disk_type      = options.qemu_disk_type
1330ca
+        k.qemu_net_type       = options.qemu_net_type
1330ca
+        k.virtinstall_cpu     = options.cpu
1330ca
+        k.virtinstall_wait    = options.wait
1330ca
+        k.virtinstall_noreboot= options.noreboot
1330ca
 
1330ca
         if options.virt_name is not None:
1330ca
             k.virt_name          = options.virt_name
1330ca
@@ -264,6 +285,11 @@ class Koan:
1330ca
         self.virt_path         = None
1330ca
         self.qemu_disk_type    = None
1330ca
         self.virt_auto_boot    = None
1330ca
+        self.qemu_disk_type    = None
1330ca
+        self.qemu_net_type     = None
1330ca
+        self.virtinstall_cpu   = None
1330ca
+        self.virtinstall_wait  = None
1330ca
+        self.virtinstall_noreboot = None
1330ca
 
1330ca
         # This option adds the --copy-default argument to /sbin/grubby
1330ca
         # which uses the default boot entry in the grub.conf
1330ca
@@ -330,6 +356,18 @@ class Koan:
1330ca
                    self.virt_type = "xenpv"
1330ca
                raise InfoException, "--virt-type should be qemu, xenpv, xenfv, vmware, vmwarew, or auto"
1330ca
 
1330ca
+        # if --qemu-disk-type was called without --virt-type=qemu, then fail
1330ca
+        if (self.qemu_disk_type is not None):
1330ca
+            self.qemu_disk_type = self.qemu_disk_type.lower()
1330ca
+            if self.virt_type not in [ "qemu", "auto", "kvm" ]:
1330ca
+               raise InfoException, "--qemu-disk-type must use with --virt-type=qemu"
1330ca
+
1330ca
+        # if --qemu-net-type was called without --virt-type=qemu, then fail
1330ca
+        if (self.qemu_net_type is not None):
1330ca
+            self.qemu_net_type = self.qemu_net_type.lower()
1330ca
+            if self.virt_type not in [ "qemu", "auto", "kvm" ]:
1330ca
+               raise InfoException, "--qemu-net-type must use with --virt-type=qemu"
1330ca
+
1330ca
         # if --static-interface and --profile was called together, then fail
1330ca
         if self.static_interface is not None and self.profile is not None:
1330ca
             raise InfoException, "--static-interface option is incompatible with --profile option use --system instead"
1330ca
@@ -1145,7 +1183,12 @@ class Koan:
1330ca
                 fullvirt       =  fullvirt,    
1330ca
                 bridge         =  self.virt_bridge,
1330ca
                 virt_type      =  self.virt_type,
1330ca
-                virt_auto_boot =  virt_auto_boot
1330ca
+                virt_auto_boot =  virt_auto_boot,
1330ca
+                qemu_driver_type  =  self.qemu_disk_type,
1330ca
+                qemu_net_type     =  self.qemu_net_type,
1330ca
+                cpu               =  self.virtinstall_cpu,
1330ca
+                wait              =  self.virtinstall_wait,
1330ca
+                noreboot          =  self.virtinstall_noreboot,
1330ca
         )
1330ca
 
1330ca
         print results
1330ca
diff -rupN cobbler-2.0.7.old/koan/virtinstall.py cobbler-2.0.7.new/koan/virtinstall.py
1330ca
--- cobbler-2.0.7.old/koan/virtinstall.py	2014-11-06 15:02:37.476914876 -0500
1330ca
+++ cobbler-2.0.7.new/koan/virtinstall.py	2014-11-06 15:11:11.564499529 -0500
1330ca
@@ -162,6 +162,7 @@ def build_commandline(uri,
1330ca
                       qemu_driver_type=None,
1330ca
                       qemu_net_type=None,
1330ca
                       qemu_machine_type=None,
1330ca
+                      cpu=None,
1330ca
                       wait=0,
1330ca
                       noreboot=False,
1330ca
                       osimport=False):
1330ca
@@ -404,6 +405,8 @@ def build_commandline(uri,
1330ca
         cmd += " "
1330ca
 
1330ca
     cmd += "--wait %d " % int(wait)
1330ca
+    if cpu:
1330ca
+        cmd += "--cpu %s " % cpu
1330ca
     if noreboot:
1330ca
         cmd += "--noreboot "
1330ca
     if osimport and not(import_exists):