#!/usr/bin/env python # coding: utf8 from lxml import etree from lxml import objectify from libvirt import * HVM_XEN = 'xen' HVM_KVM = 'kvm' HVM_KQEMU = 'kqemu' HVM_QEMU = 'qemu' HVM_LXC = 'lxc' HVM_OPENVZ = 'openvz' HVM_TEST = 'test' CLOCK_LOCALTIME = 'localtime' CLOCK_UTC = 'utc' TERMINATION_ACTION_DESTROY = 'destroy' TERMINATION_ACTION_RESTART = 'restart' TERMINATION_ACTION_PRESERVE = 'preserve' TERMINATION_ACTION_RENAME_RESTART = 'rename-restart' class SdlGraphics: self.type = 'sdl' self.display = ':0' self.xauth = None self.fullscreen = 'yes' class VncGraphics: self.type = 'vnc' self.port = '-1' self.listen = '0.0.0.0' self.passwd = None self.keymap = None class RdpGraphics: self.type = 'rdp' self.port = '-1' self.listen = '0.0.0.0' self.multiUser = False self.replaceUser = False class DesktopGraphics: self.type = 'desktop' self.display = ':0' self.xauth = None self.fullscreen = 'yes' DISK_TYPE_DISK = 'disk' DISK_TYPE_CDROM = 'cdrom' DISK_TYPE_FLOPPY = 'floppy' DISK_BUS_IDE = 'ide' DISK_BUS_SCSI = 'scsi' DISK_BUS_VIRTIO = 'virtio' DISK_BUS_XEN = 'xen' DISK_BUS_USB = 'usb' class Disk: self.device = DISK_TYPE_DISK self.targetDev = None self.targetBus = DISK_BUS_IDE self.shareable = False class FileDisk(Disk): self.sourceType = 'file' self.sourceFile = None class BlockDisk(Disk): self.sourceType = 'block' self.sourceDev = None class PciHostDevice: self.bus = None self.slot = None self.function = None self.domain = None class UsbHostDevice: self.vendor = None self.product = None self.bus = None self.device = None class Domain: self.name = None #domain/name self.uuid = None #domain/uuid self.description = None #domain/description self.hvs = HVM_KVM #domain.type self.os = None # self.clock = CLOCK_LOCALTIME #domain/clock.offset self.memory = 128 #domain/memory self.useHugePages = False #domain/memoryBacking/hugepages self.currentMemory = 128 #domain/currentMemory self.vcpus = 1 #domain/vcpu self.poweroffAction = None #domain/on_poweroff self.rebootAction = None #domain/on_reboot self.crashAction = None #domain/on_crash self.features = [] #domain/features self.emulator = None #domain/devices/emulator self.videoCardModel = None #domain/devices/video/model.type self.videoCardVram = None #domain/devices/video/model.vram self.graphics = [] #domain/devices/graphics self.disks = [] #domain/devices/disk self.interfaces = [] #domain/devices/interface self.hostDevices = [] #domain/devices/hostdev