def __init__(self, **kargs): self.conn = kargs['conn'] self.objstore = kargs['objstore'] self.scanner = Scanner(self._clean_scan) self.scanner.delete() self.caps = CapabilitiesModel(**kargs) self.device = DeviceModel(**kargs)
def __init__(self, **kargs): self.conn = kargs['conn'] self.objstore = kargs['objstore'] self.caps = CapabilitiesModel() self.guests_stats_thread = BackgroundTask(GUESTS_STATS_INTERVAL, self._update_guests_stats) self.guests_stats_thread.start()
def __init__(self, **kargs): self.conn = kargs['conn'] self.objstore = kargs['objstore'] self.scanner = Scanner(self._clean_scan) self.scanner.delete() self.caps = CapabilitiesModel(**kargs) self.device = DeviceModel(**kargs) if self.conn.isQemuURI(): self._check_default_pools()
def get_metadata_node(dom, tag, mode="current"): if CapabilitiesModel().metadata_support: kimchi = libvirt_get_kimchi_metadata_node(dom, mode) else: # FIXME remove this code when all distro libvirt supports metadata element kimchi = _kimchi_get_metadata_node(dom, tag) if kimchi is not None: node = kimchi.find(tag) if node is not None: return etree.tostring(node) return ""
def _get_devices_fc_host(self): conn = self.conn.get() # Libvirt < 1.0.5 does not support fc_host capability if not CapabilitiesModel().fc_host_support: ret = [] scsi_hosts = conn.listDevices('scsi_host', 0) for host in scsi_hosts: xml = conn.nodeDeviceLookupByName(host).XMLDesc(0) path = '/device/capability/capability/@type' if 'fc_host' in xmlutils.xpath_get_text(xml, path): ret.append(host) return ret return conn.listDevices('fc_host', 0)
def __init__(self, **kargs): self.conn = kargs['conn'] self.objstore = kargs['objstore'] self.caps = CapabilitiesModel(**kargs) self.vmscreenshot = VMScreenshotModel(**kargs) self.users = import_class('kimchi.model.users.UsersModel')(**kargs) self.groups = import_class('kimchi.model.groups.GroupsModel')(**kargs) self.vms = VMsModel(**kargs) self.task = TaskModel(**kargs) self.storagepool = model.storagepools.StoragePoolModel(**kargs) self.storagevolume = model.storagevolumes.StorageVolumeModel(**kargs) self.storagevolumes = model.storagevolumes.StorageVolumesModel(**kargs) cls = import_class('kimchi.model.vmsnapshots.VMSnapshotModel') self.vmsnapshot = cls(**kargs) cls = import_class('kimchi.model.vmsnapshots.VMSnapshotsModel') self.vmsnapshots = cls(**kargs)
def set_metadata_node(dom, node, mode="all"): if CapabilitiesModel().metadata_support: kimchi = libvirt_get_kimchi_metadata_node(dom, mode) kimchi = E.kimchi() if kimchi is None else kimchi update_node(kimchi, node) kimchi_xml = etree.tostring(kimchi) # From libvirt doc, Passing None for @metadata says to remove that # element from the domain XML (passing the empty string leaves the # element present). Do not support remove the old metadata. dom.setMetadata(libvirt.VIR_DOMAIN_METADATA_ELEMENT, kimchi_xml, KIMCHI_NAMESPACE, KIMCHI_META_URL, flags=get_vm_config_flag(dom, mode)) else: # FIXME remove this code when all distro libvirt supports metadata element _kimchi_set_metadata_node(dom, node)
def __init__(self, **kargs): self.conn = kargs['conn'] self.caps = CapabilitiesModel(**kargs) self.cap_map = \ {'net': libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_NET, 'pci': libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV, 'scsi': libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI, 'scsi_host': libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_HOST, 'storage': libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_STORAGE, 'usb_device': libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV, 'usb': libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_INTERFACE} # TODO: when no longer supporting Libvirt < 1.0.5 distros # (like RHEL6) remove this verification and insert the # key 'fc_host' with the libvirt variable in the hash # declaration above. try: self.cap_map['fc_host'] = \ libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST except AttributeError: self.cap_map['fc_host'] = None
def __init__(self, **kargs): self.conn = kargs['conn'] self.caps = CapabilitiesModel(**kargs)