Exemplo n.º 1
0
 def make_floppy(self):
     """Writes a Grub boot floppy.
     Returns 0 if it was successful.
     Returns 1 if there was an OSError
     returns a code < 0 or > 1 for other errors
     """
     return utils.make_floppy(self.grub_install_command, self.menu)
Exemplo n.º 2
0
 def make_floppy(self):
     """Writes a Grub boot floppy.
     Returns 0 if it was successful.
     Returns 1 if there was an OSError
     returns a code < 0 or > 1 for other errors
     """
     return utils.make_floppy(self.grub_install_command, self.menu)
Exemplo n.º 3
0
def build_commandline(uri,
                      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,
                      qemu_machine_type=None):

    # Set flags for CLI arguments based on the virtinst_version
    # tuple above. Older versions of python-virtinst don't have
    # a version easily accessible, so it will be None and we can
    # easily disable features based on that (RHEL5 and older usually)

    disable_autostart = False
    disable_virt_type = False
    disable_boot_opt = False
    disable_driver_type = False
    disable_net_model = False
    disable_machine_type = False
    oldstyle_macs = False
    oldstyle_accelerate = False

    if not virtinst_version:
        print ("- warning: old python-virtinst detected, a lot of features will be disabled")
        disable_autostart = True
        disable_boot_opt = True
        disable_virt_type = True
        disable_driver_type = True
        disable_net_model = True
        disable_machine_type = True
        oldstyle_macs = True
        oldstyle_accelerate = True

    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:
        if virt_type != "kvm":
            fullvirt = True
        else:
            fullvirt = None

    floppy = None
    cdrom = None
    location = None
    importpath = None

    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")

        # 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"),
                          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?

        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")
    if os_version and breed == "ubuntu":
        os_version = "ubuntu%s" % os_version
    if os_version and breed == "debian":
        os_version = "debian%s" % os_version

    net_model = None
    disk_bus = None
    machine_type = None

    if is_qemu:
        net_model = qemu_net_type
        disk_bus = qemu_driver_type
        machine_type = qemu_machine_type

    if machine_type is None:
        machine_type = "pc"

    cmd = "virt-install "
    if uri:
        cmd += "--connect %s " % uri

    cmd += "--name %s " % name
    cmd += "--ram %s " % ram
    cmd += "--vcpus %s " % vcpus

    if uuid:
        cmd += "--uuid %s " % uuid

    if virt_auto_boot and not disable_autostart:
        cmd += "--autostart "

    if no_gfx:
        cmd += "--nographics "
    else:
        cmd += "--vnc "

    if is_qemu and virt_type:
        if not disable_virt_type:
            cmd += "--virt-type %s " % virt_type

    if is_qemu and machine_type and not disable_machine_type:
        cmd += "--machine %s " % machine_type

    if fullvirt or is_qemu or is_import:
        if fullvirt is not None:
            cmd += "--hvm "
        elif oldstyle_accelerate:
            cmd += "--accelerate "

        if is_qemu and extra:
            cmd += ("--extra-args=\"%s\" " % (extra))

        if is_xen:
            cmd += "--pxe "

        elif cdrom:
            cmd += "--cdrom %s " % cdrom
        elif location:
            cmd += "--location %s " % location
        elif importpath:
            cmd += "--import "

        if arch:
            cmd += "--arch %s " % arch
    else:
        cmd += "--paravirt "
        if not disable_boot_opt:
            cmd += ("--boot kernel=%s,initrd=%s,kernel_args=\"%s\" " %
                    (kernel, initrd, extra))
        else:
            cmd += ("--location %s --extra-args=\"%s\" " % 
                    (location,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

    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))
        cmd += "--disk path=%s" % (path)
        if str(size) != "0":
            cmd += ",size=%s" % size
        if disk_bus:
            cmd += ",bus=%s" % disk_bus
        if driver_type and not disable_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 net_model and not disable_net_model:
            cmd += ",model=%s" % net_model
        if mac:
            if oldstyle_macs:
                cmd += " --mac=%s" % mac
            else:
                cmd += ",mac=%s" % mac
        cmd += " "

    cmd += "--wait 0 "
    cmd += "--noautoconsole "

    return shlex.split(cmd.strip())
