From: "Dube, Lutz" Subject: xend: bootable flag of VBD not always of type int Date: Wed, 21 Oct 2009 09:29:25 +0200 Message-ID: <3958B14F314B884890EEE2F4CCDAB6A601031EDB927A@ABGEX73E.FSC.NET> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="_004_3958B14F314B884890EEE2F4CCDAB6A601031EDB927AABGEX73EFSC_" Return-path: Content-Language: de-DE List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --_004_3958B14F314B884890EEE2F4CCDAB6A601031EDB927AABGEX73EFSC_ Content-Type: multipart/alternative; boundary="_000_3958B14F314B884890EEE2F4CCDAB6A601031EDB927AABGEX73EFSC_" --_000_3958B14F314B884890EEE2F4CCDAB6A601031EDB927AABGEX73EFSC_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable xend: bootable flag of VBD not always of type int 1. Calling VDB.set_bootable(True) results in string 'True' in managed confi= g file. After xend restart, conversion int(bootable) in server/blkif.py fails. 2. selection of bootable disks in XendDomainInfo.py requires type(bootable)= =3D=3D int not str, otherwise all disks are taken as bootable. This patch converts the bootable flag always to int. Signed-off-by: Lutz.Dube@ts.fujitsu.com diff -r d7d7f978d704 -r ca56a7da0248 tools/python/xen/xend/XendAPI.py --- a/tools/python/xen/xend/XendAPI.py Tue Oct 20 14:36:01 2009 +0100 +++ b/tools/python/xen/xend/XendAPI.py Wed Oct 21 09:11:03 2009 +0200 @@ -2091,7 +2091,7 @@ class XendAPI(object): bootable =3D bool(bootable) xd =3D XendDomain.instance() vm =3D xd.get_vm_with_dev_uuid('vbd', vbd_ref) - vm.set_dev_property('vbd', vbd_ref, 'bootable', bootable) + vm.set_dev_property('vbd', vbd_ref, 'bootable', int(bootable)) xd.managed_config_save(vm) return xen_api_success_void() diff -r d7d7f978d704 -r ca56a7da0248 tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Tue Oct 20 14:36:01 2009 +0= 100 +++ b/tools/python/xen/xend/XendConfig.py Wed Oct 21 09:11:03 2009 +0= 200 @@ -1429,9 +1429,14 @@ class XendConfig(dict): if param not in target: target[param] =3D [] if dev_uuid not in target[param]: - if dev_type =3D=3D 'vbd' and 'bootable' not in dev_inf= o: - # Compat hack -- mark first disk bootable - dev_info['bootable'] =3D int(not target[param]) + if dev_type =3D=3D 'vbd': + if 'bootable' not in dev_info: + # Compat hack -- mark first disk bootable + dev_info['bootable'] =3D int(not target[param]= ) + else: + # ensure type of bootable is int (on xend rest= art + # it's of type str) + dev_info['bootable'] =3D int(dev_info['bootabl= e']) target[param].append(dev_uuid) elif dev_type =3D=3D 'tap' or dev_type =3D=3D 'tap2': if 'vbd_refs' not in target: @@ -1440,6 +1445,10 @@ class XendConfig(dict): if 'bootable' not in dev_info: # Compat hack -- mark first disk bootable dev_info['bootable'] =3D int(not target['vbd_refs'= ]) + else: + # ensure type of bootable is int (on xend restart = it's + # of type str) + dev_info['bootable'] =3D int(dev_info['bootable']) target['vbd_refs'].append(dev_uuid) elif dev_type =3D=3D 'vfb': --- Kind regards Lutz Dube --_000_3958B14F314B884890EEE2F4CCDAB6A601031EDB927AABGEX73EFSC_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
xend: bootable flag of VBD not always of type int
 
1. Calling VDB.set_bootable(True) results in string 'True' in managed = config file.
   After xend restart, conversion int(bootable) in server/bl= kif.py fails.
2. selection of bootable disks in XendDomainInfo.py requires type(boot= able) =3D=3D int not str,
   otherwise all disks are taken as bootable.
 
This patch converts the bootable flag always to int.
 
Signed-off-by: Lutz.Dube@ts.fujitsu.com
 
diff -r d7d7f978d704 -r ca56a7da0248 tools/python/xen/xend/XendAPI.py<= /div>
--- a/tools/python/xen/xend/XendAPI.py  Tue Oct 20 14:36:01 2009 = +0100
+++ b/tools/python/xen/xend/XendAPI.py  Wed Oct 21 09= :11:03 2009 +0200
@@ -2091,7 +2091,7 @@ class XendAPI(object):
         bootable =3D bool(boo= table)
         xd =3D XendDomain.ins= tance()
         vm =3D xd.get_vm_with= _dev_uuid('vbd', vbd_ref)
