Example #1
0
def initvm(image,
           name=None,
           multi=False,
           ramsize=None,
           vramsize=None,
           cpus=None):
    handlers = {
        "winxp": WindowsXP,
        "win7x86": Windows7x86,
        "win7x64": Windows7x64,
        "win81x86": Windows81x86,
        "win81x64": Windows81x64,
        "win10x86": Windows10x86,
        "win10x64": Windows10x64,
    }

    h = handlers[image.osversion]
    m = None

    if image.vm == "virtualbox":
        m = VirtualBox(name=name or image.name)
        m.create_vm()
        m.os_type(image.osversion)
        m.cpus(cpus or image.cpus)
        m.mouse("usbtablet")
        m.ramsize(ramsize or image.ramsize)
        m.vramsize(vramsize or image.vramsize)
        m.attach_hd(image.path, multi=multi)
        # Ensure the slot is at least allocated for by an empty drive.
        m.detach_iso()
        m.hostonly(nictype=h.nictype, adapter=image.adapter)

    return m, h
Example #2
0
def initvm(image, name=None, multi=False, ramsize=None, vramsize=None, cpus=None):
    handlers = {
        "winxp": WindowsXP,
        "win7x86": Windows7x86,
        "win7x64": Windows7x64,
        "win81x86": Windows81x86,
        "win81x64": Windows81x64,
        "win10x86": Windows10x86,
        "win10x64": Windows10x64,
    }

    h = handlers[image.osversion]
    m = None

    if image.vm == "virtualbox":
        m = VirtualBox(name=name or image.name)
        m.create_vm()
        m.os_type(image.osversion)
        m.cpus(cpus or image.cpus)
        m.mouse("usbtablet")
        m.ramsize(ramsize or image.ramsize)
        m.vramsize(vramsize or image.vramsize)
        m.attach_hd(image.path, multi=multi)
        # Ensure the slot is at least allocated for by an empty drive.
        m.detach_iso()
        m.hostonly(nictype=h.nictype, adapter=image.adapter)

    return m, h