From 2864f2d950a28aa44ca5e32ddba61220d791b423 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 20 Nov 2008 06:18:45 +0000 Subject: [PATCH] Change Xen hypervisor to not use iv_name Currently the iv_name is very linux-specific, and will break with the multi-disk changes. The patch changes this to generate sdX names based on the disk index in the disks structure, instead of relying on the iv_name. Reviewed-by: imsnah --- lib/hypervisor/hv_xen.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py index 39730b7ca..8dc48ddc5 100644 --- a/lib/hypervisor/hv_xen.py +++ b/lib/hypervisor/hv_xen.py @@ -249,12 +249,18 @@ class XenHypervisor(hv_base.BaseHypervisor): constants.FD_BLKTAP: "tap:aio", } disk_data = [] - for cfdev, rldev in block_devices: + if len(block_devices) > 24: + # 'z' - 'a' = 24 + raise errors.HypervisorError("Too many disks") + # FIXME: instead of this hardcoding here, each of PVM/HVM should + # directly export their info (currently HVM will just sed this info) + namespace = ["sd" + chr(i + ord('a')) for i in range(24)] + for sd_name, (cfdev, rldev) in zip(namespace, block_devices): if cfdev.dev_type == constants.LD_FILE: line = "'%s:%s,%s,w'" % (FILE_DRIVER_MAP[cfdev.physical_id[0]], - rldev.dev_path, cfdev.iv_name) + rldev.dev_path, sd_name) else: - line = "'phy:%s,%s,w'" % (rldev.dev_path, cfdev.iv_name) + line = "'phy:%s,%s,w'" % (rldev.dev_path, sd_name) disk_data.append(line) return disk_data -- GitLab