-        vm.set_dev_property('vbd',= vbd_ref, 'bootable', bootable)
+        vm.set_dev_property('v= bd', vbd_ref, 'bootable', int(bootable))
         xd.managed_config_sav= e(vm)
         return xen_api_succes= s_void()
 
diff -r d7d7f978d704 -r ca56a7da0248 tools/python/xen/xend/XendConfig.= py
--- a/tools/python/xen/xend/XendConfig.py     = ;  Tue Oct 20 14:36:01 2009 +0100
+++ b/tools/python/xen/xend/XendConfig.py   = ;    Wed Oct 21 09:11:03 2009 +0200
@@ -1429,9 +1429,14 @@ class XendConfig(dict):
           &nbs= p;     if param not in target:
           &nbs= p;         target[param] =3D []
           &nbs= p;     if dev_uuid not in target[param]:
-           &nb= sp;        if dev_type =3D=3D 'vbd' and = 'bootable' not in dev_info:
-           &nb= sp;            # Com= pat hack -- mark first disk bootable
-           &nb= sp;            dev_i= nfo['bootable'] =3D int(not target[param])
+           = ;         if dev_type =3D=3D 'vbd':=
+           = ;             i= f 'bootable' not in dev_info:
+           = ;            &n= bsp;    # Compat hack -- mark first disk bootable
+           = ;            &n= bsp;    dev_info['bootable'] =3D int(not target[param])
+           = ;             e= lse:
+           = ;            &n= bsp;    # ensure type of bootable is int (on xend restart
+           = ;            &n= bsp;    # it's of type str)
+           = ;            &n= bsp;    dev_info['bootable'] =3D int(dev_info['bootable'])&n= bsp;            = ;          
           &nbs= p;         target[param].append(dev= _uuid)
           &nbs= p; elif dev_type =3D=3D 'tap' or dev_type =3D=3D 'tap2':
           &nbs= p;     if 'vbd_refs' not in target:
@@ -1440,6 +1445,10 @@ class XendConfig(dict):
           &nbs= p;         if 'bootable' not in dev= _info:
           &nbs= p;             = # Compat hack -- mark first disk bootable
           &nbs= p;             = dev_info['bootable'] =3D int(not target['vbd_refs'])
+           = ;         else:
+           = ;             #= ensure type of bootable is int (on xend restart it's
+           = ;             #= of type str)
+           = ;             d= ev_info['bootable'] =3D int(dev_info['bootable'])    &n= bsp;            = ;      
           &nbs= p;         target['vbd_refs'].appen= d(dev_uuid)
 
           &nbs= p; elif dev_type =3D=3D 'vfb':
 
 
 
