cobbler/koan-virt-install-options.p...

104 lines
5.0 KiB
Diff

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