mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
xm, xend: Replace "vslt" with "vslot"
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
This commit is contained in:
1 parent
94bacaf76d
commit
b8f2311b23
6 files changed
+47
-47
No files matched your search
@@ -1617,10 +1617,10 @@ class XendConfig(dict):
|
||||
# extendend like this:
|
||||
#
|
||||
# [device, [pci, [dev, [domain, 0], [bus, 0], [slot, 1], [func, 2],
|
||||
# [vslt, 0]],
|
||||
# [vslot, 0]],
|
||||
# [state, 'Initialising']]]
|
||||
#
|
||||
# 'vslt' shows the virtual hotplug slot number which the PCI device
|
||||
# 'vslot' shows the virtual hotplug slot number which the PCI device
|
||||
# is inserted in. This is only effective for HVM domains.
|
||||
#
|
||||
# state 'Initialising' indicates that the device is being attached,
|
||||
@@ -1628,7 +1628,7 @@ class XendConfig(dict):
|
||||
#
|
||||
# The Dict looks like this:
|
||||
#
|
||||
# { devs: [{domain: 0, bus: 0, slot: 1, func: 2, vslt: 0}],
|
||||
# { devs: [{domain: 0, bus: 0, slot: 1, func: 2, vslot: 0}],
|
||||
# states: ['Initialising'] }
|
||||
|
||||
dev_config = {}
|
||||
|
||||
@@ -596,7 +596,7 @@ class XendDomainInfo:
|
||||
#update the vslot info
|
||||
count = 0;
|
||||
for x in pci_devs:
|
||||
x['vslt'] = slot_list[count]
|
||||
x['vslot'] = slot_list[count]
|
||||
count += 1
|
||||
|
||||
|
||||
@@ -619,9 +619,9 @@ class XendDomainInfo:
|
||||
pci_conf = self.info['devices'][dev_uuid][1]
|
||||
pci_devs = pci_conf['devs']
|
||||
for x in pci_devs:
|
||||
if (int(x['vslt'], 16) == int(new_dev['vslt'], 16) and
|
||||
int(x['vslt'], 16) != AUTO_PHP_SLOT):
|
||||
raise VmError("vslot %s already have a device." % (new_dev['vslt']))
|
||||
if (int(x['vslot'], 16) == int(new_dev['vslot'], 16) and
|
||||
int(x['vslot'], 16) != AUTO_PHP_SLOT):
|
||||
raise VmError("vslot %s already have a device." % (new_dev['vslot']))
|
||||
|
||||
if (int(x['domain'], 16) == int(new_dev['domain'], 16) and
|
||||
int(x['bus'], 16) == int(new_dev['bus'], 16) and
|
||||
@@ -708,7 +708,7 @@ class XendDomainInfo:
|
||||
new_dev['slot'],
|
||||
new_dev['func'],
|
||||
opts,
|
||||
new_dev['vslt'])
|
||||
new_dev['vslot'])
|
||||
self.image.signalDeviceModel('pci-ins', 'pci-inserted', bdf_str)
|
||||
|
||||
|
||||
@@ -789,36 +789,36 @@ class XendDomainInfo:
|
||||
if pci_state == 'Initialising':
|
||||
# HVM PCI device attachment
|
||||
self.hvm_pci_device_create(dev_config)
|
||||
# Update vslt
|
||||
vslt = xstransact.Read("/local/domain/0/device-model/%i/parameter"
|
||||
% self.getDomid())
|
||||
dev['vslt'] = vslt
|
||||
# Update vslot
|
||||
vslot = xstransact.Read("/local/domain/0/device-model/%i/parameter"
|
||||
% self.getDomid())
|
||||
dev['vslot'] = vslot
|
||||
for n in sxp.children(pci_dev):
|
||||
if(n[0] == 'vslt'):
|
||||
n[1] = vslt
|
||||
if(n[0] == 'vslot'):
|
||||
n[1] = vslot
|
||||
else:
|
||||
# HVM PCI device detachment
|
||||
existing_dev_uuid = sxp.child_value(existing_dev_info, 'uuid')
|
||||
existing_pci_conf = self.info['devices'][existing_dev_uuid][1]
|
||||
existing_pci_devs = existing_pci_conf['devs']
|
||||
vslt = AUTO_PHP_SLOT_STR
|
||||
vslot = AUTO_PHP_SLOT_STR
|
||||
for x in existing_pci_devs:
|
||||
if ( int(x['domain'], 16) == int(dev['domain'], 16) and
|
||||
int(x['bus'], 16) == int(dev['bus'], 16) and
|
||||
int(x['slot'], 16) == int(dev['slot'], 16) and
|
||||
int(x['func'], 16) == int(dev['func'], 16) ):
|
||||
vslt = x['vslt']
|
||||
vslot = x['vslot']
|
||||
break
|
||||
if vslt == AUTO_PHP_SLOT_STR:
|
||||
if vslot == AUTO_PHP_SLOT_STR:
|
||||
raise VmError("Device %04x:%02x:%02x.%01x is not connected"
|
||||
% (int(dev['domain'],16), int(dev['bus'],16),
|
||||
int(dev['slot'],16), int(dev['func'],16)))
|
||||
self.hvm_destroyPCIDevice(int(vslt, 16))
|
||||
# Update vslt
|
||||
dev['vslt'] = vslt
|
||||
self.hvm_destroyPCIDevice(int(vslot, 16))
|
||||
# Update vslot
|
||||
dev['vslot'] = vslot
|
||||
for n in sxp.children(pci_dev):
|
||||
if(n[0] == 'vslt'):
|
||||
n[1] = vslt
|
||||
if(n[0] == 'vslot'):
|
||||
n[1] = vslot
|
||||
|
||||
# If pci platform does not exist, create and exit.
|
||||
if existing_dev_info is None:
|
||||
@@ -1046,7 +1046,7 @@ class XendDomainInfo:
|
||||
#find the pass-through device with the virtual slot
|
||||
devnum = 0
|
||||
for x in pci_conf['devs']:
|
||||
if int(x['vslt'], 16) == vslot:
|
||||
if int(x['vslot'], 16) == vslot:
|
||||
break
|
||||
devnum += 1
|
||||
|
||||
@@ -3666,7 +3666,7 @@ class XendDomainInfo:
|
||||
['bus', '0x%02x' % ppci.get_bus()],
|
||||
['slot', '0x%02x' % ppci.get_slot()],
|
||||
['func', '0x%1x' % ppci.get_func()],
|
||||
['vslt', '0x%02x' % xenapi_pci.get('hotplug_slot')],
|
||||
['vslot', '0x%02x' % xenapi_pci.get('hotplug_slot')],
|
||||
['opts', dpci_opts],
|
||||
['uuid', dpci_uuid]
|
||||
],
|
||||
|
||||
@@ -83,9 +83,9 @@ class PciController(DevController):
|
||||
opts = reduce(lambda x, y: x+','+y, opts)
|
||||
back['opts-%i' % pcidevid] = opts
|
||||
|
||||
vslt = pci_config.get('vslt')
|
||||
if vslt is not None:
|
||||
vslots = vslots + vslt + ";"
|
||||
vslot = pci_config.get('vslot')
|
||||
if vslot is not None:
|
||||
vslots = vslots + vslot + ";"
|
||||
|
||||
back['dev-%i' % pcidevid] = "%04x:%02x:%02x.%01x" % \
|
||||
(domain, bus, slot, func)
|
||||
@@ -170,9 +170,9 @@ class PciController(DevController):
|
||||
# Update vslots
|
||||
if back.get('vslots') is not None:
|
||||
vslots = old_vslots
|
||||
for vslt in back['vslots'].split(';'):
|
||||
if vslt != '':
|
||||
vslots = vslots.replace(vslt + ';', '', 1)
|
||||
for vslot in back['vslots'].split(';'):
|
||||
if vslot != '':
|
||||
vslots = vslots.replace(vslot + ';', '', 1)
|
||||
if vslots == '':
|
||||
self.removeBackend(devid, 'vslots')
|
||||
else:
|
||||
@@ -219,9 +219,9 @@ class PciController(DevController):
|
||||
#append vslot info
|
||||
if vslots is not None:
|
||||
try:
|
||||
dev_dict['vslt'] = slot_list[i]
|
||||
dev_dict['vslot'] = slot_list[i]
|
||||
except IndexError:
|
||||
dev_dict['vslt'] = AUTO_PHP_SLOT_STR
|
||||
dev_dict['vslot'] = AUTO_PHP_SLOT_STR
|
||||
|
||||
pci_devs.append(dev_dict)
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
slot CDATA #REQUIRED
|
||||
func CDATA #REQUIRED
|
||||
opts_str CDATA #IMPLIED
|
||||
vslt CDATA #IMPLIED>
|
||||
vslot CDATA #IMPLIED>
|
||||
|
||||
<!ELEMENT vscsi EMPTY>
|
||||
<!ATTLIST vscsi p-dev CDATA #REQUIRED
|
||||
|
||||
+12
-12
@@ -2155,7 +2155,7 @@ def xm_pci_list(args):
|
||||
"bus": "0x%02x" % int(ppci_record["bus"]),
|
||||
"slot": "0x%02x" % int(ppci_record["slot"]),
|
||||
"func": "0x%01x" % int(ppci_record["func"]),
|
||||
"vslt": "0x%02x" % \
|
||||
"vslot": "0x%02x" % \
|
||||
int(server.xenapi.DPCI.get_hotplug_slot(dpci_ref))
|
||||
}
|
||||
devs.append(dev)
|
||||
@@ -2166,10 +2166,10 @@ def xm_pci_list(args):
|
||||
if len(devs) == 0:
|
||||
return
|
||||
|
||||
has_vslt = devs[0].has_key('vslt')
|
||||
if has_vslt:
|
||||
has_vslot = devs[0].has_key('vslot')
|
||||
if has_vslot:
|
||||
hdr_str = 'VSlt domain bus slot func'
|
||||
fmt_str = "%(vslt)-3s %(domain)-3s %(bus)-3s %(slot)-3s %(func)-3s "
|
||||
fmt_str = "%(vslot)-3s %(domain)-3s %(bus)-3s %(slot)-3s %(func)-3s "
|
||||
else:
|
||||
hdr_str = 'domain bus slot func'
|
||||
fmt_str = "%(domain)-3s %(bus)-3s %(slot)-3s %(func)-3s "
|
||||
@@ -2441,16 +2441,16 @@ def parse_pci_configuration(args, state, opts = ''):
|
||||
dom = args[0]
|
||||
pci_dev_str = args[1]
|
||||
if len(args) == 3:
|
||||
vslt = args[2]
|
||||
vslot = args[2]
|
||||
else:
|
||||
vslt = AUTO_PHP_SLOT_STR
|
||||
vslot = AUTO_PHP_SLOT_STR
|
||||
pci=['pci']
|
||||
pci_match = re.match(r"((?P<domain>[0-9a-fA-F]{1,4})[:,])?" + \
|
||||
r"(?P<bus>[0-9a-fA-F]{1,2})[:,]" + \
|
||||
r"(?P<slot>[0-9a-fA-F]{1,2})[.,]" + \
|
||||
r"(?P<func>[0-7])$", pci_dev_str)
|
||||
if pci_match == None:
|
||||
raise OptionError("Invalid argument: %s %s" % (pci_dev_str,vslt))
|
||||
raise OptionError("Invalid argument: %s %s" % (pci_dev_str, vslot))
|
||||
pci_dev_info = pci_match.groupdict('0')
|
||||
|
||||
try:
|
||||
@@ -2458,13 +2458,13 @@ def parse_pci_configuration(args, state, opts = ''):
|
||||
['bus', '0x'+ pci_dev_info['bus']],
|
||||
['slot', '0x'+ pci_dev_info['slot']],
|
||||
['func', '0x'+ pci_dev_info['func']],
|
||||
['vslt', '0x%x' % int(vslt, 16)]]
|
||||
['vslot', '0x%x' % int(vslot, 16)]]
|
||||
if len(opts) > 0:
|
||||
pci_bdf.append(['opts', opts])
|
||||
pci.append(pci_bdf)
|
||||
|
||||
except:
|
||||
raise OptionError("Invalid argument: %s %s" % (pci_dev_str,vslt))
|
||||
raise OptionError("Invalid argument: %s %s" % (pci_dev_str, vslot))
|
||||
pci.append(['state', state])
|
||||
|
||||
return (dom, pci)
|
||||
@@ -2494,7 +2494,7 @@ def xm_pci_attach(args):
|
||||
bus = int(sxp.child_value(pci_dev, 'bus'), 16)
|
||||
slot = int(sxp.child_value(pci_dev, 'slot'), 16)
|
||||
func = int(sxp.child_value(pci_dev, 'func'), 16)
|
||||
vslt = int(sxp.child_value(pci_dev, 'vslt'), 16)
|
||||
vslot = int(sxp.child_value(pci_dev, 'vslot'), 16)
|
||||
name = "%04x:%02x:%02x.%01x" % (domain, bus, slot, func)
|
||||
|
||||
target_ref = None
|
||||
@@ -2508,7 +2508,7 @@ def xm_pci_attach(args):
|
||||
dpci_record = {
|
||||
"VM": get_single_vm(dom),
|
||||
"PPCI": target_ref,
|
||||
"hotplug_slot": vslt,
|
||||
"hotplug_slot": vslot,
|
||||
"options": dict(config_pci_opts)
|
||||
}
|
||||
server.xenapi.DPCI.create(dpci_record)
|
||||
@@ -2667,7 +2667,7 @@ def xm_pci_detach(args):
|
||||
bus = int(sxp.child_value(pci_dev, 'bus'), 16)
|
||||
slot = int(sxp.child_value(pci_dev, 'slot'), 16)
|
||||
func = int(sxp.child_value(pci_dev, 'func'), 16)
|
||||
vslt = int(sxp.child_value(pci_dev, 'vslt'), 16)
|
||||
vslot = int(sxp.child_value(pci_dev, 'vslot'), 16)
|
||||
name = "%04x:%02x:%02x.%01x" % (domain, bus, slot, func)
|
||||
|
||||
target_ref = None
|
||||
|
||||
@@ -937,8 +937,8 @@ class sxp2xml:
|
||||
= get_child_by_name(dev_sxp, "slot", "0")
|
||||
pci.attributes["func"] \
|
||||
= get_child_by_name(dev_sxp, "func", "0")
|
||||
pci.attributes["vslt"] \
|
||||
= get_child_by_name(dev_sxp, "vslt", "0")
|
||||
pci.attributes["vslot"] \
|
||||
= get_child_by_name(dev_sxp, "vslot", "0")
|
||||
for opt in get_child_by_name(dev_sxp, "opts", ""):
|
||||
if len(opt) > 0:
|
||||
pci_opt = document.createElement("pci_opt")
|
||||
|
||||