def __init__(self, uuid, record): XendBase.__init__(self, uuid, record) v_hctl = self.virtual_HCTL.split(':') self.virtual_host = int(v_hctl[0]) self.virtual_channel = int(v_hctl[1]) self.virtual_target = int(v_hctl[2]) self.virtual_lun = int(v_hctl[3])
def __init__(self, record, uuid): # This is a read-only attr, so we need to # set it here, as super class won't try to if record.has_key("managed"): self.managed = record["managed"] else: self.managed = True XendBase.__init__(self, uuid, record)
def destroy(self): """ In order to destroy a cpu pool, it must be deactivated """ self.pool_lock.acquire() try: if self.get_activated(): raise PoolError(XEND_ERROR_BAD_POOL_STATE, 'activated') XendBase.destroy(self) finally: self.pool_lock.release() XendNode.instance().save_cpu_pools()
def __init__(self, uuid, record): XendBase.__init__(self, uuid, record) self.virtual_domain = -1 self.virtual_bus = -1 self.virtual_slot = -1 self.virtual_func = -1 self.VM = record['VM'] self.PPCI = record['PPCI'] self.hotplug_slot = record['hotplug_slot']
def destroy(self): # check no VIFs or PIFs attached if len(self.get_VIFs()) > 0: raise NetworkError("Cannot destroy network with VIFs attached", self.get_name_label()) if len(self.get_PIFs()) > 0: raise NetworkError("Cannot destroy network with PIFs attached", self.get_name_label()) XendBase.destroy(self) Brctl.bridge_del(self.get_name_label()) XendNode.instance().save_networks()
def __init__(self, uuid, record): XendBase.__init__(self, uuid, record) self.virtual_domain = -1 self.virtual_bus = -1 self.virtual_slot = -1 self.virtual_func = -1 self.VM = record['VM'] self.PPCI = record['PPCI'] self.hotplug_slot = record['hotplug_slot'] if 'options' in record.keys(): self.options = record['options']
def destroy(self): # Figure out if this is a physical device if self.get_interface_name() == \ self.get_device(): raise PIFIsPhysical() self.unplug() if _destroy_VLAN(self.get_device(), self.get_VLAN()): XendBase.destroy(self) import XendNode XendNode.instance().save_PIFs() else: raise NetworkError("Unable to delete VLAN", self.get_uuid())
def __init__(self, uuid, record): XendBase.__init__(self, uuid, record) self.virtual_domain = -1 self.virtual_bus = -1 self.virtual_slot = -1 self.virtual_func = -1 self.VM = record['VM'] self.PPCI = record['PPCI'] self.hotplug_slot = int(record['hotplug_slot'], 16) self.key = record['key'] if 'options' in record.keys(): self.options = record['options']
def getAttrRO(self): attrRO = [ 'VM', 'PSCSI', 'HBA', 'virtual_host', 'virtual_channel', 'virtual_target', 'virtual_lun', 'virtual_HCTL', 'runtime_properties' ] return XendBase.getAttrRO() + attrRO
def getAttrRO(self): attrRO = ['network', 'host', 'metrics', 'device', 'VLAN'] return XendBase.getAttrRO() + attrRO
def getAttrRO(self): attrRO = [ 'memory_actual', 'VCPUs_number', 'VCPUs_utilisation', 'VCPUs_CPU', 'VCPUs_flags', 'VCPUs_params', 'state', 'start_time', 'last_updated' ] return XendBase.getAttrRO() + attrRO
def getAttrRO(cls): attrRO = ['resident_on', 'started_VMs', 'host_CPUs', 'activated', ] return XendBase.getAttrRO() + attrRO
def getAttrRO(self): attrRO = ['VM', 'PSCSI_HBAs', 'DSCSIs', 'virtual_host', 'assignment_mode'] return XendBase.getAttrRO() + attrRO
def getFuncs(self): funcs = [ 'get_xstype', 'set_xspolicy', 'reset_xspolicy', 'get_xspolicy', 'rm_xsbootpolicy', 'get_resource_label', 'set_resource_label', 'get_labeled_resources' ] return XendBase.getFuncs() + funcs
def getAttrRW(self): attrRW = ['name_label', 'name_description', 'other_config', 'default_gateway', 'default_netmask'] return XendBase.getAttrRW() + attrRW
def getAttrRO(self): attrRO = [ 'host', 'domain', 'bus', 'slot', 'func', 'name', 'vendor_id', 'vendor_name', 'device_id', 'device_name', 'revision_id', 'class_code', 'class_name', 'subsystem_vendor_id', 'subsystem_vendor_name', 'subsystem_id', 'subsystem_name', 'driver' ] return XendBase.getAttrRO() + attrRO
def getAttrRO(self): attrRO = [ 'host', 'physical_host', 'physical_channel', 'physical_target', 'physical_lun', 'physical_HCTL', 'HBA', 'vendor_name', 'model', 'type_id', 'type', 'dev_name', 'sg_name', 'revision', 'scsi_id', 'scsi_level' ] return XendBase.getAttrRO() + attrRO
def getAttrRO(cls): attrRO = [ 'resident_on', 'started_VMs', 'host_CPUs', 'activated', ] return XendBase.getAttrRO() + attrRO
def __init__(self, uuid, record): self.domain = record['domain'] self.bus = record['bus'] self.slot = record['slot'] self.func = record['func'] self.vendor_id = record['vendor_id'] self.vendor_name = record['vendor_name'] self.device_id = record['device_id'] self.device_name = record['device_name'] self.revision_id = record['revision_id'] self.class_code = record['class_code'] self.class_name = record['class_name'] self.subsystem_vendor_id = record['subsystem_vendor_id'] self.subsystem_vendor_name = record['subsystem_vendor_name'] self.subsystem_id = record['subsystem_id'] self.subsystem_name = record['subsystem_name'] self.driver = record['driver'] XendBase.__init__(self, uuid, record)
def getAttrRO(self): attrRO = ['virtual_domain', 'virtual_bus', 'virtual_slot', 'virtual_func', 'virtual_name', 'VM', 'PPCI', 'hotplug_slot'] return XendBase.getAttrRO() + attrRO
def __init__(self, uuid, record): self.physical_HCTL = record['physical_HCTL'] self.vendor_name = record['vendor_name'] self.model = record['model'] self.type_id = record['type_id'] self.type = record['type'] self.dev_name = record['dev_name'] self.sg_name = record['sg_name'] self.revision = record['revision'] self.scsi_id = record['scsi_id'] self.scsi_level = record['scsi_level'] p_hctl = self.physical_HCTL.split(':') self.physical_host = int(p_hctl[0]) self.physical_channel = int(p_hctl[1]) self.physical_target = int(p_hctl[2]) self.physical_lun = int(p_hctl[3]) XendBase.__init__(self, uuid, record)
def getAttrRW(cls): attrRW = ['name_label', 'name_description', 'auto_power_on', 'ncpu', 'sched_policy', 'proposed_CPUs', 'other_config', ] return XendBase.getAttrRW() + attrRW
def __init__(self, record, new_uuid, managed_pool=True): XendBase.__init__(self, new_uuid, record) try: self._managed = managed_pool self.name_label = None name = record.get('name_label', 'Pool-Unnamed') self._checkName(name) self.name_label = name self.name_description = record.get('name_description', self.name_label) self.proposed_cpus = [ int(cpu) for cpu in record.get('proposed_CPUs', []) ] self.auto_power_on = bool(record.get('auto_power_on', False)) self.ncpu = int(record.get('ncpu', 1)) self.sched_policy = record.get('sched_policy', '') self.other_config = record.get('other_config', {}) except Exception, ex: XendBase.destroy(self) raise ex
def getAttrRO(self): attrRO = ['virtual_domain', 'virtual_bus', 'virtual_slot', 'virtual_func', 'virtual_name', 'VM', 'PPCI', 'hotplug_slot', 'options'] return XendBase.getAttrRO() + attrRO
def getAttrRO(self): attrRO = ['memory_actual', 'VCPUs_number', 'VCPUs_utilisation', 'VCPUs_CPU', 'VCPUs_flags', 'VCPUs_params', 'state', 'start_time', 'last_updated'] return XendBase.getAttrRO() + attrRO
def getAttrRW(cls): attrRW = [ 'name_label', 'name_description', 'auto_power_on', 'ncpu', 'sched_policy', 'proposed_CPUs', 'other_config', ] return XendBase.getAttrRW() + attrRW
def getAttrRO(self): attrRO = ['VM', 'PSCSI', 'HBA', 'virtual_host', 'virtual_channel', 'virtual_target', 'virtual_lun', 'virtual_HCTL', 'runtime_properties'] return XendBase.getAttrRO() + attrRO
def getMethods(cls): methods = ['destroy', 'activate', 'deactivate', 'add_host_CPU_live', 'remove_host_CPU_live', 'add_to_proposed_CPUs', 'remove_from_proposed_CPUs', 'add_to_other_config', 'remove_from_other_config', ] return XendBase.getMethods() + methods
def getMethods(cls): methods = [ 'destroy', 'activate', 'deactivate', 'add_host_CPU_live', 'remove_host_CPU_live', 'add_to_proposed_CPUs', 'remove_from_proposed_CPUs', 'add_to_other_config', 'remove_from_other_config', ] return XendBase.getMethods() + methods
def getAttrRO(self): attrRO = [ "memory_actual", "VCPUs_number", "VCPUs_utilisation", "VCPUs_CPU", "VCPUs_flags", "VCPUs_params", "state", "start_time", "last_updated", ] return XendBase.getAttrRO() + attrRO
def recreate(self, record, uuid): """Called on xend start / restart""" pif_uuid = uuid metrics_uuid = record['metrics'] # Create instances metrics = XendPIFMetrics(metrics_uuid, pif_uuid) pif = XendPIF(record, pif_uuid, metrics_uuid) # If physical PIF, check exists # If VLAN, create if not exist ifs = [dev for dev, _1, _2 in linux_get_phy_ifaces()] if pif.get_VLAN() == -1: if pif.get_device() not in ifs: XendBase.destroy(pif) metrics.destroy() return None else: if pif.get_interface_name() not in ifs: _create_VLAN(pif.get_device(), pif.get_VLAN()) pif.plug() return pif_uuid
def getAttrRO(self): attrRO = ['host', 'physical_host', 'physical_channel', 'physical_target', 'physical_lun', 'physical_HCTL', 'vendor_name', 'model', 'type_id', 'type', 'dev_name', 'sg_name', 'revision', 'scsi_id', 'scsi_level'] return XendBase.getAttrRO() + attrRO
def getAttrRO(self): attrRO = ['host', 'domain', 'bus', 'slot', 'func', 'name', 'vendor_id', 'vendor_name', 'device_id', 'device_name', 'revision_id', 'class_code', 'class_name', 'subsystem_vendor_id', 'subsystem_vendor_name', 'subsystem_id', 'subsystem_name', 'driver'] return XendBase.getAttrRO() + attrRO
def getAttrRO(self): attrRO = ['VIFs', 'PIFs', 'managed'] return XendBase.getAttrRO() + attrRO
def getFuncs(self): funcs = ['create_VLAN'] return XendBase.getFuncs() + funcs
def getMethods(self): methods = ['plug', 'unplug', 'destroy'] return XendBase.getMethods() + methods
def getAttrRW(self): attrRW = ['MAC', 'MTU'] return XendBase.getAttrRW() + attrRW
def getFuncs(self): funcs = ['create', 'get_by_name_label'] return XendBase.getFuncs() + funcs
def getMethods(self): methods = [] return XendBase.getMethods() + methods
def __init__(self, record, uuid, metrics_uuid): XendBase.__init__(self, uuid, record) self.metrics = metrics_uuid
def getAttrRW(self): attrRW = [ 'name_label', 'name_description', 'other_config', 'default_gateway', 'default_netmask' ] return XendBase.getAttrRW() + attrRW
def __init__(self, uuid, record): self.physical_host = record['physical_host'] XendBase.__init__(self, uuid, record)
def getFuncs(cls): funcs = ['create', 'get_by_name_label', ] return XendBase.getFuncs() + funcs
def getAttrRW(self): attrRW = [] return XendBase.getAttrRW() + attrRW
def getAttrInst(self): attrInst = [] return XendBase.getAttrInst() + attrInst
def getAttrInst(self): return XendBase.getAttrInst() + self.getAttrRW()
def getMethods(self): methods = [ 'add_to_other_config', 'remove_from_other_config', 'destroy' ] return XendBase.getMethods() + methods
def __init__(self, uuid, xend_domain_instance): XendBase.__init__(self, uuid, {}) self.xend_domain_instance = xend_domain_instance
def getFuncs(self): funcs = [] return XendBase.getFuncs() + funcs