Skip to contentSkip to conversation

Restore uname of blktap for managed domains

PATCH New Masaki Kanno 1 participant 1 message Jul 2, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Restore uname of blktap for managed domains

Hi,

When I rebooted a host OS, I lost a managed guest domain. Then I saw the following error message in xend.log.
This patch solves the problem.

[2009-07-02 21:33:44 3774] ERROR (XendDomain:340) Unable to open or parse config.sxp: /var/lib/xend/domains/6cf80f91-cdbb-2947-e057-1624ee76ff9a/config.sxp Traceback (most recent call last):
File "usr/lib/python2.4/site-packages/xen/xend/XendDomain.py", line 332, in _managed_domains
cfg = XendConfig.XendConfig(filename = cfg_file)
File "usr/lib/python2.4/site-packages/xen/xend/XendConfig.py", line 333, in __init__

    self._sxp_to_xapi(sxp_obj)

File "usr/lib/python2.4/site-packages/xen/xend/XendConfig.py", line 826, in _sxp_to_xapi
cfg = self._parse_sxp(sxp_cfg)
File "usr/lib/python2.4/site-packages/xen/xend/XendConfig.py", line 663, in _parse_sxp
self.device_add(dev_type, cfg_sxp = config, target = cfg)
File "usr/lib/python2.4/site-packages/xen/xend/XendConfig.py", line 1374, in device_add
raise XendConfigError("tap:%s not a valid disk type" %
XendConfigError: Invalid Configuration: tap:/dev/xen/blktap-2/tapdev0 not a valid disk type

Best regards,
Kan

tools/python/xen/xend/XendConfig.py +9 -1
diff -r 80839a223746 tools/python/xen/xend/XendConfig.py
@@ -1120,6 +1120,8 @@
                                     if sxp.child_value(config, 'bootable', None) is None:
                                         is_bootable = dev_cfg.get('bootable', 0)
                                         config.append(['bootable', int(is_bootable)])
+                                    if dev_cfg.has_key('required_uname'):
+                                        config.append(['required_uname', dev_cfg['required_uname']])
                                     config.append(['VDI', dev_cfg.get('VDI', '')])
 
                                 sxpr.append(['device', config])
@@ -1370,10 +1372,16 @@
                     dev_info['driver'] = 'paravirtualised'
 
             if dev_type == 'tap' or dev_type == 'tap2':
+                if dev_info.has_key('required_uname'):
+                    # Restore uname by required_uname because uname might
+                    # be replaced with 'phy:/dev/xen/blktap-2/tapdev*'.
+                    dev_info['uname'] = dev_info['required_uname']
+                else:
+                    # Save uname for next domain start.
+                    dev_info['required_uname'] = dev_info['uname']
                 if dev_info['uname'].split(':')[1] not in blktap_disk_types:
                     raise XendConfigError("tap:%s not a valid disk type" %
                                     dev_info['uname'].split(':')[1])
-                dev_info['required_uname'] = dev_info['uname']
 
             if dev_type == 'vif':
                 if not dev_info.get('mac'):

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel