Koan uses the virtinst library for creating libvirt VMs. This is the same code that virt-install and virt-manager use for a lot of their libvirt interaction.
Problem is this virtinst never should have been a public API, it was designed without much thought, and attempting to maintain back compat all these years hasn't really done much good.
On the flip side, virt-install very much is intended to be a stable API: there are far more people out there using virt-install for scripting and we plan on keeping those scripts working as long as possible. virtinst should really be an implementation detail of virt-install.
So along that line of thinking, I want to deprecate virtinst as a public API, and keep it private to virt-* tools. So here is a patch series swapping koan from virtinst to generating a virt-install command line. Ideally this patch makes it into fedora before march so I can deprecate virtinst in upcoming fedora 17.
In the process, I add unit testing and unify most of the libvirt koan code, so hopefully things are in a better state than before.
One fairly sizable caveat though is that I haven't _actually_ tested koan: unit tests prove it is doing something useful reality can always be different. Though judging by the state of the koan code I don't think it's getting a lot of usage, at least the imagecreate module has been outright broken for near 6 months.
Cole Robinson (5): setup.py: Add stub 'test' command koan: vmware: Drop unused imports koan: Port xen creation to virt-install koan: Port qcreate to virt-install koan: port imagecreate to virt-install
.gitignore | 1 + koan/imagecreate.py | 171 +-------------------------- koan/qcreate.py | 210 +-------------------------------- koan/virtinstall.py | 289 +++++++++++++++++++++++++++++++++++++++++++++ koan/vmwcreate.py | 7 +- koan/xencreate.py | 173 +-------------------------- setup.py | 51 ++++++++- tests/koan/__init__.py | 1 + tests/koan/virtinstall.py | 128 ++++++++++++++++++++ 9 files changed, 484 insertions(+), 547 deletions(-) create mode 100755 koan/virtinstall.py create mode 100644 tests/koan/__init__.py create mode 100644 tests/koan/virtinstall.py
Invoked with 'python setup.py test'. We will put it to use in the following patches.
Signed-off-by: Cole Robinson crobinso@redhat.com --- .gitignore | 1 + setup.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 tests/koan/__init__.py
diff --git a/.gitignore b/.gitignore index 38e707e..5ac62a3 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ MANIFEST TAGS .project .pydevproject +.coverage
# docs - ignore pod output docs/*.gz diff --git a/setup.py b/setup.py index 8184e24..cbbaa3a 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,18 @@ #!/usr/bin/env python -import glob, os, time, yaml -from distutils.core import setup +import glob, os, sys, time, yaml +from distutils.core import setup, Command from distutils.command.build_py import build_py as _build_py +import unittest
try: import subprocess except: import cobbler.sub_process as subprocess
+try: + import coverage +except: + converage = None
VERSION = "2.3.1" OUTPUT_DIR = "config" @@ -107,6 +112,46 @@ class build_py(_build_py): gen_build_version() _build_py.run(self)
+##################################################################### +## Test Command ##################################################### +##################################################################### + +class test_command(Command): + user_options = [] + + def initialize_options(self): + pass + def finalize_options(self): + pass + + def run(self): + testfiles = [] + testdirs = ["koan"] + + for d in testdirs: + testdir = os.path.join(os.getcwd(), "tests", d) + + for t in glob.glob(os.path.join(testdir, '*.py')): + if t.endswith('__init__.py'): + continue + testfile = '.'.join(['tests', d, + os.path.splitext(os.path.basename(t))[0]]) + testfiles.append(testfile) + + tests = unittest.TestLoader().loadTestsFromNames(testfiles) + runner = unittest.TextTestRunner(verbosity = 1) + + if coverage: + coverage.erase() + coverage.start() + + result = runner.run(tests) + + if coverage: + coverage.stop() + sys.exit(int(bool(len(result.failures) > 0 or + len(result.errors) > 0))) +
##################################################################### ## Actual Setup.py Script ########################################### @@ -136,7 +181,7 @@ if __name__ == "__main__":
setup( - cmdclass={'build_py': build_py}, + cmdclass={'build_py': build_py, 'test': test_command}, name = "cobbler", version = VERSION, description = "Network Boot and Update Server", diff --git a/tests/koan/__init__.py b/tests/koan/__init__.py new file mode 100644 index 0000000..e69de29
Among them is virtinst.
Signed-off-by: Cole Robinson crobinso@redhat.com --- koan/vmwcreate.py | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/koan/vmwcreate.py b/koan/vmwcreate.py index e869aca..6e5216b 100755 --- a/koan/vmwcreate.py +++ b/koan/vmwcreate.py @@ -21,14 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA """
-import os, sys, time, stat -import tempfile +import os import random -from optparse import OptionParser import exceptions -import errno -import re -import virtinst
IMAGE_DIR = "/var/lib/vmware/images" VMX_DIR = "/var/lib/vmware/vmx"
We break out the virt-install logic to a separate file, since further conversions are going to be able to share 90% of the code (basically the whole point of libvirt :) ).
In the process we drop a lot of hacks and workarounds for things that have been fixed in virtinst for at least a year, some for as long as 3. The required virtinst dep is fairly recent anyways with the call to guest.set_autostart.
Signed-off-by: Cole Robinson crobinso@redhat.com --- koan/virtinstall.py | 182 +++++++++++++++++++++++++++++++++++++++++++++ koan/xencreate.py | 173 ++----------------------------------------- tests/koan/__init__.py | 1 + tests/koan/virtinstall.py | 57 ++++++++++++++ 4 files changed, 246 insertions(+), 167 deletions(-) create mode 100755 koan/virtinstall.py create mode 100644 tests/koan/virtinstall.py
diff --git a/koan/virtinstall.py b/koan/virtinstall.py new file mode 100755 index 0000000..5a56634 --- /dev/null +++ b/koan/virtinstall.py @@ -0,0 +1,182 @@ +""" +Virtualization installation functions. +Currently somewhat Xen/paravirt specific, will evolve later. + +Copyright 2006-2008 Red Hat, Inc. +Michael DeHaan mdehaan@redhat.com + +Original version based on virtguest-install +Jeremy Katz katzj@redhat.com +Option handling added by Andrew Puch apuch@redhat.com +Simplified for use as library by koan, Michael DeHaan mdehaan@redhat.com + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA +""" + +import re + +import app as koan +import utils + +def _sanitize_disks(disks): + ret = [] + for d in disks: + if d[1] != 0 or d[0].startswith("/dev"): + ret.append((d[0], d[1])) + else: + raise koan.InfoException("this virtualization type does not work without a disk image, set virt-size in Cobbler to non-zero") + + return ret + +def _sanitize_nics(nics, bridge, profile_bridge): + ret = [] + + if not nics: + return ret + + interfaces = nics.keys() + interfaces.sort() + counter = -1 + vlanpattern = re.compile("[a-zA-Z0-9]+.[0-9]+") + + for iname in interfaces: + counter = counter + 1 + intf = nics[iname] + + if (intf["interface_type"] in ("master","bond","bridge") or + vlanpattern.match(iname) or iname.find(":") != -1): + continue + + mac = intf["mac_address"] + + if not bridge: + intf_bridge = intf["virt_bridge"] + if intf_bridge == "": + if profile_bridge == "": + raise koan.InfoException("virt-bridge setting is not defined in cobbler") + intf_bridge = profile_bridge + + else: + if bridge.find(",") == -1: + intf_bridge = bridge + else: + bridges = bridge.split(",") + intf_bridge = bridges[counter] + + ret.append((intf_bridge, mac)) + + return ret + + +def build_commandline(name=None, + ram=None, + disks=None, + uuid=None, + extra=None, + vcpus=None, + profile_data=None, + arch=None, + no_gfx=False, + fullvirt=False, + bridge=None, + virt_type=None, + virt_auto_boot=False, + qemu_driver_type=None, + qemu_net_type=None): + + if profile_data.has_key("file"): + raise koan.InfoException("Xen does not work with --image yet") + + disks = _sanitize_disks(disks) + nics = _sanitize_nics(profile_data.get("interfaces"), + bridge, + profile_data.get("virt_bridge")) + if not nics: + # for --profile you get one NIC, go define a system if you want more. + # FIXME: can mac still be sent on command line in this case? + + if bridge is None: + bridge = profile_data["virt_bridge"] + + if bridge == "": + raise koan.InfoException("virt-bridge setting is not defined in cobbler") + nics = [(bridge, None)] + + + kernel = profile_data.get("kernel_local") + initrd = profile_data.get("initrd_local") + breed = profile_data.get("breed") + os_version = profile_data.get("os_version") + + cmd = "virt-install --connect xen:/// " + + cmd += "--name %s " % name + cmd += "--ram %s " % ram + cmd += "--vcpus %s " % vcpus + + if uuid: + cmd += "--uuid %s " % uuid + + if virt_auto_boot: + cmd += "--autostart " + + if no_gfx: + cmd += "--nographics " + else: + cmd += "--vnc " + + if fullvirt: + cmd += "--hvm " + cmd += "--pxe " + if arch: + cmd += "--arch %s " % arch + else: + cmd += "--paravirt " + cmd += ("--boot kernel=%s,initrd=%s,kernel_args=%s " % + (kernel, initrd, extra)) + + if breed and breed != "other": + if os_version and os_version != "other": + cmd += "--os-variant %s " % os_version + else: + distro = "unix" + if breed in [ "debian", "suse", "redhat" ]: + distro = "linux" + elif breed in [ "windows" ]: + distro = "windows" + + cmd += "--os-type %s " % distro + + for path, size in disks: + cmd += "--disk path=%s" % (path) + if str(size) != "0": + cmd += ",size=%s" % size + cmd += " " + + for bridge, mac in nics: + cmd += "--network bridge=%s" % bridge + if mac: + cmd += ",mac=%s" % mac + cmd += " " + + cmd += "--wait 0 " + cmd += "--noautoconsole " + + return cmd + +def start_install(*args, **kwargs): + cmd = build_commandline(*args, **kwargs) + utils.subprocess_call(cmd) diff --git a/koan/xencreate.py b/koan/xencreate.py index 50178a3..6279fe7 100755 --- a/koan/xencreate.py +++ b/koan/xencreate.py @@ -1,5 +1,5 @@ """ -Virtualization installation functions. +Virtualization installation functions. Currently somewhat Xen/paravirt specific, will evolve later.
Copyright 2006-2008 Red Hat, Inc. @@ -26,170 +26,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """
-import os, sys, time, stat -import tempfile -import random -import exceptions -import errno -import re -import virtinst -import app as koan +import utils +import virtinstall
-try: - import virtinst.DistroInstaller as DistroManager -except: - # older virtinst, this is probably ok - # but we know we can't do Xen fullvirt installs - pass -import traceback - -def random_mac(): - """ - from xend/server/netif.py - Generate a random MAC address. - Uses OUI 00-16-3E, allocated to - Xensource, Inc. Last 3 fields are random. - return: MAC address string - """ - mac = [ 0x00, 0x16, 0x3e, - random.randint(0x00, 0x7f), - random.randint(0x00, 0xff), - random.randint(0x00, 0xff) ] - return ':'.join(map(lambda x: "%02x" % x, mac)) - - -def start_install(name=None, - ram=None, - disks=None, - uuid=None, - extra=None, - vcpus=None, - profile_data=None, - arch=None, - no_gfx=False, - fullvirt=False, - bridge=None, - virt_type=None, - virt_auto_boot=False, - qemu_driver_type=None, - qemu_net_type=None): - - if profile_data.has_key("file"): - raise koan.InfoException("Xen does not work with --image yet") - - if fullvirt: - # FIXME: add error handling here to explain when it's not supported - guest = virtinst.FullVirtGuest(installer=virtinst.PXEInstaller()) - else: - guest = virtinst.ParaVirtGuest() - - extra = extra.replace("&","&") - - if not fullvirt: - guest.set_boot((profile_data["kernel_local"], profile_data["initrd_local"])) - # fullvirt OS's will get this from the PXE config (managed by Cobbler) - guest.extraargs = extra - else: - print "- fullvirt mode" - if profile_data.has_key("breed"): - breed = profile_data["breed"] - if breed != "other" and breed != "": - if breed in [ "debian", "suse", "redhat" ]: - guest.set_os_type("linux") - elif breed in [ "windows" ]: - guest.set_os_type("windows") - else: - guest.set_os_type("unix") - if profile_data.has_key("os_version"): - # FIXME: when os_version is not defined and it's linux, do we use generic24/generic26 ? - version = profile_data["os_version"] - if version != "other" and version != "": - try: - guest.set_os_variant(version) - except: - print "- virtinst library does not understand variant %s, treating as generic" % version - pass - - - guest.set_name(name) - guest.set_memory(ram) - guest.set_vcpus(vcpus) - guest.set_autostart(virt_auto_boot) - - if not no_gfx: - guest.set_graphics("vnc") - else: - guest.set_graphics(False) - - if uuid is not None: - guest.set_uuid(uuid) - - for d in disks: - if d[1] != 0 or d[0].startswith("/dev"): - guest.disks.append(virtinst.XenDisk(d[0], size=d[1])) - else: - raise koan.InfoException("this virtualization type does not work without a disk image, set virt-size in Cobbler to non-zero") - - counter = 0 - - if profile_data.has_key("interfaces"): - - interfaces = profile_data["interfaces"].keys() - interfaces.sort() - counter = -1 - vlanpattern = re.compile("[a-zA-Z0-9]+.[0-9]+") - - for iname in interfaces: - counter = counter + 1 - intf = profile_data["interfaces"][iname] - - if intf["interface_type"] in ("master","bond","bridge") or vlanpattern.match(iname) or iname.find(":") != -1: - continue - - mac = intf["mac_address"] - if mac == "": - mac = random_mac() - - if not bridge: - profile_bridge = profile_data["virt_bridge"] - - intf_bridge = intf["virt_bridge"] - if intf_bridge == "": - if profile_bridge == "": - raise koan.InfoException("virt-bridge setting is not defined in cobbler") - intf_bridge = profile_bridge - - else: - if bridge.find(",") == -1: - intf_bridge = bridge - else: - bridges = bridge.split(",") - intf_bridge = bridges[counter] - - - nic_obj = virtinst.XenNetworkInterface(macaddr=mac, bridge=intf_bridge) - guest.nics.append(nic_obj) - counter = counter + 1 - - else: - # for --profile you just get one NIC, go define a system if you want more. - # FIXME: can mac still be sent on command line in this case? - - if bridge is None: - profile_bridge = profile_data["virt_bridge"] - else: - profile_bridge = bridge - - if profile_bridge == "": - raise koan.InfoException("virt-bridge setting is not defined in cobbler") - - nic_obj = virtinst.XenNetworkInterface(macaddr=random_mac(), bridge=profile_bridge) - guest.nics.append(nic_obj) - - - - - guest.start_install() - - return "use virt-manager or reconnect with virsh console %s" % name - +def start_install(*args, **kwargs): + cmd = virtinstall.build_commandline("xen:///", *args, **kwargs) + utils.subprocess_call(cmd) diff --git a/tests/koan/__init__.py b/tests/koan/__init__.py index e69de29..370e90e 100644 --- a/tests/koan/__init__.py +++ b/tests/koan/__init__.py @@ -0,0 +1 @@ +import virtinstall diff --git a/tests/koan/virtinstall.py b/tests/koan/virtinstall.py new file mode 100644 index 0000000..cff0f2e --- /dev/null +++ b/tests/koan/virtinstall.py @@ -0,0 +1,57 @@ +import unittest + +from koan.virtinstall import build_commandline + +class KoanVirtInstallTest(unittest.TestCase): + def testXenPVBasic(self): + cmd = build_commandline("xen:///", + name="foo", + ram=256, + uuid="ad6611b9-98e4-82c8-827f-051b6b6680d7", + vcpus=1, + bridge="br0", + disks=[("/tmp/foo1.img", 8), ("/dev/foo1", 0)], + profile_data={ + "kernel_local" : "kernel", + "initrd_local" : "initrd", + }, + extra="ks=http://example.com/ks.ks") + + self.assertEquals(cmd, + ("virt-install --connect xen:/// --name foo --ram 256 --vcpus 1 " + "--uuid ad6611b9-98e4-82c8-827f-051b6b6680d7 --vnc --paravirt " + "--boot kernel=kernel,initrd=initrd,kernel_args=ks=http://example.com/ks.ks " + "--disk path=/tmp/foo1.img,size=8 --disk path=/dev/foo1 " + "--network bridge=br0 " + "--wait 0 --noautoconsole ")) + + def testXenFVBasic(self): + cmd = build_commandline("xen:///", + name="foo", + ram=256, + vcpus=1, + disks=[("/dev/foo1", 0)], + fullvirt=True, + arch="x86_64", + bridge="br0,br1", + profile_data = { + "breed" : "redhat", + "os_version" : "fedora14", + "interfaces" : { + "eth0": { + "interface_type": "na", + "mac_address": "11:22:33:44:55:66", + }, "eth1": { + "interface_type": "na", + "mac_address": "11:22:33:33:22:11", + } + } + }) + + self.assertEquals(cmd, + ("virt-install --connect xen:/// --name foo --ram 256 --vcpus 1 " + "--vnc --hvm --pxe --arch x86_64 " + "--os-variant fedora14 --disk path=/dev/foo1 " + "--network bridge=br0,mac=11:22:33:44:55:66 " + "--network bridge=br1,mac=11:22:33:33:22:11 " + "--wait 0 --noautoconsole "))
Pull out all the qcreate specific changes and merge them into the virtinstall module. Most of them are fixes that will apply to the generic code anyways, but were probably only tested/noticed with the qemu code.
Signed-off-by: Cole Robinson crobinso@redhat.com --- koan/qcreate.py | 210 +------------------------------------------- koan/virtinstall.py | 86 +++++++++++++++++-- tests/koan/virtinstall.py | 50 +++++++++++ 3 files changed, 134 insertions(+), 212 deletions(-)
diff --git a/koan/qcreate.py b/koan/qcreate.py index 493c40a..1de5143 100755 --- a/koan/qcreate.py +++ b/koan/qcreate.py @@ -1,5 +1,5 @@ """ -Virtualization installation functions. +Virtualization installation functions.
Copyright 2007-2008 Red Hat, Inc. Michael DeHaan mdehaan@redhat.com @@ -23,209 +23,9 @@ module for creating fullvirt guests via KVM/kqemu/qemu requires python-virtinst-0.200. """
-import os, sys, time, stat -import tempfile -import random -from optparse import OptionParser -import exceptions -import errno -import re -import tempfile -import shutil -import virtinst -import app as koan -try: - import subprocess -except: - import sub_process as subprocess +import virtinstall import utils
-def random_mac(): - """ - from xend/server/netif.py - Generate a random MAC address. - Uses OUI 00-16-3E, allocated to - Xensource, Inc. Last 3 fields are random. - return: MAC address string - """ - mac = [ 0x00, 0x16, 0x3e, - random.randint(0x00, 0x7f), - random.randint(0x00, 0xff), - random.randint(0x00, 0xff) ] - return ':'.join(map(lambda x: "%02x" % x, mac)) - - -def start_install(name=None, - ram=None, - disks=None, - mac=None, - uuid=None, - extra=None, - vcpus=None, - profile_data=None, - arch=None, - no_gfx=False, - fullvirt=True, - bridge=None, - virt_type=None, - virt_auto_boot=False, - qemu_driver_type=None, - qemu_net_type=None): - - vtype = "qemu" - if virtinst.util.is_kvm_capable(): - vtype = "kvm" - arch = None # let virtinst.FullVirtGuest() default to the host arch - elif virtinst.util.is_kqemu_capable(): - vtype = "kqemu" - print "- using qemu hypervisor, type=%s" % vtype - - if arch is not None and arch.lower() in ["x86","i386"]: - arch = "i686" - - guest = virtinst.FullVirtGuest(hypervisorURI="qemu:///system",type=vtype, arch=arch) - - if not profile_data.has_key("file"): - # images don't need to source this - if not profile_data.has_key("install_tree"): - raise koan.InfoException("Cannot find install source in kickstart file, aborting.") - - - if not profile_data["install_tree"].endswith("/"): - profile_data["install_tree"] = profile_data["install_tree"] + "/" - - # virt manager doesn't like nfs:// and just wants nfs: - # (which cobbler should fix anyway) - profile_data["install_tree"] = profile_data["install_tree"].replace("nfs://","nfs:") - - if profile_data.has_key("file"): - # this is an image based installation - input_path = profile_data["file"] - print "- using image location %s" % input_path - if input_path.find(":") == -1: - # this is not an NFS path - guest.cdrom = input_path - else: - (tempdir, filename) = utils.nfsmount(input_path) - guest.cdrom = os.path.join(tempdir, filename) - - kickstart = profile_data.get("kickstart","") - if kickstart != "": - # we have a (windows?) answer file we have to provide - # to the ISO. - print "I want to make a floppy for %s" % kickstart - floppy_path = utils.make_floppy(kickstart) - guest.disks.append(virtinst.VirtualDisk(device=virtinst.VirtualDisk.DEVICE_FLOPPY, path=floppy_path)) - - - else: - guest.location = profile_data["install_tree"] - - extra = extra.replace("&","&") - guest.extraargs = extra - - if profile_data.has_key("breed"): - breed = profile_data["breed"] - if breed != "other" and breed != "": - if breed in [ "ubuntu", "debian", "redhat" ]: - guest.set_os_type("linux") - elif breed == "suse": - guest.set_os_type("linux") - # SUSE requires the correct arch to find - # kernel+initrd on the inst-source /boot/<arch>/loader/... - guest.arch = profile_data["arch"] - if guest.arch in [ "i386", "i486", "i586" ]: - guest.arch = "i686" - elif breed in [ "windows" ]: - guest.set_os_type("windows") - else: - guest.set_os_type("unix") - if profile_data.has_key("os_version"): - # FIXME: when os_version is not defined and it's linux, do we use generic24/generic26 ? - if breed == "ubuntu": - # If breed is Ubuntu, need to set the version to the type of "ubuntu<version>" - # as defined by virtinst. (i.e. ubuntunatty) - version = "ubuntu%s" % profile_data["os_version"] - else: - version = profile_data["os_version"] - if version != "other" and version != "": - try: - guest.set_os_variant(version) - except: - print "- virtinst library does not understand variant %s, treating as generic" % version - pass - - guest.set_name(name) - guest.set_memory(ram) - guest.set_vcpus(vcpus) - guest.set_autostart(virt_auto_boot) - # for KVM, we actually can't disable this, since it's the only - # console it has other than SDL - guest.set_graphics("vnc") - - if uuid is not None: - guest.set_uuid(uuid) - - for d in disks: - print "- adding disk: %s of size %s (driver type=%s)" % (d[0], d[1], d[2]) - if d[1] != 0 or d[0].startswith("/dev"): - vdisk = virtinst.VirtualDisk(d[0], size=d[1], bus=qemu_driver_type) - try: - vdisk.set_driver_type(d[2]) - except: - print "- virtinst failed to create the VirtualDisk with the specified driver type (%s), using whatever it defaults to instead" % d[2] - guest.disks.append(vdisk) - else: - raise koan.InfoException("this virtualization type does not work without a disk image, set virt-size in Cobbler to non-zero") - - if profile_data.has_key("interfaces"): - - counter = 0 - interfaces = profile_data["interfaces"].keys() - interfaces.sort() - vlanpattern = re.compile("[a-zA-Z0-9]+.[0-9]+") - for iname in interfaces: - intf = profile_data["interfaces"][iname] - - if intf["interface_type"] in ("master","bond","bridge") or vlanpattern.match(iname) or iname.find(":") != -1: - continue - - mac = intf["mac_address"] - if mac == "": - mac = random_mac() - - if bridge is None: - profile_bridge = profile_data["virt_bridge"] - - intf_bridge = intf["virt_bridge"] - if intf_bridge == "": - if profile_bridge == "": - raise koan.InfoException("virt-bridge setting is not defined in cobbler") - intf_bridge = profile_bridge - else: - if bridge.find(",") == -1: - intf_bridge = bridge - else: - bridges = bridge.split(",") - intf_bridge = bridges[counter] - nic_obj = virtinst.VirtualNetworkInterface(macaddr=mac, bridge=intf_bridge, model=qemu_net_type) - guest.nics.append(nic_obj) - counter = counter + 1 - - else: - - if bridge is not None: - profile_bridge = bridge - else: - profile_bridge = profile_data["virt_bridge"] - - if profile_bridge == "": - raise koan.InfoException("virt-bridge setting is not defined in cobbler") - - nic_obj = virtinst.VirtualNetworkInterface(macaddr=random_mac(), bridge=profile_bridge, model=qemu_net_type) - guest.nics.append(nic_obj) - - guest.start_install() - - return "use virt-manager and connect to qemu to manage guest: %s" % name - +def start_install(*args, **kwargs): + cmd = virtinstall.build_commandline("qemu:///system", *args, **kwargs) + utils.subprocess_call(cmd) diff --git a/koan/virtinstall.py b/koan/virtinstall.py index 5a56634..a716d10 100755 --- a/koan/virtinstall.py +++ b/koan/virtinstall.py @@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """
+import os import re
import app as koan @@ -34,8 +35,12 @@ import utils def _sanitize_disks(disks): ret = [] for d in disks: + driver_type = None + if len(d) > 2: + driver_type = d[2] + if d[1] != 0 or d[0].startswith("/dev"): - ret.append((d[0], d[1])) + ret.append((d[0], d[1], driver_type)) else: raise koan.InfoException("this virtualization type does not work without a disk image, set virt-size in Cobbler to non-zero")
@@ -81,7 +86,8 @@ def _sanitize_nics(nics, bridge, profile_bridge): return ret
-def build_commandline(name=None, +def build_commandline(uri, + name=None, ram=None, disks=None, uuid=None, @@ -97,8 +103,45 @@ def build_commandline(name=None, qemu_driver_type=None, qemu_net_type=None):
+ is_xen = uri.startswith("xen") + is_qemu = uri.startswith("qemu") + if is_qemu: + fullvirt = True + + floppy = None + cdrom = None + location = None + if profile_data.has_key("file"): - raise koan.InfoException("Xen does not work with --image yet") + if is_xen: + raise koan.InfoException("Xen does not work with --image yet") + + # this is an image based installation + input_path = profile_data["file"] + print "- using image location %s" % input_path + if input_path.find(":") == -1: + # this is not an NFS path + cdrom = input_path + else: + (tempdir, filename) = utils.nfsmount(input_path) + cdrom = os.path.join(tempdir, filename) + + kickstart = profile_data.get("kickstart","") + if kickstart != "": + # we have a (windows?) answer file we have to provide + # to the ISO. + print "I want to make a floppy for %s" % kickstart + floppy = utils.make_floppy(kickstart) + elif is_qemu: + # images don't need to source this + if not profile_data.has_key("install_tree"): + raise koan.InfoException("Cannot find install source in kickstart file, aborting.") + + if not profile_data["install_tree"].endswith("/"): + profile_data["install_tree"] = profile_data["install_tree"] + "/" + + location = profile_data["install_tree"] +
disks = _sanitize_disks(disks) nics = _sanitize_nics(profile_data.get("interfaces"), @@ -120,8 +163,16 @@ def build_commandline(name=None, initrd = profile_data.get("initrd_local") breed = profile_data.get("breed") os_version = profile_data.get("os_version") + if os_version and breed == "ubuntu": + os_version = "ubuntu%s" % os_version + + net_model = None + disk_bus = None + if is_qemu: + net_model = qemu_net_type + disk_bus = qemu_driver_type
- cmd = "virt-install --connect xen:/// " + cmd = "virt-install --connect %s " % uri
cmd += "--name %s " % name cmd += "--ram %s " % ram @@ -138,9 +189,19 @@ def build_commandline(name=None, else: cmd += "--vnc "
- if fullvirt: + if is_qemu and virt_type: + cmd += "--virt-type %s " % virt_type + + if fullvirt or is_qemu: cmd += "--hvm " - cmd += "--pxe " + if is_xen: + cmd += "--pxe " + + elif cdrom: + cmd += "--cdrom %s " % cdrom + elif location: + cmd += "--location %s " % location + if arch: cmd += "--arch %s " % arch else: @@ -160,16 +221,27 @@ def build_commandline(name=None,
cmd += "--os-type %s " % distro
- for path, size in disks: + for path, size, driver_type in disks: + print ("- adding disk: %s of size %s (driver type=%s)" % + (path, size, driver_type)) cmd += "--disk path=%s" % (path) if str(size) != "0": cmd += ",size=%s" % size + if disk_bus: + cmd += ",bus=%s" % disk_bus + if driver_type: + cmd += ",driver_type=%s" % driver_type cmd += " "
+ if floppy: + cmd += "--disk path=%s,device=floppy " % floppy + for bridge, mac in nics: cmd += "--network bridge=%s" % bridge if mac: cmd += ",mac=%s" % mac + if net_model: + cmd += ",model=%s" % net_model cmd += " "
cmd += "--wait 0 " diff --git a/tests/koan/virtinstall.py b/tests/koan/virtinstall.py index cff0f2e..c57de1a 100644 --- a/tests/koan/virtinstall.py +++ b/tests/koan/virtinstall.py @@ -11,6 +11,8 @@ class KoanVirtInstallTest(unittest.TestCase): vcpus=1, bridge="br0", disks=[("/tmp/foo1.img", 8), ("/dev/foo1", 0)], + qemu_driver_type="virtio", + qemu_net_type="virtio", profile_data={ "kernel_local" : "kernel", "initrd_local" : "initrd", @@ -55,3 +57,51 @@ class KoanVirtInstallTest(unittest.TestCase): "--network bridge=br0,mac=11:22:33:44:55:66 " "--network bridge=br1,mac=11:22:33:33:22:11 " "--wait 0 --noautoconsole ")) + + def testQemuCDROM(self): + cmd = build_commandline("qemu:///system", + name="foo", + ram=256, + vcpus=1, + disks=[("/tmp/foo1.img", 8), ("/dev/foo1", 0)], + fullvirt=True, + bridge="br0", + profile_data = { + "breed" : "windows", + "file" : "/some/cdrom/path.iso", + }) + + self.assertEquals(cmd, + ("virt-install --connect qemu:///system --name foo --ram 256 " + "--vcpus 1 --vnc --hvm --cdrom /some/cdrom/path.iso " + "--os-type windows --disk path=/tmp/foo1.img,size=8 " + "--disk path=/dev/foo1 --network bridge=br0 " + "--wait 0 --noautoconsole ") + ) + + def testQemuURL(self): + cmd = build_commandline("qemu:///system", + name="foo", + ram=256, + vcpus=1, + disks=[("/tmp/foo1.img", 8), ("/dev/foo1", 0)], + fullvirt=True, + arch="i686", + bridge="br0", + qemu_driver_type="virtio", + qemu_net_type="virtio", + profile_data = { + "breed" : "ubuntu", + "os_version" : "natty", + "install_tree" : "http://example.com/some/install/tree", + }) + + self.assertEquals(cmd, + ("virt-install --connect qemu:///system --name foo --ram 256 " + "--vcpus 1 --vnc --hvm " + "--location http://example.com/some/install/tree/ --arch i686 " + "--os-variant ubuntunatty " + "--disk path=/tmp/foo1.img,size=8,bus=virtio " + "--disk path=/dev/foo1,bus=virtio " + "--network bridge=br0,model=virtio --wait 0 --noautoconsole ") + )
This code was using the API equivalent of the virt-image tool, however it's really unnecessary here, all we are doing is importing an existing disk image which is an install option long provided by virt-install. Merge the functionality into the virtinstall module and convert it.
This code has actually been broken for about 6 months, since the start_install signature was never updated for the qemu_net_type change.
Signed-off-by: Cole Robinson crobinso@redhat.com --- koan/imagecreate.py | 171 ++------------------------------------------- koan/virtinstall.py | 47 +++++++++++-- tests/koan/virtinstall.py | 21 ++++++ 3 files changed, 67 insertions(+), 172 deletions(-)
diff --git a/koan/imagecreate.py b/koan/imagecreate.py index c336dcb..cf4db36 100644 --- a/koan/imagecreate.py +++ b/koan/imagecreate.py @@ -23,170 +23,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """
-import os, sys, time, stat -import shutil -import random -import exceptions -import errno -import virtinst -try: - from virtinst import ImageParser, Guest, CapabilitiesParser, VirtualNetworkInterface -except: - # if this fails, this is ok, the user just won't be able to use image objects... - # keeping this dynamic allows this to work on older EL. - pass -import libvirt +import utils +import virtinstall
-import app as koan - -#FIXME this was copied -def random_mac(): - """ - from xend/server/netif.py - Generate a random MAC address. - Uses OUI 00-16-3E, allocated to - Xensource, Inc. Last 3 fields are random. - return: MAC address string - """ - mac = [ 0x00, 0x16, 0x3e, - random.randint(0x00, 0x7f), - random.randint(0x00, 0xff), - random.randint(0x00, 0xff) ] - return ':'.join(map(lambda x: "%02x" % x, mac)) - - -def transform_arch(arch): - if arch == "i386": - return "i686" - else: - return arch - -def copy_image(original_file, new_location): - shutil.copyfile(original_file, new_location) - return new_location - - -def process_disk(image, boot, file, location, target): - image_location = copy_image(file, location) - # Create the disk - disk = ImageParser.Disk() - disk.format = "raw" - disk.file = image_location - disk.use = "user" - disk.id = image_location - image.storage[disk.id] = disk - - #Create the drive - drive = ImageParser.Drive() - drive.id = image_location - drive.target = target - drive.disk = disk - boot.disks.append(drive) - #dev api - #boot.drives.append(drive) - - -def process_networks(domain, guest, profile_data, bridge): - # Create a bridge or default network for every requested nic. If there are more - # bridges then nics discard the last one. - domain.interface = int(profile_data["network_count"]) - bridges = [] - #use the provided bridge first - guest_bridge = bridge - if guest_bridge is None: - guest_bridge = profile_data["virt_bridge"] - - # Look for commas - if (guest_bridge is not None) and (len(guest_bridge.strip()) > 0): - if guest_bridge.find(",") == -1: - bridges.append(guest_bridge) - else: - bridges == guest_bridge.split(",") - - for cnt in range(0,domain.interface): - if cnt < len(bridges): - nic = VirtualNetworkInterface(random_mac(), type="bridge", bridge = bridges[cnt]) - #dev api - #nic = VirtualNetworkInterface(random_mac(), type="bridge", bridge = bridge, conn=guest.conn) - else: - default_network = virtinst.util.default_network() - #dev api - #default_network = virtinst.util.default_network(guest.conn) - nic = VirtualNetworkInterface(random_mac(), type=default_network[0], network=default_network[1]) - guest.nics.append(nic) - -def start_install(name=None, - ram=None, - disks=None, - uuid=None, - extra=None, - vcpus=None, - profile_data=None, - arch=None, - no_gfx=False, - fullvirt=False, - bridge=None, - virt_type=None, - virt_auto_boot=False, - qemu_driver_type=None): - - #FIXME how to do a non-default connection - #Can we drive off of virt-type? - connection = None - - if (virt_type is None ) or (virt_type == "auto"): - connection = virtinst.util.default_connection() - elif virt_type.lower()[0:3] == "xen": - connection = "xen" - else: - connection = "qemu:///system" - - connection = libvirt.open(connection) - capabilities = virtinst.CapabilitiesParser.parse(connection.getCapabilities()) - image_arch = transform_arch(arch) - - image = ImageParser.Image() - #dev api - #image = ImageParser.Image(filename="") #FIXME, ImageParser should take in None - image.name = name - - domain = ImageParser.Domain() - domain.vcpu = vcpus - domain.memory = ram - image.domain = domain - - boot = ImageParser.Boot() - boot.type = "hvm" #FIXME HARDCODED - boot.loader = "hd" #FIXME HARDCODED - boot.arch = image_arch - domain.boots.append(boot) - - #FIXME Several issues. Single Disk, type is hardcoded - #And there is no way to provision with access to "file" - process_disk(image, boot, profile_data["file"], disks[0][0], "hda") - - #FIXME boot_index?? - installer = virtinst.ImageInstaller(boot_index = 0, image=image, capabilities=capabilities) - guest = virtinst.FullVirtGuest(connection = connection, installer=installer, arch=image_arch) - - extra = extra.replace("&","&") - - guest.extraargs = extra - guest.set_name(name) - guest.set_memory(ram) - guest.set_vcpus(vcpus) - - if not no_gfx: - guest.set_graphics("vnc") - else: - guest.set_graphics(False) - - if uuid is not None: - guest.set_uuid(uuid) - - process_networks(domain, guest, profile_data, bridge) - - guest.start_install() - - return "use virt-manager or reconnect with virsh console %s" % name - +def start_install(*args, **kwargs): + cmd = virtinstall.build_commandline("import", *args, **kwargs) + utils.subprocess_call(cmd) diff --git a/koan/virtinstall.py b/koan/virtinstall.py index a716d10..f7267a6 100755 --- a/koan/virtinstall.py +++ b/koan/virtinstall.py @@ -46,9 +46,19 @@ def _sanitize_disks(disks):
return ret
-def _sanitize_nics(nics, bridge, profile_bridge): +def _sanitize_nics(nics, bridge, profile_bridge, network_count): ret = []
+ if network_count is not None and not nics: + # Fill in some stub nics so we can take advantage of the loop logic + nics = {} + for i in range(int(network_count)): + nics["foo%s" % i] = { + "interface_type" : "na", + "mac_address": None, + "virt_bridge": None, + } + if not nics: return ret
@@ -103,6 +113,14 @@ def build_commandline(uri, qemu_driver_type=None, qemu_net_type=None):
+ is_import = uri.startswith("import") + if is_import: + # We use the special value 'import' for imagecreate.py. Since + # it is connection agnostic, just let virt-install choose the + # best hypervisor. + uri = "" + fullvirt = None + is_xen = uri.startswith("xen") is_qemu = uri.startswith("qemu") if is_qemu: @@ -111,8 +129,15 @@ def build_commandline(uri, floppy = None cdrom = None location = None + importpath = None
- if profile_data.has_key("file"): + if is_import: + importpath = profile_data.get("file") + if not importpath: + raise koan.InfoException("Profile 'file' required for image " + "install") + + elif profile_data.has_key("file"): if is_xen: raise koan.InfoException("Xen does not work with --image yet")
@@ -146,7 +171,8 @@ def build_commandline(uri, disks = _sanitize_disks(disks) nics = _sanitize_nics(profile_data.get("interfaces"), bridge, - profile_data.get("virt_bridge")) + profile_data.get("virt_bridge"), + profile_data.get("network_count")) if not nics: # for --profile you get one NIC, go define a system if you want more. # FIXME: can mac still be sent on command line in this case? @@ -172,7 +198,9 @@ def build_commandline(uri, net_model = qemu_net_type disk_bus = qemu_driver_type
- cmd = "virt-install --connect %s " % uri + cmd = "virt-install " + if uri: + cmd += "--connect %s " % uri
cmd += "--name %s " % name cmd += "--ram %s " % ram @@ -192,8 +220,9 @@ def build_commandline(uri, if is_qemu and virt_type: cmd += "--virt-type %s " % virt_type
- if fullvirt or is_qemu: - cmd += "--hvm " + if fullvirt or is_qemu or is_import: + if fullvirt is not None: + cmd += "--hvm " if is_xen: cmd += "--pxe "
@@ -201,6 +230,8 @@ def build_commandline(uri, cmd += "--cdrom %s " % cdrom elif location: cmd += "--location %s " % location + elif importpath: + cmd += "--import "
if arch: cmd += "--arch %s " % arch @@ -221,6 +252,10 @@ def build_commandline(uri,
cmd += "--os-type %s " % distro
+ if importpath: + # This needs to be the first disk for import to work + cmd += "--disk path=%s " % importpath + for path, size, driver_type in disks: print ("- adding disk: %s of size %s (driver type=%s)" % (path, size, driver_type)) diff --git a/tests/koan/virtinstall.py b/tests/koan/virtinstall.py index c57de1a..6898a10 100644 --- a/tests/koan/virtinstall.py +++ b/tests/koan/virtinstall.py @@ -105,3 +105,24 @@ class KoanVirtInstallTest(unittest.TestCase): "--disk path=/dev/foo1,bus=virtio " "--network bridge=br0,model=virtio --wait 0 --noautoconsole ") ) + + def testImage(self): + cmd = build_commandline("import", + name="foo", + ram=256, + vcpus=1, + fullvirt=True, + bridge="br0,br2", + disks=[], + qemu_driver_type="virtio", + qemu_net_type="virtio", + profile_data = { + "file" : "/some/install/image.img", + "network_count" : 2, + }) + + self.assertEquals(cmd, + ("virt-install --name foo --ram 256 --vcpus 1 --vnc --import " + "--disk path=/some/install/image.img --network bridge=br0 " + "--network bridge=br2 --wait 0 --noautoconsole ") + )
Hi again Cole!
Hmm … yes, I remember this discussion from years ago :)
First comments are that this is both a decent new approach (using the CLI versus XML), and I'm also very concerned that you didn't test it yet, and that there may be several subtle regressions we wouldn't pick up until it shipped, because of workarounds around things libvirt didn't (used to) do. Not having a lot of time this AM to review…just a few quick questions.
We need to make sure all the disk and network options continue to work, which were implemented when libvirt didn't provide those capabilities. Does it support LVM and multiple network interfaces, etc in the exact same way (end result wise)?
Similarly, I need to know if any options are used are available in newer distributions but not older, as Cobbler needing to work in say, EL 5, is vitally important. Typically this has happened in the past, where libvirt was not running at equal versions on different distros.
As for image create, totally, it was added at the request of the oVirt team in ancient days -- there's no need for it anymore. Please test it live and get back to me? I don't think it's fair to throw it over the wall and ask the community folks to test/fix it and this shouldn't be too hard to do. When you get done, we can ask a few others to try it out and exercise the corners further.
Further discussion probably belongs on cobbler-devel, and when we get done you can send me a github pull request to github.com/cobbler
Thank you!
--Michael
On Sunday, February 5, 2012 at 9:31 PM, Cole Robinson wrote:
Koan uses the virtinst library for creating libvirt VMs. This is the same code that virt-install and virt-manager use for a lot of their libvirt interaction.
Problem is this virtinst never should have been a public API, it was designed without much thought, and attempting to maintain back compat all these years hasn't really done much good.
On the flip side, virt-install very much is intended to be a stable API: there are far more people out there using virt-install for scripting and we plan on keeping those scripts working as long as possible. virtinst should really be an implementation detail of virt-install.
So along that line of thinking, I want to deprecate virtinst as a public API, and keep it private to virt-* tools. So here is a patch series swapping koan from virtinst to generating a virt-install command line. Ideally this patch makes it into fedora before march so I can deprecate virtinst in upcoming fedora 17.
In the process, I add unit testing and unify most of the libvirt koan code, so hopefully things are in a better state than before.
One fairly sizable caveat though is that I haven't _actually_ tested koan: unit tests prove it is doing something useful reality can always be different. Though judging by the state of the koan code I don't think it's getting a lot of usage, at least the imagecreate module has been outright broken for near 6 months.
Cole Robinson (5): setup.py: Add stub 'test' command koan: vmware: Drop unused imports koan: Port xen creation to virt-install koan: Port qcreate to virt-install koan: port imagecreate to virt-install
.gitignore | 1 + koan/imagecreate.py | 171 +-------------------------- koan/qcreate.py | 210 +-------------------------------- koan/virtinstall.py | 289 +++++++++++++++++++++++++++++++++++++++++++++ koan/vmwcreate.py | 7 +- koan/xencreate.py | 173 +-------------------------- setup.py | 51 ++++++++- tests/koan/__init__.py | 1 + tests/koan/virtinstall.py | 128 ++++++++++++++++++++ 9 files changed, 484 insertions(+), 547 deletions(-) create mode 100755 koan/virtinstall.py create mode 100644 tests/koan/__init__.py create mode 100644 tests/koan/virtinstall.py
-- 1.7.7.5
cobbler mailing list cobbler@lists.fedorahosted.org (mailto:cobbler@lists.fedorahosted.org) https://fedorahosted.org/mailman/listinfo/cobbler
On 02/06/2012 08:12 AM, Michael DeHaan wrote:
Hi again Cole!
Hmm ⊠yes, I remember this discussion from years ago :)
First comments are that this is both a decent new approach (using the CLI versus XML), and I'm also very concerned that you didn't test it yet, and that there may be several subtle regressions we wouldn't pick up until it shipped, because of workarounds around things libvirt didn't (used to) do.
If your target is latest RHEL5, I'm pretty confident that most of the virtinst/libvirt workarounds are now obsolete. All things considered, RHEL5.7 has pretty modern libvirt and virtinst.
Not having a lot of time this AM to reviewâŠjust a few quick questions.
We need to make sure all the disk and network options continue to work, which were implemented when libvirt didn't provide those capabilities. Does it support LVM and multiple network interfaces, etc in the exact same way (end result wise)?
None of the disk or network handling here relies on libvirt's storage/network management functionality, it should continue to work as before, modulo bugs.
Similarly, I need to know if any options are used are available in newer distributions but not older, as Cobbler needing to work in say, EL 5, is vitally important. Typically this has happened in the past, where libvirt was not running at equal versions on different distros.
If your target is latest RHEL5, there are 2 problems.
- RHEL5 virt-install doesn't have the --boot option. This is used to install xen PV guests. We could work around this by enabling install_location support for PV, which xen + virt-install have supported in RHEL5 forever. But not sure how that meshes with existing deployments getting a cobbler upgrade.
- RHEL5 virt-install doesn't had --disk driver_type= for qemu_driver_type cobbler option. Not as big of a deal, users just can't specify that value on RHEL5.
But in that vein, currently all koan image/qemu/xen guest creation is broken on any RHEL5 since October, due to unconditional use of guest.set_autostart API which isn't in RHEL5.
As for image create, totally, it was added at the request of the oVirt team in ancient days -- there's no need for it anymore. Please test it live and get back to me? I don't think it's fair to throw it over the wall and ask the community folks to test/fix it and this shouldn't be too hard to do. When you get done, we can ask a few others to try it out and exercise the corners further.
I'll test on f16 xen + kvm. But TBH I'm not that motivated to blow away a machine to install RHEL5 and test the variety of combinations there (and I can't use a VM since this needs testing for fullvirt)
I could reformat the patch to preserve the old code and only use the new code if koan can't import virtinst. However from a long term maintenance point of view, that would be making the already bad koan situation (more or less same virtinst implementation copied across 2.5 files with varying assortment of fixes) even worse, since it would add yet another same-but-not-quite implementation of libvirt guest creation that could miss fixes, etc. But certainly it would greatly minimize risk for old hosts (but then again if old hosts really wanted to minimize risk would they be updating? :) /me trolls )
So if that works for you I'd be happy to adjust the patch.
Further discussion probably belongs on cobbler-devel, and when we get done you can send me a github pull request to github.com/cobbler
Whoops, I was doing patches against fedorahosted cobbler.git. Someone should push a commit there marking that repo as dead...
And sorry about cobbler vs. cobbler-devel, I'll subscribe.
Thanks, Cole
On Monday, February 6, 2012 at 8:57 AM, Cole Robinson wrote:
On 02/06/2012 08:12 AM, Michael DeHaan wrote:
Hi again Cole!
Hmm … yes, I remember this discussion from years ago :)
First comments are that this is both a decent new approach (using the CLI versus XML), and I'm also very concerned that you didn't test it yet, and that there may be several subtle regressions we wouldn't pick up until it shipped, because of workarounds around things libvirt didn't (used to) do.
If your target is latest RHEL5, I'm pretty confident that most of the virtinst/libvirt workarounds are now obsolete. All things considered, RHEL5.7 has pretty modern libvirt and virtinst.
Not having a lot of time this AM to review…just a few quick questions.
We need to make sure all the disk and network options continue to work, which were implemented when libvirt didn't provide those capabilities. Does it support LVM and multiple network interfaces, etc in the exact same way (end result wise)?
None of the disk or network handling here relies on libvirt's storage/network management functionality, it should continue to work as before, modulo bugs.
Similarly, I need to know if any options are used are available in newer distributions but not older, as Cobbler needing to work in say, EL 5, is vitally important. Typically this has happened in the past, where libvirt was not running at equal versions on different distros.
If your target is latest RHEL5, there are 2 problems.
- RHEL5 virt-install doesn't have the --boot option. This is used to install
xen PV guests. We could work around this by enabling install_location support for PV, which xen + virt-install have supported in RHEL5 forever. But not sure how that meshes with existing deployments getting a cobbler upgrade.
Hmm, who is using Xen PV out there? Speak up if you are.
I'm willing to shoot it.
- RHEL5 virt-install doesn't had --disk driver_type= for qemu_driver_type
cobbler option. Not as big of a deal, users just can't specify that value on RHEL5.
I don't think Cobbler users ever specified anything other than the default.
But in that vein, currently all koan image/qemu/xen guest creation is broken on any RHEL5 since October, due to unconditional use of guest.set_autostart API which isn't in RHEL5.
That's interesting as it does seem to confirm that nobody is using it.
Which seems to align with my thoughts that:
(A) people don't upgrade too often (B) the field is still largely VMware :)
So, yeah.
As for image create, totally, it was added at the request of the oVirt team in ancient days -- there's no need for it anymore. Please test it live and get back to me? I don't think it's fair to throw it over the wall and ask the community folks to test/fix it and this shouldn't be too hard to do. When you get done, we can ask a few others to try it out and exercise the corners further.
I'll test on f16 xen + kvm. But TBH I'm not that motivated to blow away a machine to install RHEL5 and test the variety of combinations there (and I can't use a VM since this needs testing for fullvirt)
I'd be happy to see if you could install successfully to a LVM partition with "--virt-disk" or whatever set, and you could create a machine with two NICs.
That would probably be good enough.
I could reformat the patch to preserve the old code and only use the new code if koan can't import virtinst. However from a long term maintenance point of view, that would be making the already bad koan situation (more or less same virtinst implementation copied across 2.5 files with varying assortment of fixes) even worse, since it would add yet another same-but-not-quite implementation of libvirt guest creation that could miss fixes, etc. But certainly it would greatly minimize risk for old hosts (but then again if old hosts really wanted to minimize risk would they be updating? :) /me trolls )
I don't really care so much about keeping the old code around. I'm mostly in Linus mode these days.
So if that works for you I'd be happy to adjust the patch.
Further discussion probably belongs on cobbler-devel, and when we get done you can send me a github pull request to github.com/cobbler (http://github.com/cobbler)
Whoops, I was doing patches against fedorahosted cobbler.git. Someone should push a commit there marking that repo as dead...
Yes, we should. Noted… if I still have access, I'll do it, if not, will ask Scott or James.
And sorry about cobbler vs. cobbler-devel, I'll subscribe.
No problem, thanks!
Thanks, Cole
Hi,
----- Ursprüngliche Mail -----
If your target is latest RHEL5, there are 2 problems.
- RHEL5 virt-install doesn't have the --boot option. This is used to
install xen PV guests. We could work around this by enabling install_location support for PV, which xen + virt-install have supported in RHEL5 forever. But not sure how that meshes with existing deployments getting a cobbler upgrade.
Hmm, who is using Xen PV out there? Speak up if you are.
I'm willing to shoot it.
We are using XenPV on Scientific Linux 5, cobbler-2.2.1-1.el5. Koan is working, except that I needed to patch start_install() parameters in xencreate.py There was a mailinglist thread in October about this.
Greetings André
Cole --
What's the workaround to auto-start Xen PV's? (or is there not a way?)
Seems like we could just implement this however needed (if xenpv… do this instead…), if virtinstall won't do it for us.
--Michael
On Monday, February 6, 2012 at 10:55 AM, André Gemünd wrote:
Hi,
----- Ursprüngliche Mail -----
If your target is latest RHEL5, there are 2 problems.
- RHEL5 virt-install doesn't have the --boot option. This is used to
install xen PV guests. We could work around this by enabling install_location support for PV, which xen + virt-install have supported in RHEL5 forever. But not sure how that meshes with existing deployments getting a cobbler upgrade.
Hmm, who is using Xen PV out there? Speak up if you are.
I'm willing to shoot it.
We are using XenPV on Scientific Linux 5, cobbler-2.2.1-1.el5. Koan is working, except that I needed to patch start_install() parameters in xencreate.py There was a mailinglist thread in October about this.
Greetings André
-- André Gemünd Fraunhofer-Institute for Algorithms and Scientific Computing andre.gemuend@scai.fraunhofer.de (mailto:andre.gemuend@scai.fraunhofer.de) Tel: +49 2241 14-2193 /C=DE/O=Fraunhofer/OU=SCAI/OU=People/CN=Andre Gemuend _______________________________________________ cobbler mailing list cobbler@lists.fedorahosted.org (mailto:cobbler@lists.fedorahosted.org) https://fedorahosted.org/mailman/listinfo/cobbler
On 02/06/2012 10:58 AM, Michael DeHaan wrote:
Cole --
What's the workaround to auto-start Xen PV's? (or is there not a way?)
Seems like we could just implement this however needed (if xenpv⊠do this insteadâŠ), if virtinstall won't do it for us.
The autostarting code could just be conditionally enabled if virt-install is new enough (just a grep of the help output) so that's not the issue.
The issue is that current koan code manually passed a kernel + initrd for the PV guest to boot. That's the only install scenario for PV guests AFAICT. And this is only available via the virt-install in a version newer than what's in RHEL5.
The workaround could be to make PV installs work like qcreate install_location installs, which is basically the same as direct kernel/initrd boot but you rely on virt-install to pull the kernel/initrd from the install tree. Since cobbler tracks this info it would probably 'just work' with a tiny patch but someone would need to test. And this has been supported on virt-install command line since probably rhel5.1
Thanks, Cole
On Monday, February 6, 2012 at 11:37 AM, Cole Robinson wrote:
On 02/06/2012 10:58 AM, Michael DeHaan wrote:
Cole --
What's the workaround to auto-start Xen PV's? (or is there not a way?)
Seems like we could just implement this however needed (if xenpv… do this instead…), if virtinstall won't do it for us.
The autostarting code could just be conditionally enabled if virt-install is new enough (just a grep of the help output) so that's not the issue.
The issue is that current koan code manually passed a kernel + initrd for the PV guest to boot. That's the only install scenario for PV guests AFAICT. And this is only available via the virt-install in a version newer than what's in RHEL5.
That's also how the virt installs work for everything else in koan, including qemu/KVM.
(Maybe I'm misunderstanding something?)
The workaround could be to make PV installs work like qcreate install_location installs, which is basically the same as direct kernel/initrd boot but you rely on virt-install to pull the kernel/initrd from the install tree.
Just trying to make sure this wouldn't break anyone.
The install tree location isn't actually required in Cobbler, it's only a parameter to the kickstart … Are you saying we'd have to use the install tree method *only* for Xen PV? If so, that might be an acceptable limitation… if Xen FV or qemu/KVM requires the tree to find the kernel/initrd that seems bad to me, because we deal with a lot of arbitrary distros that express install tree locations in different ways.
ks_meta["tree"] gives you this if someone had ran "Cobbler import" previously.
If we can avoid using that when we don't have to, that would be good…
Since cobbler tracks this info it would probably 'just work' with a tiny patch but someone would need to test. And this has been supported on virt-install command line since probably rhel5.1
"it" == making autostart work for Xen PV, right?
Thanks, Cole
On 02/06/2012 12:34 PM, Michael DeHaan wrote:
On Monday, February 6, 2012 at 11:37 AM, Cole Robinson wrote:
On 02/06/2012 10:58 AM, Michael DeHaan wrote:
Cole --
What's the workaround to auto-start Xen PV's? (or is there not a way?)
Seems like we could just implement this however needed (if xenpv⊠do this insteadâŠ), if virtinstall won't do it for us.
The autostarting code could just be conditionally enabled if virt-install is new enough (just a grep of the help output) so that's not the issue.
The issue is that current koan code manually passed a kernel + initrd for the PV guest to boot. That's the only install scenario for PV guests AFAICT. And this is only available via the virt-install in a version newer than what's in RHEL5.
That's also how the virt installs work for everything else in koan, including qemu/KVM.
(Maybe I'm misunderstanding something?)
This is my understanding of the current code.
Xen FV: always does a PXE boot (so guest is actually talking to PXE server): https://github.com/cobbler/cobbler/blob/master/koan/xencreate.py#L80
Xen PV: Libvirt tells the guest to boot directly off the kernel/initrd pair specified in profile_data["kernel_local"] and profile_data["initrd_local"]: https://github.com/cobbler/cobbler/blob/master/koan/xencreate.py#L88
(are those kernel_local + initrd_local values filled in by cobbler or does the user need to manually specify them?)
QEMU/KVM has two install options:
if profile_data["file"] is present, boot off it like a cdrom: https://github.com/cobbler/cobbler/blob/master/koan/qcreate.py#L101
if profile_data["install_tree"] is present, pass the URL off to virtinst and have it use it's tree probing to fetch kernel + initrd: https://github.com/cobbler/cobbler/blob/master/koan/qcreate.py#L121
My implementation preserves this behavior, but in reality Xen FV and Qemu can all boot from tree/kernel, cdrom, and pxe. Xen pv can only boot from tree/kernel (which is the same thing basically).
My suggestion was to adapt xen pv to behave as qemu does with "install_tree".
The workaround could be to make PV installs work like qcreate install_location installs, which is basically the same as direct kernel/initrd boot but you rely on virt-install to pull the kernel/initrd from the install tree.
Just trying to make sure this wouldn't break anyone.
The install tree location isn't actually required in Cobbler, it's only a parameter to the kickstart ⊠Are you saying we'd have to use the install tree method *only* for Xen PV? If so, that might be an acceptable limitation⊠if Xen FV or qemu/KVM requires the tree to find the kernel/initrd that seems bad to me, because we deal with a lot of arbitrary distros that express install tree locations in different ways.
If you have a new enough virt-install, you can pass in arbitrary kernel/initrd path. However current koan has never done that for qcreate, it just passes the tree location off to virtinst.
In practice, virt-install actually knows how to pull kernel/initrd from fedora, rhel, opensuse, sles, debian, ubuntu, mandriva/mageia and we regularly validate this against a test suite so it's historically resilient. Of course virtinst and cobbler are duplicating functionality here but hopefully a lot of that will end up in libosinfo over time.
ks_meta["tree"] gives you this if someone had ran "Cobbler import" previously.
If we can avoid using that when we don't have to, that would be goodâŠ
Since cobbler tracks this info it would probably 'just work' with a tiny patch but someone would need to test. And this has been supported on virt-install command line since probably rhel5.1
"it" == making autostart work for Xen PV, right?
No, autostart is not the issue here. The issue is getting guests to actually install. The autostart piece is just recent functionality to cobbler that currently brok all installs on RHEL5 host. Fixing this would be a fairly trivial patch on top of current koan or my code.
The more interesting piece is making xen PV installs actually work on RHEL5 where virt-install is not new enough to provide the cli option needed to have parity with current xen PV installation, which requires passing a local kernel + initrd path to boot from.
Sorry if that isn't clear.
Thanks, Cole
On Mon, Feb 6, 2012 at 08:05, Michael DeHaan michael.dehaan@gmail.comwrote:
- RHEL5 virt-install doesn't have the --boot option. This is used to
install
xen PV guests. We could work around this by enabling install_location support for PV, which xen + virt-install have supported in RHEL5 forever. But not sure how that meshes with existing deployments getting a cobbler upgrade.
Hmm, who is using Xen PV out there? Speak up if you are.
I'm willing to shoot it.
still using it, but we can stay with our existing koan and just not upgrade
- RHEL5 virt-install doesn't had --disk driver_type= for qemu_driver_type
cobbler option. Not as big of a deal, users just can't specify that value on RHEL5.
I don't think Cobbler users ever specified anything other than the default.
But in that vein, currently all koan image/qemu/xen guest creation is broken on any RHEL5 since October, due to unconditional use of guest.set_autostart API which isn't in RHEL5.
That's interesting as it does seem to confirm that nobody is using it.
Which seems to align with my thoughts that:
(A) people don't upgrade too often (B) the field is still largely VMware :)
So, yeah
hrmph.. well i was about to upgrade to latest in epel (my production systems are on 2.0.11)
so is this working or broken in 2.2.1 ?
Hmm.
Another blasphemous thought might be to just shell out to the qemu and Xen command line tools directly if preserving these options are important.
Someone would have to do the legwork of making it though :)
On Monday, February 6, 2012 at 3:44 PM, Greg Swift wrote:
On Mon, Feb 6, 2012 at 08:05, Michael DeHaan <michael.dehaan@gmail.com (mailto:michael.dehaan@gmail.com)> wrote:
- RHEL5 virt-install doesn't have the --boot option. This is used to install
xen PV guests. We could work around this by enabling install_location support for PV, which xen + virt-install have supported in RHEL5 forever. But not sure how that meshes with existing deployments getting a cobbler upgrade.
Hmm, who is using Xen PV out there? Speak up if you are.
I'm willing to shoot it.
still using it, but we can stay with our existing koan and just not upgrade
- RHEL5 virt-install doesn't had --disk driver_type= for qemu_driver_type
cobbler option. Not as big of a deal, users just can't specify that value on RHEL5.
I don't think Cobbler users ever specified anything other than the default.
But in that vein, currently all koan image/qemu/xen guest creation is broken on any RHEL5 since October, due to unconditional use of guest.set_autostart API which isn't in RHEL5.
That's interesting as it does seem to confirm that nobody is using it.
Which seems to align with my thoughts that:
(A) people don't upgrade too often (B) the field is still largely VMware :)
So, yeah
hrmph.. well i was about to upgrade to latest in epel (my production systems are on 2.0.11)
so is this working or broken in 2.2.1 ?
cobbler mailing list cobbler@lists.fedorahosted.org (mailto:cobbler@lists.fedorahosted.org) https://fedorahosted.org/mailman/listinfo/cobbler
On 02/06/2012 03:46 PM, Michael DeHaan wrote:
Hmm.
Another blasphemous thought might be to just shell out to the qemu and Xen command line tools directly if preserving these options are important.
Someone would have to do the legwork of making it though :)
Well, like I said before, I'd be okay with changing the patch to preserve the original code if 'import virtinst' still works, and my new code would be how koan provisions libvirt VMs on fedora17 and newer. Presumably people on RHEL5 are updating cobbler but not virtinst, so they will be using the same old code paths.
This would also mean I have to worry less about regressing everyone's systems, and only regressing for people that are also upgrading their host to another major OS (say f16->f17)
However I would then recommend yall come up with a timetable of when to drop the old virtinst code for good, and make the virt-install impl the canonical way to provision libvirt guests, just to save yourself headaches. That would give you time to get out ample warnings, announce it loudly, etc.
- Cole
Let's do it now with this release.
Dual-maintaince of separate ways to do it leads to certain paths not being well tested, at it sounds like we already have that problem in some corners.
Folks with issues about what virt-install can't do can then take it up on the virt-install lists, and cobbler can just be (for virtualization) the adapter layer that instructs virt-install what to do (obviously keeping the reinstall and config stuff it does as well).
If bugs arise, we can fix them.
Make it so.
On Monday, February 6, 2012 at 3:51 PM, Cole Robinson wrote:
On 02/06/2012 03:46 PM, Michael DeHaan wrote:
Hmm.
Another blasphemous thought might be to just shell out to the qemu and Xen command line tools directly if preserving these options are important.
Someone would have to do the legwork of making it though :)
Well, like I said before, I'd be okay with changing the patch to preserve the original code if 'import virtinst' still works, and my new code would be how koan provisions libvirt VMs on fedora17 and newer. Presumably people on RHEL5 are updating cobbler but not virtinst, so they will be using the same old code paths.
This would also mean I have to worry less about regressing everyone's systems, and only regressing for people that are also upgrading their host to another major OS (say f16->f17)
However I would then recommend yall come up with a timetable of when to drop the old virtinst code for good, and make the virt-install impl the canonical way to provision libvirt guests, just to save yourself headaches. That would give you time to get out ample warnings, announce it loudly, etc.
- Cole
But in that vein, currently all koan image/qemu/xen guest creation is
broken on any RHEL5 since October, due to unconditional use of guest.set_autostart API which isn't in RHEL5.
That's interesting as it does seem to confirm that nobody is using it.
Which seems to align with my thoughts that:
(A) people don't upgrade too often (B) the field is still largely VMware :)
So, yeah
hrmph.. well i was about to upgrade to latest in epel (my production systems are on 2.0.11)
so is this working or broken in 2.2.1 ?
just saw André's post... (saying it works if you patch it)
On Mon, Feb 06, 2012 at 09:05:42AM -0500, Michael DeHaan wrote:
Hmm, who is using Xen PV out there? Speak up if you are.
I am. I discovered this discussion thread when I tried
koan --virt --virt-type=xenpv ...
and it failed with
'ParaVirtGuest' object has no attribute 'set_autostart'
However, I see Andre mentioned patching start_install() parameters in xencreate.py to get it working, so I can do that for the moment.
Alternatively, what is the last version of koan that could install Xen PV? Perhaps I can just roll back koan a couple of versions...
Regards, Msquared...
Hello,
Just upgraded from Cobbler 2.2.1-1 to 2.2.3-2 on RHEL58 x86_64, starting cobblerd service gave the following error message;
Starting cobbler daemon: No module named ctypes Traceback (most recent call last): File "/usr/bin/cobblerd", line 76, in main api = cobbler_api.BootAPI(is_cobblerd=True) File "/usr/lib/python2.4/site-packages/cobbler/api.py", line 127, in __init__ module_loader.load_modules() File "/usr/lib/python2.4/site-packages/cobbler/module_loader.py", line 62, in load_modules blip = __import__("modules.%s" % ( modname), globals(), locals(), [modname]) File "/usr/lib/python2.4/site-packages/cobbler/modules/authn_pam.py", line 53, in ? from ctypes import CDLL, POINTER, Structure, CFUNCTYPE, cast, pointer, sizeof ImportError: No module named ctypes
If found the following about it; https://fedorahosted.org/pipermail/cobbler/2012-January/007128.html
After installing the package python-ctypes, cobblerd service started fine. In the sandbox the same upgrade went fine, as this package was already installed some time ago (dependency of func/smolt package).
So, should the dependency list op the rpm of Cobbler 2.2.3-2 (and onwards) be updated with this package? # rpm -qpR cobbler-2.2.3-2.el5.noarch.rpm python >= 2.3 httpd tftp-server mod_wsgi createrepo python-cheetah python-netaddr python-simplejson python-urlgrabber PyYAML rsync mkisofs yum-utils /sbin/chkconfig /sbin/chkconfig /sbin/service /bin/sh /bin/sh /bin/sh rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1 #
I tried to find the EPEL package maintainer for the cobbler packages but had no luck.
Stefan
Informatie van de Raad voor de rechtspraak, de rechtbanken, de gerechtshoven en de bijzondere colleges vindt u op www.rechtspraak.nl.
On Thu, Jun 28, 2012 at 5:48 AM, Heijmans S (spir-it) Heijmans@rechtspraak.nl wrote:
So, should the dependency list op the rpm of Cobbler 2.2.3-2 (and onwards) be updated with this package? # rpm -qpR cobbler-2.2.3-2.el5.noarch.rpm python >= 2.3 httpd tftp-server mod_wsgi createrepo python-cheetah python-netaddr python-simplejson python-urlgrabber PyYAML rsync mkisofs yum-utils /sbin/chkconfig /sbin/chkconfig /sbin/service /bin/sh /bin/sh /bin/sh rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1 #
I tried to find the EPEL package maintainer for the cobbler packages but had no luck.
That would be me, and yes it should be included in the requirements - I was unaware that it was a separate package (it is not in Fedora, which is my primary development platform):
$ rpm -qa | grep ctypes $ python Python 2.7.3 (default, Apr 30 2012, 21:18:11) [GCC 4.7.0 20120416 (Red Hat 4.7.0-2)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import ctypes
So I'm guessing at some point they included this in the default python libraries, but if RHEL5.8 is still using python 2.4 it must not be included there. I'll get that fixed in the next release.
but if RHEL5.8 is still using python 2.4 it must not be included there
RHEL5.8 indeed uses python 2.4 # python Python 2.4.3 (#1, Dec 22 2011, 12:12:01) [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
I'll get that fixed in the next release.
Thanks
Stefan
-----Oorspronkelijk bericht----- Van: cobbler-bounces@lists.fedorahosted.org [mailto:cobbler-bounces@lists.fedorahosted.org] Namens James Cammarata Verzonden: donderdag 28 juni 2012 13:15 Aan: cobbler mailing list Onderwerp: Re: [cobbler] Cobbler 2.2.3-2 rpm missing dependency?
On Thu, Jun 28, 2012 at 5:48 AM, Heijmans S (spir-it) Heijmans@rechtspraak.nl wrote:
So, should the dependency list op the rpm of Cobbler 2.2.3-2 (and onwards) be updated with this package? # rpm -qpR cobbler-2.2.3-2.el5.noarch.rpm python >= 2.3 httpd tftp-server mod_wsgi createrepo python-cheetah python-netaddr python-simplejson python-urlgrabber PyYAML rsync mkisofs yum-utils /sbin/chkconfig /sbin/chkconfig /sbin/service /bin/sh /bin/sh /bin/sh rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1 #
I tried to find the EPEL package maintainer for the cobbler packages but had no luck.
That would be me, and yes it should be included in the requirements - I was unaware that it was a separate package (it is not in Fedora, which is my primary development platform):
$ rpm -qa | grep ctypes $ python Python 2.7.3 (default, Apr 30 2012, 21:18:11) [GCC 4.7.0 20120416 (Red Hat 4.7.0-2)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import ctypes
So I'm guessing at some point they included this in the default python libraries, but if RHEL5.8 is still using python 2.4 it must not be included there. I'll get that fixed in the next release. _______________________________________________ cobbler mailing list cobbler@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/cobbler
Informatie van de Raad voor de rechtspraak, de rechtbanken, de gerechtshoven en de bijzondere colleges vindt u op www.rechtspraak.nl.
On Thu, Jun 28, 2012 at 3:31 AM, Msquared 1.cobbler@msquared.id.au wrote:
On Mon, Feb 06, 2012 at 09:05:42AM -0500, Michael DeHaan wrote:
Hmm, who is using Xen PV out there? Speak up if you are.
I am. I discovered this discussion thread when I tried
koan --virt --virt-type=xenpv ...
and it failed with
'ParaVirtGuest' object has no attribute 'set_autostart'
However, I see Andre mentioned patching start_install() parameters in xencreate.py to get it working, so I can do that for the moment.
Alternatively, what is the last version of koan that could install Xen PV? Perhaps I can just roll back koan a couple of versions...
There are no current plans to remove that, it is still in the current version.
Apparently with using virt-install, it no longer passes in the kickstart boot option, which is a pretty serious regression. My install attempt:
koan -v --virt-type=qemu --qemu-disk-type=virtio --qemu-net-type=virtio --virt-bridge=br0 --system=vmsl6rolling
generated:
- ['virt-install', '--connect', 'qemu:///system', '--name', 'vmsl6rolling', '--ram', '512', '--vcpus', '1', '--autostart', '--vnc', '--virt-type', 'qemu', '--hvm', '--location', 'http://sl.cora.nwra.com/6rolling/x86_64/os/', '--arch', 'x86_64', '--os-variant', 'rhel6', '--disk', 'path=/dev/mapper/vg_root-vmsl6rolling--disk0,size=10,bus=virtio,driver_type=raw', '--network', 'bridge=br0,model=virtio,mac=00:16:3e:63:1b:e1', '--wait', '0', '--noautoconsole']
and so no kickstart. Is this a known issue? It should pass:
--extra-args="ks=http://cobbler.cora.nwra.com/cblr/svc/op/ks/system/vmsl6rolling ksdevice=link kssendmac text"
On Wed, Jul 11, 2012 at 3:59 PM, Orion Poplawski orion@cora.nwra.com wrote:
Apparently with using virt-install, it no longer passes in the kickstart boot option, which is a pretty serious regression. My install attempt:
koan -v --virt-type=qemu --qemu-disk-type=virtio --qemu-net-type=virtio --virt-bridge=br0 --system=vmsl6rolling
generated:
- ['virt-install', '--connect', 'qemu:///system', '--name', 'vmsl6rolling',
'--ram', '512', '--vcpus', '1', '--autostart', '--vnc', '--virt-type', 'qemu', '--hvm', '--location', 'http://sl.cora.nwra.com/6rolling/x86_64/os/', '--arch', 'x86_64', '--os-variant', 'rhel6', '--disk', 'path=/dev/mapper/vg_root-vmsl6rolling--disk0,size=10,bus=virtio,driver_type=raw', '--network', 'bridge=br0,model=virtio,mac=00:16:3e:63:1b:e1', '--wait', '0', '--noautoconsole']
and so no kickstart. Is this a known issue? It should pass:
--extra-args="ks=http://cobbler.cora.nwra.com/cblr/svc/op/ks/system/vmsl6rolling ksdevice=link kssendmac text"
Can you try --virt-type=kvm? That's a new type introduced recently so that it will use kernel accelerated qemu. Another user ran into this and changing the type to kvm fixed it (and made his vm's run faster too).
There is a definite bug in koan for qemu types right now that appears to have slipped in with this patch.
On 07/11/2012 03:12 PM, James Cammarata wrote:
On Wed, Jul 11, 2012 at 3:59 PM, Orion Poplawski orion@cora.nwra.com wrote:
Apparently with using virt-install, it no longer passes in the kickstart boot option, which is a pretty serious regression. My install attempt:
koan -v --virt-type=qemu --qemu-disk-type=virtio --qemu-net-type=virtio --virt-bridge=br0 --system=vmsl6rolling
generated:
- ['virt-install', '--connect', 'qemu:///system', '--name', 'vmsl6rolling',
'--ram', '512', '--vcpus', '1', '--autostart', '--vnc', '--virt-type', 'qemu', '--hvm', '--location', 'http://sl.cora.nwra.com/6rolling/x86_64/os/', '--arch', 'x86_64', '--os-variant', 'rhel6', '--disk', 'path=/dev/mapper/vg_root-vmsl6rolling--disk0,size=10,bus=virtio,driver_type=raw', '--network', 'bridge=br0,model=virtio,mac=00:16:3e:63:1b:e1', '--wait', '0', '--noautoconsole']
and so no kickstart. Is this a known issue? It should pass:
--extra-args="ks=http://cobbler.cora.nwra.com/cblr/svc/op/ks/system/vmsl6rolling ksdevice=link kssendmac text"
Can you try --virt-type=kvm? That's a new type introduced recently so that it will use kernel accelerated qemu. Another user ran into this and changing the type to kvm fixed it (and made his vm's run faster too).
There is a definite bug in koan for qemu types right now that appears to have slipped in with this patch.
Okay, with --virt-type=kvm the --extra-args are passed. Didn't change much with the libvirt definitions (both were using kvm) except for:
<disk type='block' device='disk'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='raw' cache='none' io='native'/>
But it looks like that should be a win.
Okay, with --virt-type=kvm the --extra-args are passed. Didn't change much with the libvirt definitions (both were using kvm) except for:
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<driver name='qemu' type='raw' cache='none' io='native'/>
But it looks like that should be a win.
Yep, kvm should be the preferred option. I'll work on fixing the bug for those that need good old qemu though.
Hi Msquared,
I'm surprised by that. It should be fixed afaik. Which version are you using?
Greetings André
----- Ursprüngliche Mail -----
On Mon, Feb 06, 2012 at 09:05:42AM -0500, Michael DeHaan wrote:
Hmm, who is using Xen PV out there? Speak up if you are.
I am. I discovered this discussion thread when I tried
koan --virt --virt-type=xenpv ...
and it failed with
'ParaVirtGuest' object has no attribute 'set_autostart'
However, I see Andre mentioned patching start_install() parameters in xencreate.py to get it working, so I can do that for the moment.
Alternatively, what is the last version of koan that could install Xen PV? Perhaps I can just roll back koan a couple of versions...
Regards, Msquared...
cobbler@lists.fedorahosted.org