WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] xend: bootable flag of VBD not always of type int

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] xend: bootable flag of VBD not always of type int
From: "Dube, Lutz" <lutz.dube@xxxxxxxxxxxxxx>
Date: Wed, 21 Oct 2009 09:29:25 +0200
Accept-language: de-DE, en-US
Acceptlanguage: de-DE, en-US
Delivery-date: Wed, 21 Oct 2009 00:31:38 -0700
Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=ts.fujitsu.com; i=lutz.dube@xxxxxxxxxxxxxx; q=dns/txt; s=s1536b; t=1256110249; x=1287646249; h=from:sender:reply-to:subject:date:message-id:to:cc: mime-version:content-transfer-encoding:content-id: content-description:resent-date:resent-from:resent-sender: resent-to:resent-cc:resent-message-id:in-reply-to: references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:list-owner:list-archive; z=From:=20"Dube,=20Lutz"=20<lutz.dube@xxxxxxxxxxxxxx> |Subject:=20xend:=20bootable=20flag=20of=20VBD=20not=20al ways=20of=20type=20int|Date:=20Wed,=2021=20Oct=202009=200 9:29:25=20+0200|Message-ID:=20<3958B14F314B884890EEE2F4CC DAB6A601031EDB927A@xxxxxxxxxxxxxxxx>|To:=20"xen-devel@lis ts.xensource.com"=20<xen-devel@xxxxxxxxxxxxxxxxxxx> |MIME-Version:=201.0; bh=rypScjHMyz1FtkO+JRVx1qi0jJtwg1E30azkzzxhqpw=; b=uN0z262RvxXF3Ev6HGxvOZBoC31mzF4NUme/pu1wUlhB6eLbaLQCG758 6X4iQe5fAV68ERhz7vWoCCj0Pgy76P61de4+tlNGSkq7OeMWTG93F7/8d v/Feoh2vVFyqEkz5BpVSN2rxXFfYx6iuZiuhr01/E51i8KISjGVItoI69 FaSiZccKQyuevToAExzGjruzESgmO3ey7FBtz6Nx8bXBnPH4yemu2yYko GUg8fV7WqoTz0MSzLMLB17oPyl+lC;
Domainkey-signature: s=s1536a; d=ts.fujitsu.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:Received:From:To:Date: Subject:Thread-Topic:Thread-Index:Message-ID: Accept-Language:Content-Language:X-MS-Has-Attach: X-MS-TNEF-Correlator:acceptlanguage:Content-Type: MIME-Version; b=gS4Tnyg1bfiK2Gv3+SVFpsx8+VM8BRA/LfntsDyPMppVOw/Vj2Bd88l/ Yta908Et0Vvj2SwLTNs3jHX2+NAmeyk/2CsXoFRZoro55vzHz/kfZUNhR oek9no0sc9v2Wls+fwS8uF8SLcH84x8O83KmyTBORmQBzRq2R8AkgVv7P z6PLscGe+p3Fx7FwM+9jT60jCQI1c3LanxvdcEsor4XNZc5hal+U+2UEV b0lLraYTo3QyHB6cZ8VcCtWE9zMzB;
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcpSIDeCXFeEGiYVQJuVGdMuxPdztA==
Thread-topic: xend: bootable flag of VBD not always of type int
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/blkif.py fails.
2. selection of bootable disks in XendDomainInfo.py requires type(bootable) == int not str,
   otherwise all disks are taken as bootable.
 
This patch converts the bootable flag always to int.
 
Signed-off-by: Lutz.Dube@xxxxxxxxxxxxxx
 
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 = bool(bootable)
         xd = XendDomain.instance()
         vm = 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 +0100
+++ b/tools/python/xen/xend/XendConfig.py       Wed Oct 21 09:11:03 2009 +0200
@@ -1429,9 +1429,14 @@ class XendConfig(dict):
                 if param not in target:
                     target[param] = []
                 if dev_uuid not in target[param]:
-                    if dev_type == 'vbd' and 'bootable' not in dev_info:
-                        # Compat hack -- mark first disk bootable
-                        dev_info['bootable'] = int(not target[param])
+                    if dev_type == 'vbd':
+                        if 'bootable' not in dev_info:
+                            # Compat hack -- mark first disk bootable
+                            dev_info['bootable'] = int(not target[param])
+                        else:
+                            # ensure type of bootable is int (on xend restart
+                            # it's of type str)
+                            dev_info['bootable'] = int(dev_info['bootable'])                       
                     target[param].append(dev_uuid)
             elif dev_type == 'tap' or dev_type == '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'] = int(not target['vbd_refs'])
+                    else:
+                        # ensure type of bootable is int (on xend restart it's
+                        # of type str)
+                        dev_info['bootable'] = int(dev_info['bootable'])                       
                     target['vbd_refs'].append(dev_uuid)
 
             elif dev_type == 'vfb':
 
 
 
---
Kind regards
Lutz Dube
 
 

Attachment: patch_bootable
Description: patch_bootable

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] xend: bootable flag of VBD not always of type int, Dube, Lutz <=