Blob Blame History Raw
From 53b4932a705653c45228db287fc933a1288b5108 Mon Sep 17 00:00:00 2001
From: Jan Dobes <jdobes@redhat.com>
Date: Tue, 17 Oct 2017 11:58:51 +0200
Subject: [PATCH] support kvm type

copy from Cobbler 2.8
---
 koan/app.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/koan/app.py b/koan/app.py
index bacc135..b7dabb1 100755
--- a/koan/app.py
+++ b/koan/app.py
@@ -327,10 +327,10 @@
         # if --virt-type was specified and invalid, then fail
         if self.virt_type is not None:
             self.virt_type = self.virt_type.lower()
-            if self.virt_type not in [ "qemu", "xenpv", "xenfv", "xen", "vmware", "vmwarew", "auto" ]:
+            if self.virt_type not in [ "qemu", "xenpv", "xenfv", "xen", "vmware", "vmwarew", "auto", "kvm" ]:
                if self.virt_type == "xen":
                    self.virt_type = "xenpv"
-               raise(InfoException("--virt-type should be qemu, xenpv, xenfv, vmware, vmwarew, or auto"))
+               raise(InfoException("--virt-type should be qemu, xenpv, xenfv, vmware, vmwarew, kvm or auto"))
 
         # if --qemu-disk-type was called without --virt-type=qemu, then fail
         if (self.qemu_disk_type is not None):
@@ -545,7 +545,7 @@
                    raise(InfoException("xend needs to be started"))
 
             # for qemu
-            if self.virt_type == "qemu":
+            if self.virt_type in [ "qemu", "kvm" ]:
                 # qemu package installed?
                 if not os.path.exists("/usr/bin/qemu-img"):
                     raise(InfoException("qemu package needs to be installed"))
@@ -1201,7 +1201,7 @@
         if virt_auto_boot:
             if self.virt_type in [ "xenpv", "xenfv" ]:
                 utils.create_xendomains_symlink(virtname)
-            elif self.virt_type == "qemu":
+            elif self.virt_type in [ "qemu", "kvm" ]:
                utils.libvirt_enable_autostart(virtname)
             else:
                 print("- warning: don't know how to autoboot this virt type yet")
@@ -1225,7 +1225,7 @@
             if self.virt_type == "xenfv":
                fullvirt = True 
             can_poll = "xen"
-        elif self.virt_type == "qemu":
+        elif self.virt_type in [ "qemu", "kvm" ]:
             fullvirt = True
             uuid    = None
             from koan import qcreate
@@ -1410,7 +1410,7 @@
            # not set in cobbler either? then assume reasonable defaults
            if self.virt_type in [ "xenpv", "xenfv" ]:
                prefix = "/var/lib/xen/images/"
-           elif self.virt_type == "qemu":
+           elif self.virt_type in [ "qemu", "kvm" ]:
                prefix = "/var/lib/libvirt/images/"
            elif self.virt_type == "vmwarew":
                prefix = "/var/lib/vmware/%s/" % name
-- 
1.8.3.1