Change-Id: Ic1b21d8c46e27c5327f395aeedebd697ba7c2202
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/2501
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>
| ... | ... |
@@ -15,12 +15,12 @@ class Device(object): |
| 15 | 15 |
|
| 16 | 16 |
@staticmethod |
| 17 | 17 |
def refresh_devices(): |
| 18 |
- devices_list = subprocess.check_output(['lsblk', '-S', '-I', '8', '-n', '--output', 'NAME,SIZE,MODEL'], stderr=open(os.devnull, 'w')) |
|
| 18 |
+ devices_list = subprocess.check_output(['lsblk', '-d', '-I', '8,259', '-n', '--output', 'NAME,SIZE,MODEL'], stderr=open(os.devnull, 'w')) |
|
| 19 | 19 |
return Device.wrap_devices_from_list(devices_list) |
| 20 | 20 |
|
| 21 | 21 |
@staticmethod |
| 22 | 22 |
def refresh_devices_bytes(): |
| 23 |
- devices_list = subprocess.check_output(['lsblk', '-S', '--bytes', '-I', '8', '-n', '--output', 'NAME,SIZE,MODEL'], stderr=open(os.devnull, 'w')) |
|
| 23 |
+ devices_list = subprocess.check_output(['lsblk', '-d', '--bytes', '-I', '8,259', '-n', '--output', 'NAME,SIZE,MODEL'], stderr=open(os.devnull, 'w')) |
|
| 24 | 24 |
return Device.wrap_devices_from_list(devices_list) |
| 25 | 25 |
|
| 26 | 26 |
@staticmethod |
| ... | ... |
@@ -57,10 +57,12 @@ def partition_disk(disk, partitions): |
| 57 | 57 |
extensible_partition = partition |
| 58 | 58 |
else: |
| 59 | 59 |
partition_cmd.extend(['-n', '{}::+{}M'.format(partition_number, partition['size'])])
|
| 60 |
- |
|
| 61 |
- partition['partition_number'] = partition_number |
|
| 62 |
- partition['path'] = disk + `partition_number` |
|
| 63 |
- partition_number = partition_number + 1 |
|
| 60 |
+ |
|
| 61 |
+ partition['partition_number'] = partition_number |
|
| 62 |
+ prefix = '' |
|
| 63 |
+ if 'nvme' in disk: |
|
| 64 |
+ prefix = 'p' |
|
| 65 |
+ partition['path'] = disk + prefix + `partition_number` |
|
| 64 | 66 |
|
| 65 | 67 |
# Adding the last extendible partition |
| 66 | 68 |
if extensible_partition: |