def get_basic_fullyvirt_guest(typ="xen", installer=None): g = virtinst.Guest(_conn) g.type = typ g.name = "TestGuest" g.memory = int(200 * 1024) g.maxmemory = int(400 * 1024) g.uuid = "12345678-1234-1234-1234-123456789012" g.installer.location = "/dev/null" g.installer.cdrom = True gdev = VirtualGraphics(_conn) gdev.type = "sdl" gdev.display = ":3.4" gdev.xauth = "/tmp/.Xauthority" g.add_device(gdev) g.features.pae = False g.vcpus = 5 if installer: g.installer = installer g.emulator = "/usr/lib/xen/bin/qemu-dm" g.os.arch = "i686" g.os.os_type = "hvm" g.add_default_input_device() g.add_default_console_device() return g
def get_basic_fullyvirt_guest(typ="xen", installer=None): g = virtinst.Guest(_conn) g.type = typ g.name = "TestGuest" g.memory = int(200 * 1024) g.maxmemory = int(400 * 1024) g.uuid = "12345678-1234-1234-1234-123456789012" g.installer.location = "/dev/null" g.installer.cdrom = True gdev = VirtualGraphics(_conn) gdev.type = "vnc" gdev.keymap = "ja" g.add_device(gdev) g.features.pae = False g.vcpus = 5 if installer: g.installer = installer g.emulator = "/usr/lib/xen/bin/qemu-dm" g.os.arch = "i686" g.os.os_type = "hvm" g.add_default_input_device() g.add_default_console_device() return g
def get_graphics(vnc, vncport, vnclisten, nographics, sdl, keymap, video_models, guest): video_models = video_models or [] if ((vnc and nographics) or (vnc and sdl) or (sdl and nographics)): raise ValueError, _("Can't specify more than one of VNC, SDL, " "or --nographics") for model in video_models: dev = virtinst.VirtualVideoDevice(guest.conn) dev.model_type = model guest.add_device(dev) if not (vnc or nographics or sdl): if "DISPLAY" in os.environ.keys(): logging.debug("DISPLAY is set: graphics defaulting to VNC.") vnc = True else: logging.debug("DISPLAY is not set: defaulting to nographics.") nographics = True if nographics is not None: guest.graphics_dev = None return # After this point, we are using graphics, so add a video device # if one wasn't passed if not video_models: guest.add_device(VirtualVideoDevice(conn=guest.conn)) if sdl is not None: guest.graphics_dev = VirtualGraphics(type=VirtualGraphics.TYPE_SDL) return if vnc is not None: guest.graphics_dev = VirtualGraphics(type=VirtualGraphics.TYPE_VNC) if vncport: guest.graphics_dev.port = vncport if vnclisten: guest.graphics_dev.listen = vnclisten if keymap: use_keymap = None if keymap.lower() == "local": use_keymap = virtinst.VirtualGraphics.KEYMAP_LOCAL elif keymap.lower() != "none": use_keymap = _util.check_keytable(keymap) if not use_keymap: raise ValueError(_("Didn't match keymap '%s' in keytable!") % keymap) guest.graphics_dev.keymap = use_keymap
def get_basic_paravirt_guest(installer=None): g = virtinst.Guest(_conn) g.type = "xen" g.name = "TestGuest" g.memory = int(200 * 1024) g.maxmemory = int(400 * 1024) g.uuid = "12345678-1234-1234-1234-123456789012" gdev = VirtualGraphics(_conn) gdev.type = "vnc" gdev.keymap = "ja" g.add_device(gdev) g.vcpus = 5 if installer: g.installer = installer else: g.installer._install_kernel = "/boot/vmlinuz" g.installer._install_initrd = "/boot/initrd" g.add_default_input_device() g.add_default_console_device() return g
def get_basic_fullyvirt_guest(typ="xen", installer=None): g = virtinst.Guest(conn=_conn, type=typ) g.name = "TestGuest" g.memory = int(200) g.maxmemory = int(400) g.uuid = "12345678-1234-1234-1234-123456789012" g.cdrom = "/dev/loop0" g.add_device(VirtualGraphics("sdl")) g.features['pae'] = 0 g.vcpus = 5 if installer: g.installer = installer g.emulator = "/usr/lib/xen/bin/qemu-dm" g.installer.arch = "i686" g.installer.os_type = "hvm" g.installer._scratchdir = scratch return g
def get_basic_paravirt_guest(installer=None): g = virtinst.Guest(conn=_conn, type="xen") g.name = "TestGuest" g.memory = int(200) g.maxmemory = int(400) g.uuid = "12345678-1234-1234-1234-123456789012" g.add_device(VirtualGraphics("vnc", keymap="ja")) g.vcpus = 5 if installer: g.installer = installer else: instboot = getattr(g.installer, "_install_bootconfig") instboot.kernel = "/boot/vmlinuz" instboot.initrd = "/boot/initrd" g.installer._scratchdir = scratch return g