mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
xend: Fix xm pci commands for inactive managed domains.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
This commit is contained in:
1 parent
41af6f38d9
commit
c3122a4018
2 files changed
+36
-11
No files matched your search
@@ -621,9 +621,13 @@ class XendDomainInfo:
|
||||
pci_conf = self.info['devices'][dev_uuid][1]
|
||||
pci_devs = pci_conf['devs']
|
||||
for x in pci_devs:
|
||||
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 x.has_key('vslot'):
|
||||
x_vslot = x['vslot']
|
||||
else:
|
||||
x_vslot = x['requested_vslot']
|
||||
if (int(x_vslot, 16) == int(new_dev['requested_vslot'], 16) and
|
||||
int(x_vslot, 16) != AUTO_PHP_SLOT):
|
||||
raise VmError("vslot %s already have a device." % (new_dev['requested_vslot']))
|
||||
|
||||
if (int(x['domain'], 16) == int(new_dev['domain'], 16) and
|
||||
int(x['bus'], 16) == int(new_dev['bus'], 16) and
|
||||
@@ -710,14 +714,14 @@ class XendDomainInfo:
|
||||
new_dev['bus'],
|
||||
new_dev['slot'],
|
||||
new_dev['func'],
|
||||
new_dev['vslot'],
|
||||
new_dev['requested_vslot'],
|
||||
opts)
|
||||
self.image.signalDeviceModel('pci-ins', 'pci-inserted', bdf_str)
|
||||
|
||||
vslot = xstransact.Read("/local/domain/0/device-model/%i/parameter"
|
||||
% self.getDomid())
|
||||
else:
|
||||
vslot = new_dev['vslot']
|
||||
vslot = new_dev['requested_vslot']
|
||||
|
||||
return vslot
|
||||
|
||||
@@ -815,7 +819,10 @@ class XendDomainInfo:
|
||||
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) ):
|
||||
vslot = x['vslot']
|
||||
if x.has_key('vslot'):
|
||||
vslot = x['vslot']
|
||||
else:
|
||||
vslot = x['requested_vslot']
|
||||
break
|
||||
if vslot == AUTO_PHP_SLOT_STR:
|
||||
raise VmError("Device %04x:%02x:%02x.%01x is not connected"
|
||||
@@ -1112,7 +1119,11 @@ class XendDomainInfo:
|
||||
#find the pass-through device with the virtual slot
|
||||
devnum = 0
|
||||
for x in pci_conf['devs']:
|
||||
if int(x['vslot'], 16) == vslot:
|
||||
if x.has_key('vslot'):
|
||||
x_vslot = x['vslot']
|
||||
else:
|
||||
x_vslot = x['requested_vslot']
|
||||
if int(x_vslot, 16) == vslot:
|
||||
break
|
||||
devnum += 1
|
||||
|
||||
|
||||
@@ -2165,13 +2165,27 @@ def xm_pci_list(args):
|
||||
if len(devs) == 0:
|
||||
return
|
||||
|
||||
has_vslot = devs[0].has_key('vslot')
|
||||
has_vslot = False
|
||||
for x in devs:
|
||||
if x.has_key('vslot'):
|
||||
if x['vslot'] == "0x%s" % AUTO_PHP_SLOT_STR:
|
||||
x['vslot'] = '-'
|
||||
else:
|
||||
has_vslot = True
|
||||
elif not x.has_key('requested_vslot'):
|
||||
x['vslot'] = '-'
|
||||
elif x['requested_vslot'] == "0x%s" % AUTO_PHP_SLOT_STR:
|
||||
x['vslot'] = '-'
|
||||
else:
|
||||
has_vslot = True
|
||||
x['vslot'] = x['requested_vslot']
|
||||
|
||||
if has_vslot:
|
||||
hdr_str = 'VSlt domain bus slot func'
|
||||
fmt_str = "%(vslot)-3s %(domain)-3s %(bus)-3s %(slot)-3s %(func)-3s "
|
||||
fmt_str = "%(vslot)-4s %(domain)-6s %(bus)-4s %(slot)-4s %(func)-3s "
|
||||
else:
|
||||
hdr_str = 'domain bus slot func'
|
||||
fmt_str = "%(domain)-3s %(bus)-3s %(slot)-3s %(func)-3s "
|
||||
fmt_str = "%(domain)-6s %(bus)-4s %(slot)-4s %(func)-3s "
|
||||
hdr = 0
|
||||
|
||||
for x in devs:
|
||||
@@ -2457,7 +2471,7 @@ 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']],
|
||||
['vslot', '0x%x' % int(vslot, 16)]]
|
||||
['requested_vslot', '0x%x' % int(vslot, 16)]]
|
||||
if len(opts) > 0:
|
||||
pci_bdf.append(['opts', opts])
|
||||
pci.append(pci_bdf)
|
||||
|
||||