---
Kind regards
Lutz Dube
 
 
--_000_3958B14F314B884890EEE2F4CCDAB6A601031EDB927AABGEX73EFSC_-- --_004_3958B14F314B884890EEE2F4CCDAB6A601031EDB927AABGEX73EFSC_ Content-Type: application/octet-stream; name="patch_bootable" Content-Description: patch_bootable Content-Disposition: attachment; filename="patch_bootable"; size=3054; creation-date="Wed, 21 Oct 2009 09:21:17 GMT"; modification-date="Wed, 21 Oct 2009 09:13:39 GMT" Content-Transfer-Encoding: base64 IyBIRyBjaGFuZ2VzZXQgcGF0Y2gKIyBVc2VyIEx1dHouRHViZQojIE5vZGUgSUQgY2E1NmE3ZGEw MjQ4ZTkwODBlNTVmZWY2YjZmNDM4MTY0MjhlMDU0ZAojIFBhcmVudCAgZDdkN2Y5NzhkNzA0ZDc1 YTgxOWNlMjlmMTMxYWQ0ZGU3ZjE2ODhhOQp4ZW5kOiBib290YWJsZSBmbGFnIG9mIFZCRCBub3Qg YWx3YXlzIG9mIHR5cGUgaW50CgoxLiBDYWxsaW5nIFZEQi5zZXRfYm9vdGFibGUoVHJ1ZSkgcmVz dWx0cyBpbiBzdHJpbmcgJ1RydWUnIGluIG1hbmFnZWQgY29uZmlnIGZpbGUuCiAgIEFmdGVyIHhl bmQgcmVzdGFydCwgY29udmVyc2lvbiBpbnQoYm9vdGFibGUpIGluIHNlcnZlci9ibGtpZi5weSBm YWlscy4KMi4gc2VsZWN0aW9uIG9mIGJvb3RhYmxlIGRpc2tzIGluIFhlbmREb21haW5JbmZvLnB5 IHJlcXVpcmVzIHR5cGUoYm9vdGFibGUpID09IGludCBub3Qgc3RyLAogICBvdGhlcndpc2UgYWxs IGRpc2tzIGFyZSB0YWtlbiBhcyBib290YWJsZS4KClRoaXMgcGF0Y2gg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MSAyMDA5ICswMTAwCisrKyBiL3Rvb2xzL3B5dGhvbi94ZW4veGVuZC9YZW5kQ29uZmlnLnB5CVdl ZCBPY3QgMjEgMDk6MTE6MDMgMjAwOSArMDIwMApAQCAtMTQyOSw5ICsxNDI5LDE0IEBAIGNsYXNz IFhlbmRDb25maWcoZGljdCk6CiAgICAgICAgICAgICAgICAgaWYgcGFyYW0gbm90IGluIHRhcmdl dDoKICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0W3BhcmFtXSA9IFtdCiAgICAgICAgICAgICAg ICAgaWYgZGV2X3V1aWQgbm90IGluIHRhcmdldFtwYXJhbV06Ci0gICAgICAgICAgICAgICAgICAg IGlmIGRldl90eXBlID09ICd2YmQnIGFuZCAnYm9vdGFibGUnIG5vdCBpbiBkZXZfaW5mbzoKLSAg ICAgICAgICAgICAgICAgICAgICAgICMgQ29tcGF0IGhhY2sgLS0gbWFyayBmaXJzdCBkaXNrIGJv b3RhYmxlCi0gICAgICAgICAgICAgICAgICAgICAgICBkZXZfaW5mb1snYm9vdGFibGUnXSA9IGlu dChub3QgdGFyZ2V0W3BhcmFtXSkKKyAgICAgICAgICAgICAgICAgICAgaWYgZGV2X3R5cGUgPT0g J3ZiZCc6CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAnYm9vdGFibGUnIG5vdCBpbiBkZXZf aW5mbzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAjIENvbXBhdCBoYWNrIC0tIG1hcmsg Zmlyc3QgZGlzayBib290YWJsZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldl9pbmZv Wydib290YWJsZSddID0gaW50KG5vdCB0YXJnZXRbcGFyYW1dKQorICAgICAgICAgICAgICAgICAg ICAgICAgZWxzZToKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAjIGVuc3VyZSB0eXBlIG9m IGJvb3RhYmxlIGlzIGludCAob24geGVuZCByZXN0YXJ0CisgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIyBpdCdzIG9mIHR5cGUgc3RyKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRl dl9pbmZvWydib290YWJsZSddID0gaW50KGRldl9pbmZvWydib290YWJsZSddKSAgICAgICAgICAg ICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICB0YXJnZXRbcGFyYW1dLmFwcGVuZChk ZXZfdXVpZCkKICAgICAgICAgICAgIGVsaWYgZGV2X3R5cGUgPT0gJ3RhcCcgb3IgZGV2X3R5cGUg PT0gJ3RhcDInOgogICAgICAgICAgICAgICAgIGlmICd2YmRfcmVmcycgbm90IGluIHRhcmdldDoK QEAgLTE0NDAsNiArMTQ0NSwxMCBAQCBjbGFzcyBYZW5kQ29uZmlnKGRpY3QpOgogICAgICAgICAg ICAgICAgICAgICBpZiAnYm9vdGFibGUnIG5vdCBpbiBkZXZfaW5mbzoKICAgICAgICAgICAgICAg ICAgICAgICAgICMgQ29tcGF0IGhhY2sgLS0gbWFyayBmaXJzdCBkaXNrIGJvb3RhYmxlCiAgICAg ICAgICAgICAgICAgICAgICAgICBkZXZfaW5mb1snYm9vdGFibGUnXSA9IGludChub3QgdGFyZ2V0 Wyd2YmRfcmVmcyddKQorICAgICAgICAgICAgICAgICAgICBlbHNlOgorICAgICAgICAgICAgICAg ICAgICAgICAgIyBlbnN1cmUgdHlwZSBvZiBib290YWJsZSBpcyBpbnQgKG9uIHhlbmQgcmVzdGFy dCBpdCdzCisgICAgICAgICAgICAgICAgICAgICAgICAjIG9mIHR5cGUgc3RyKQorICAgICAgICAg ICAgICAgICAgICAgICAgZGV2X2luZm9bJ2Jvb3RhYmxlJ10gPSBpbnQoZGV2X2luZm9bJ2Jvb3Rh YmxlJ10pICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgIHRhcmdl dFsndmJkX3JlZnMnXS5hcHBlbmQoZGV2X3V1aWQpCiAgICAgICAgICAgICAgICAgICAgIAogICAg ICAgICAgICAgZWxpZiBkZXZfdHlwZSA9PSAndmZiJzoK --_004_3958B14F314B884890EEE2F4CCDAB6A601031EDB927AABGEX73EFSC_ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --_004_3958B14F314B884890EEE2F4CCDAB6A601031EDB927AABGEX73EFSC_--