Exemplo n.º 4
0
def build_commandline(uri,
                      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,
                      qemu_machine_type=None):

    # Set flags for CLI arguments based on the virtinst_version
    # tuple above. Older versions of python-virtinst don't have
    # a version easily accessible, so it will be None and we can
    # easily disable features based on that (RHEL5 and older usually)

    disable_autostart = False
    disable_virt_type = False
    disable_driver_type = False
    disable_net_model = False
    oldstyle_macs = False

    if not virtinst_version:
        print(
            "- warning: old python-virtinst detected, a lot of features will be disabled"
        )
        disable_autostart = True
        disable_virt_type = True
        disable_driver_type = True
        disable_net_model = True
        oldstyle_macs = True

    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:
        if virt_type != "kvm":
            fullvirt = True
        else:
            fullvirt = None

    floppy = None
    cdrom = None
    location = None
    importpath = None

    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")

        # 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"), 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?

        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")
    if os_version and breed == "ubuntu":
        os_version = "ubuntu%s" % os_version
    if os_version and breed == "debian":
        os_version = "debian%s" % os_version

    net_model = None
    disk_bus = None
    machine_type = None

    if is_qemu:
        net_model = qemu_net_type
        disk_bus = qemu_driver_type
        machine_type = qemu_machine_type

    if machine_type is None:
        machine_type = "pc"

    cmd = "virt-install "
    if uri:
        cmd += "--connect %s " % uri

    cmd += "--name %s " % name
    cmd += "--ram %s " % ram
    cmd += "--vcpus %s " % vcpus

    if uuid:
        cmd += "--uuid %s " % uuid

    if virt_auto_boot and not disable_autostart:
        cmd += "--autostart "

    if no_gfx:
        cmd += "--nographics "
    else:
        cmd += "--vnc "

    if is_qemu and virt_type:
        if not disable_virt_type:
            cmd += "--virt-type %s " % virt_type

    if is_qemu and machine_type:
        cmd += "--machine %s " % machine_type

    if fullvirt or is_qemu or is_import:
        if fullvirt is not None:
            cmd += "--hvm "

        if is_qemu and extra:
            cmd += ("--extra-args=\"%s\" " % (extra))

        if is_xen:
            cmd += "--pxe "

        elif cdrom:
            cmd += "--cdrom %s " % cdrom
        elif location:
            cmd += "--location %s " % location
        elif importpath:
            cmd += "--import "

        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

    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))
        cmd += "--disk path=%s" % (path)
        if str(size) != "0":
            cmd += ",size=%s" % size
        if disk_bus:
            cmd += ",bus=%s" % disk_bus
        if driver_type and not disable_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 net_model and not disable_net_model:
            cmd += ",model=%s" % net_model
        if mac:
            if oldstyle_macs:
                cmd += " --mac=%s" % mac
            else:
                cmd += ",mac=%s" % mac
        cmd += " "

    cmd += "--wait 0 "
    cmd += "--noautoconsole "

    return shlex.split(cmd.strip())
Exemplo n.º 5
0
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):

    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"]
        if not input_path.startswith("nfs://"):
            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("&","&amp;") 
    guest.extraargs = extra

    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)
    # 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" % (d[0], d[1])
        if d[1] != 0 or d[0].startswith("/dev"):
            guest.disks.append(virtinst.VirtualDisk(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")

    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["bonding"] == "master" 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)
            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)
            guest.nics.append(nic_obj)

    guest.start_install()

    return "use virt-manager and connect to qemu to manage guest: %s" % name
Exemplo n.º 6
0
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("&", "&amp;")
    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