Enhance XenAPI for pvSCSI : xm part
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/3 Enhance XenAPI for pvSCSI : xm part
xm part.
tools/python/xen/xm/create.dtd +5 -0
@@ -40,6 +40,7 @@ vif*, vtpm*, pci*, + vscsi*, console*, platform*, vcpu_param*,
@@ -87,6 +88,10 @@ slot CDATA #REQUIRED func CDATA #REQUIRED vslt CDATA #IMPLIED> + +<!ELEMENT vscsi EMPTY> +<!ATTLIST vscsi p-dev CDATA #REQUIRED + v-dev CDATA #REQUIRED> <!ELEMENT console (other_config*)> <!ATTLIST console protocol (vt100|rfb|rdp) #REQUIRED>
tools/python/xen/xm/main.py +92 -48
167 lines not on this page · raw message
tools/python/xen/xm/xenapi_create.py +59 -0
89 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 2/3 Enhance XenAPI for pvSCSI : xend part
In reply to a message not in the archivexend part.
tools/python/xen/xend/XendAPI.py +18 -2
@@ -42,6 +42,8 @@ from XendPBD import XendPBD from XendPBD import XendPBD from XendPPCI import XendPPCI from XendDPCI import XendDPCI +from XendPSCSI import XendPSCSI +from XendDSCSI import XendDSCSI from XendXSPolicy import XendXSPolicy, XendACMPolicy from XendAPIConstants import *
@@ -480,7 +482,9 @@ classes = { 'PBD' : valid_object("PBD"), 'PIF_metrics' : valid_object("PIF_metrics"), 'PPCI' : valid_object("PPCI"), - 'DPCI' : valid_object("DPCI") + 'DPCI' : valid_object("DPCI"), + 'PSCSI' : valid_object("PSCSI"), + 'DSCSI' : valid_object("DSCSI") } autoplug_classes = {
@@ -491,6 +495,8 @@ autoplug_classes = { 'PIF_metrics' : XendPIFMetrics, 'PPCI' : XendPPCI, 'DPCI' : XendDPCI, + 'PSCSI' : XendPSCSI, + 'DSCSI' : XendDSCSI, 'XSPolicy' : XendXSPolicy, 'ACMPolicy' : XendACMPolicy, }
@@ -881,6 +887,7 @@ class XendAPI(object): 'PBDs', 'PIFs', 'PPCIs', + 'PSCSIs', 'host_CPUs', 'cpu_configuration', 'metrics',
@@ -961,6 +968,8 @@ class XendAPI(object): return xen_api_success(XendNode.instance().get_PIF_refs()) def host_get_PPCIs(self, session, ref): return xen_api_success(XendNode.instance().get_PPCI_refs()) + def host_get_PSCSIs(self, session, ref): + return xen_api_success(XendNode.instance().get_PSCSI_refs()) def host_get_host_CPUs(self, session, host_ref): return xen_api_success(XendNode.instance().get_host_cpu_refs()) def host_get_metrics(self, _, ref):
@@ -1037,7 +1046,8 @@ class XendAPI(object): 'logging': {}, 'PIFs': XendPIF.get_all(), 'PBDs': XendPBD.get_all(), - 'PPCIs': XendPPCI.get_all()} + 'PPCIs': XendPPCI.get_all(), + 'PSCSIs': XendPSCSI.get_all()} return xen_api_success(record) # class methods
@@ -1158,6 +1168,7 @@ class XendAPI(object): 'VBDs', 'VTPMs', 'DPCIs', + 'DSCSIs', 'tools_version', 'domid', 'is_control_domain',
@@ -1304,6 +1315,10 @@ class XendAPI(object): dom = XendDomain.instance().get_vm_by_uuid(vm_ref) return xen_api_success(dom.get_dpcis()) + def VM_get_DSCSIs(self, session, vm_ref): + dom = XendDomain.instance().get_vm_by_uuid(vm_ref) + return xen_api_success(dom.get_dscsis()) + def VM_get_tools_version(self, session, vm_ref): dom = XendDomain.instance().get_vm_by_uuid(vm_ref) return dom.get_tools_version()
@@ -1684,6 +1699,7 @@ class XendAPI(object): 'VBDs': xeninfo.get_vbds(), 'VTPMs': xeninfo.get_vtpms(), 'DPCIs': xeninfo.get_dpcis(), + 'DSCSIs': xeninfo.get_dscsis(), 'PV_bootloader': xeninfo.info.get('PV_bootloader'), 'PV_kernel': xeninfo.info.get('PV_kernel'), 'PV_ramdisk': xeninfo.info.get('PV_ramdisk'),
tools/python/xen/xend/XendConfig.py +165 -36
253 lines not on this page · raw message
tools/python/xen/xend/XendDomainInfo.py +105 -5
156 lines not on this page · raw message
tools/python/xen/xend/XendNode.py +38 -1
@@ -22,6 +22,7 @@ import xen.lowlevel.xc from xen.util import Brctl from xen.util import pci as PciUtil +from xen.util import vscsi_util from xen.xend import XendAPIStore from xen.xend import osdep
@@ -38,7 +39,8 @@ from XendStateStore import XendStateStor from XendStateStore import XendStateStore from XendMonitor import XendMonitor from XendPPCI import XendPPCI - +from XendPSCSI import XendPSCSI + class XendNode: """XendNode - Represents a Domain 0 Host."""
@@ -53,6 +55,7 @@ class XendNode: * network * Storage Repository * PPCI + * PSCSI """ self.xc = xen.lowlevel.xc.xc()
@@ -269,6 +272,24 @@ class XendNode: XendPPCI(ppci_uuid, ppci_record) + # Initialise PSCSIs + saved_pscsis = self.state_store.load_state('pscsi') + saved_pscsi_table = {} + if saved_pscsis: + for pscsi_uuid, pscsi_record in saved_pscsis.items(): + try: + saved_pscsi_table[pscsi_record['scsi_id']] = pscsi_uuid + except KeyError: + pass + + for pscsi_record in vscsi_util.get_all_scsi_devices(): + if pscsi_record['scsi_id']: + # If saved uuid exists, use it. Otherwise create one. + pscsi_uuid = saved_pscsi_table.get(pscsi_record['scsi_id'], + uuid.createString()) + XendPSCSI(pscsi_uuid, pscsi_record) + + ## def network_destroy(self, net_uuid): ## del self.networks[net_uuid] ## self.save_networks()
@@ -317,6 +338,15 @@ class XendNode: def get_ppci_by_uuid(self, ppci_uuid): if ppci_uuid in self.get_PPCI_refs(): return ppci_uuid + return None + + + def get_PSCSI_refs(self): + return XendPSCSI.get_all() + + def get_pscsi_by_uuid(self, pscsi_uuid): + if pscsi_uuid in self.get_PSCSI_refs(): + return pscsi_uuid return None
@@ -333,6 +363,7 @@ class XendNode: self.save_PBDs() self.save_SRs() self.save_PPCIs() + self.save_PSCSIs() def save_PIFs(self): pif_records = dict([(pif_uuid, XendAPIStore.get(
@@ -362,6 +393,12 @@ class XendNode: ppci_uuid, "PPCI").get_record()) for ppci_uuid in XendPPCI.get_all()]) self.state_store.save_state('ppci', ppci_records) + + def save_PSCSIs(self): + pscsi_records = dict([(pscsi_uuid, XendAPIStore.get( + pscsi_uuid, "PSCSI").get_record()) + for pscsi_uuid in XendPSCSI.get_all()]) + self.state_store.save_state('pscsi', pscsi_records) def shutdown(self): return 0
tools/python/xen/xend/server/vscsiif.py +9 -9
@@ -125,10 +125,10 @@ class VSCSIController(DevController): state = self.readBackend(devid, devpath + '/state') localdevid = self.readBackend(devid, devpath + '/devid') dev_dict = {'p-dev': pdev, - 'p-devname': pdevname, - 'v-dev': pdevname, - 'state': state, - 'devid': localdevid } + 'p-devname': pdevname, + 'v-dev': vdev, + 'state': state, + 'devid': localdevid } vscsi_devs.append(dev_dict) config['devs'] = vscsi_devs
@@ -168,17 +168,17 @@ class VSCSIController(DevController): (devid, back, front) = self.getDeviceDetails(config) devid = int(devid) vscsi_config = config['devs'][0] - states = config.get('states', []) + state = vscsi_config.get('state', '') driver_state = self.readBackend(devid, 'state') if str(xenbusState['Connected']) != driver_state: raise VmError("Driver status is not connected") uuid = self.readBackend(devid, 'uuid') - if states[0] == 'Initialising': + if state == 'Initialising': back['uuid'] = uuid self.writeBackend(devid, back) - elif states[0] == 'Closing': + elif state == 'Closing': found = False devs = self.readBackendList(devid, "vscsi-devs") vscsipath = "vscsi-devs/"
@@ -197,8 +197,8 @@ class VSCSIController(DevController): raise VmError("Device %s not connected" % vdev) else: - raise XendError('Error configuring device invalid state %s' - % state) + raise XendError("Error configuring device invalid " + "state '%s'" % state) self.writeBackend(devid, 'state', str(xenbusState['Reconfiguring'])) return self.readBackend(devid, 'uuid')
tools/python/xen/xend/XendDSCSI.py new file +174 -0
174 lines not on this page · raw message
tools/python/xen/xend/XendPSCSI.py new file +143 -0
143 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 3/3 Enhance XenAPI for pvSCSI : util part
In reply to a message not in the archiveutil part.
tools/python/xen/util/pci.py +3 -18
@@ -12,8 +12,8 @@ import types import types import struct import time - -PROC_MNT_PATH = '/proc/mounts' +from xen.util import utils + PROC_PCI_PATH = '/proc/bus/pci/devices' PROC_PCI_NUM_RESOURCES = 7
@@ -97,9 +97,6 @@ MSIX_SIZE_MASK = 0x7ff # Global variable to store information from lspci lspci_info = None -# Global variable to store the sysfs mount point -sysfs_mnt_point = None - #Calculate PAGE_SHIFT: number of bits to shift an address to get the page number PAGE_SIZE = resource.getpagesize() PAGE_SHIFT = 0
@@ -141,20 +138,8 @@ def parse_pci_name(pci_name_string): def find_sysfs_mnt(): - global sysfs_mnt_point - if not sysfs_mnt_point is None: - return sysfs_mnt_point - try: - mounts_file = open(PROC_MNT_PATH,'r') - - for line in mounts_file: - sline = line.split() - if len(sline)<3: - continue - if sline[2]=='sysfs': - sysfs_mnt_point= sline[1] - return sysfs_mnt_point + return utils.find_sysfs_mount() except IOError, (errno, strerr): raise PciDeviceParseError(('Failed to locate sysfs mount: %s: %s (%d)'% (PROC_PCI_PATH, strerr, errno)))
tools/python/xen/util/utils.py +26 -0
@@ -48,3 +48,29 @@ def daemonize(prog, args, stdin_tmpfile= os.waitpid(pid, 0) return daemon_pid +# Global variable to store the sysfs mount point +sysfs_mount_point = None + +PROC_MOUNTS_PATH = '/proc/mounts' + +def find_sysfs_mount(): + global sysfs_mount_point + + if not sysfs_mount_point is None: + return sysfs_mount_point + + try: + mounts_file = open(PROC_MOUNTS_PATH, 'r') + + for line in mounts_file: + sline = line.split() + if len(sline) < 3: + continue + if sline[2] == 'sysfs': + sysfs_mount_point= sline[1] + return sysfs_mount_point + except IOError, (errno, strerr): + raise + + return None +
tools/python/xen/util/vscsi_util.py +110 -3
132 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel