* bug using bootloader + patch
@ 2007-03-13 12:22 Eric Einhorn
2007-03-13 12:29 ` Ewan Mellor
0 siblings, 1 reply; 2+ messages in thread
From: Eric Einhorn @ 2007-03-13 12:22 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]
Hi -devel,
I ran into an issue with the pyhton tools when using the bootloader option
in 3.0.4. 4 out of 5 times xen would fail when trying to launch pygrub.
I tracked the cause down to XendDomainInfo.py's use of all_devices_sxpr()
to find a valid block device. Devices are stored inside a hash, which,
will come back in an arbitrary order when you iterate it's values. In my
case, 4 out 5 times it would return my swap vbd first and try to launch
pygrub on it.
Instead, I wanted to use get_vbs() to return the block devices since it
should return a list in the order they were added with device_add() (from
XendConfig.py). I then found that in _sxp_to_api() the vbd_refs, as well
as vif_refs and vtpm_refs are recreated by itterating over the device
hash. So it seems all that work device_add did to make a neat order list
was tossed out.
I modified _sxp_to_api to copy the original device _refs lists instead of
iterating to preserve the original order the devices were created. Also,
as mentioned earlier, I modified _configureBootloader to use get_vbds() so
it will have direct access to the ref list. I am able to boot with a
bootload everytime now and have had no errors.
Attached is a patch for the changes I made against 3.0.4_1 if anyone is
intersted. Maybe it'll help someone else.
Thanks.
- Eric
[-- Attachment #2: xen-device_order.patch --]
[-- Type: application/octet-stream, Size: 2111 bytes --]
diff --recursive --unified --ignore-space-change xen-3.0.4_1-src-/tools/python/xen/xend/XendConfig.py xen-3.0.4_1-src/tools/python/xen/xend/XendConfig.py
--- xen-3.0.4_1-src-/tools/python/xen/xend/XendConfig.py 2007-03-11 13:24:37.000000000 -0400
+++ xen-3.0.4_1-src/tools/python/xen/xend/XendConfig.py 2007-03-11 13:33:36.000000000 -0400
@@ -639,16 +639,15 @@
self['devices'] = cfg.get('devices', {})
self['console_refs'] = []
+ self['vif_refs'] = cfg.get('vif_refs')
+ self['vbd_refs'] = cfg.get('vbd_refs')
+ self['vtpm_refs'] = cfg.get('vtpm_refs')
+ if not self['vif_refs']:
self['vif_refs'] = []
+ if not self['vbd_refs']:
self['vbd_refs'] = []
+ if not self['vtpm_refs']:
self['vtpm_refs'] = []
- for dev_uuid, (dev_type, dev_info) in self['devices'].items():
- if dev_type == 'vif':
- self['vif_refs'].append(dev_uuid)
- elif dev_type in ('vbd','tap'):
- self['vbd_refs'].append(dev_uuid)
- elif dev_type in ('vtpm',):
- self['vtpm_refs'].append(dev_uuid)
def _sxp_to_xapi_unsupported(self, sxp_cfg):
diff --recursive --unified --ignore-space-change xen-3.0.4_1-src-/tools/python/xen/xend/XendDomainInfo.py xen-3.0.4_1-src/tools/python/xen/xend/XendDomainInfo.py
--- xen-3.0.4_1-src-/tools/python/xen/xend/XendDomainInfo.py 2007-03-11 13:24:25.000000000 -0400
+++ xen-3.0.4_1-src/tools/python/xen/xend/XendDomainInfo.py 2007-03-11 13:41:09.000000000 -0400
@@ -1550,9 +1550,10 @@
blexec = '/usr/bin/pygrub'
blcfg = None
- for (devtype, devinfo) in self.info.all_devices_sxpr():
- if not devtype or not devinfo or devtype not in ('vbd', 'tap'):
- continue
+ for dev_uuid in self.get_vbds():
+ devinfo = self.info.device_sxpr(dev_uuid = dev_uuid)
+ devtype = devinfo.pop(0)
+
disk = None
for param in devinfo:
if param[0] == 'uname':
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: bug using bootloader + patch
2007-03-13 12:22 bug using bootloader + patch Eric Einhorn
@ 2007-03-13 12:29 ` Ewan Mellor
0 siblings, 0 replies; 2+ messages in thread
From: Ewan Mellor @ 2007-03-13 12:29 UTC (permalink / raw)
To: Eric Einhorn; +Cc: xen-devel
On Tue, Mar 13, 2007 at 08:22:48AM -0400, Eric Einhorn wrote:
> Hi -devel,
>
> I ran into an issue with the pyhton tools when using the bootloader option
> in 3.0.4. 4 out of 5 times xen would fail when trying to launch pygrub.
> I tracked the cause down to XendDomainInfo.py's use of all_devices_sxpr()
> to find a valid block device. Devices are stored inside a hash, which,
> will come back in an arbitrary order when you iterate it's values. In my
> case, 4 out 5 times it would return my swap vbd first and try to launch
> pygrub on it.
>
> Instead, I wanted to use get_vbs() to return the block devices since it
> should return a list in the order they were added with device_add() (from
> XendConfig.py). I then found that in _sxp_to_api() the vbd_refs, as well
> as vif_refs and vtpm_refs are recreated by itterating over the device
> hash. So it seems all that work device_add did to make a neat order list
> was tossed out.
>
> I modified _sxp_to_api to copy the original device _refs lists instead of
> iterating to preserve the original order the devices were created. Also,
> as mentioned earlier, I modified _configureBootloader to use get_vbds() so
> it will have direct access to the ref list. I am able to boot with a
> bootload everytime now and have had no errors.
>
> Attached is a patch for the changes I made against 3.0.4_1 if anyone is
> intersted. Maybe it'll help someone else.
Thanks for this. I believe that this problem is fixed in xen-unstable (and
has been for a little while) but certainly this patch may be useful to those
using 3.0.4.
Cheers,
Ewan.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-03-13 12:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-13 12:22 bug using bootloader + patch Eric Einhorn
2007-03-13 12:29 ` Ewan Mellor
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.