# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1242696212 -3600
# Node ID 780041c4a96d6bb4eb8bb4ed61c916c8c535448c
# Parent 62ec6aae4ba9decb58dee6bfecd3e3e8b434cffa
xend: Fix xm pci commands for inactive managed domains.
Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
---
tools/python/xen/xend/XendDomainInfo.py | 25 ++++++++++++++++++-------
tools/python/xen/xm/main.py | 22 ++++++++++++++++++----
2 files changed, 36 insertions(+), 11 deletions(-)
diff -r 62ec6aae4ba9 -r 780041c4a96d tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Tue May 19 02:18:48 2009 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py Tue May 19 02:23:32 2009 +0100
@@ -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
diff -r 62ec6aae4ba9 -r 780041c4a96d tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py Tue May 19 02:18:48 2009 +0100
+++ b/tools/python/xen/xm/main.py Tue May 19 02:23:32 2009 +0100
@@ -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,
['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)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|