components/openstack/nova/patches/06-Solaris-dev-name.patch
branchs11-update
changeset 4072 db0cec748ec0
child 5405 66fd59fecd68
equal deleted inserted replaced
4067:4be1f488dda8 4072:db0cec748ec0
       
     1 The patch is to fix the issue of linuxy devices names on Solaris instance recorded
       
     2 in the bugs (19987962 and 19277019).
       
     3 
       
     4 --- nova-2014.2.2/nova/compute/utils.py.~1~	2015-02-05 06:26:50.000000000 -0800
       
     5 +++ nova-2014.2.2/nova/compute/utils.py	2015-02-09 10:13:15.882810433 -0800
       
     6 @@ -148,6 +148,23 @@
       
     7      /dev/vdc is specified but the backend uses /dev/xvdc), the device
       
     8      name will be converted to the appropriate format.
       
     9      """
       
    10 +    if driver.compute_driver_matches('solariszones.SolarisZonesDriver'):
       
    11 +        prefix = 'c1d'
       
    12 +        if device_name_list == []:
       
    13 +            # Return the root device (c1d0)
       
    14 +            return 'c1d0'
       
    15 +
       
    16 +        # Remove non-Solaris devices names (like, /dev/sda, sdb, ...)
       
    17 +        # if they exist in the instance.
       
    18 +        device_name_list = \
       
    19 +            [dev for dev in device_name_list if prefix in dev]
       
    20 +        device_name_list.sort()
       
    21 +
       
    22 +        # find the least unused number from '0' (root device)
       
    23 +        used_nums = [int(dev.rsplit('d')[-1]) for dev in device_name_list]
       
    24 +        diff = [i for i in range(len(used_nums) + 1) if i not in used_nums]
       
    25 +        return prefix + str(min(diff))
       
    26 +
       
    27      req_prefix = None
       
    28      req_letter = None
       
    29