@@ -18,17 +18,9 @@ def is_nuc_whl_clr(names, vmid):
18
18
19
19
20
20
def is_mount_needed (virt_io , vmid ):
21
- rootfs_img = ''
22
- blk_dev_list = launch_cfg_lib .get_rootdev_info (launch_cfg_lib .BOARD_INFO_FILE )
23
- if virt_io ['block' ][vmid ]:
24
- if ':' in virt_io ['block' ][vmid ]:
25
- blk_dev = virt_io ['block' ][vmid ].split (':' )[0 ]
26
- rootfs_img = virt_io ['block' ][vmid ].split (':' )[1 ]
27
- else :
28
- blk_dev = virt_io ['block' ][vmid ]
29
21
30
- if blk_dev in blk_dev_list and rootfs_img :
31
- return True
22
+ if True in launch_cfg_lib . MOUNT_FLAG_DIC [ vmid ] :
23
+ return True
32
24
33
25
return False
34
26
@@ -40,12 +32,20 @@ def tap_uos_net(names, virt_io, vmid, config):
40
32
vm_name = launch_cfg_lib .undline_name (uos_type ).lower ()
41
33
42
34
if uos_type in ("CLEARLINUX" , "ANDROID" , "ALIOS" ):
43
- if board_name in ("apl-mrb" , "apl-up2" ):
44
- print ('if [ ! -f "/data/{}/{}.img" ]; then' .format (vm_name , vm_name ), file = config )
45
- print (' echo "no /data/{}/{}.img, exit"' .format (vm_name , vm_name ), file = config )
35
+ i = 0
36
+ for mount_flag in launch_cfg_lib .MOUNT_FLAG_DIC [vmid ]:
37
+ if not mount_flag :
38
+ i += 1
39
+ continue
40
+ blk = virt_io ['block' ][vmid ][i ]
41
+ rootfs_img = blk .split (':' )[1 ].strip (':' )
42
+ print ('if [ ! -f "/data{}/{}" ]; then' .format (i , rootfs_img ), file = config )
43
+ print (' echo "no /data{}/{}, exit"' .format (i , rootfs_img ), file = config )
46
44
print (" exit" , file = config )
47
45
print ("fi" , file = config )
48
46
print ("" , file = config )
47
+ i += 1
48
+
49
49
print ("#vm-name used to generate uos-mac address" , file = config )
50
50
print ("mac=$(cat /sys/class/net/e*/address)" , file = config )
51
51
print ("vm_name=vm$1" , file = config )
@@ -331,7 +331,14 @@ def uos_launch(names, args, virt_io, vmid, config):
331
331
print ("" , file = config )
332
332
print ('launch_{} {} "{}" "{}" $debug' .format (launch_uos , vmid , gvt_args , vmid ), file = config )
333
333
print ("" , file = config )
334
- print ("umount /data" , file = config )
334
+
335
+ i = 0
336
+ for mount_flag in launch_cfg_lib .MOUNT_FLAG_DIC [vmid ]:
337
+ if not mount_flag :
338
+ i += 1
339
+ continue
340
+ print ("umount /data{}" .format (i ), file = config )
341
+ i += 1
335
342
336
343
337
344
def launch_end (names , args , virt_io , vmid , config ):
@@ -361,16 +368,21 @@ def launch_end(names, args, virt_io, vmid, config):
361
368
print ("" , file = config )
362
369
363
370
if is_mount_needed (virt_io , vmid ):
364
- root_fs = virt_io ['block' ][vmid ].split (':' )[0 ]
365
-
366
- print ('if [ ! -b "{}" ]; then' .format (root_fs ), file = config )
367
- print (' echo "no {} data partition, exit"' .format (root_fs ), file = config )
368
- print (" exit" , file = config )
369
- print ("fi" , file = config )
370
- print ("" , file = config )
371
- print ("mkdir -p /data" , file = config )
372
- print ("mount {} /data" .format (root_fs ), file = config )
373
- print ("" , file = config )
371
+ i = 0
372
+ for mount_flag in launch_cfg_lib .MOUNT_FLAG_DIC [vmid ]:
373
+ if not mount_flag :
374
+ i += 1
375
+ continue
376
+ blk = virt_io ['block' ][vmid ][i ]
377
+ root_fs = blk .split (':' )[0 ]
378
+ print ('if [ ! -b "{}" ]; then' .format (root_fs ), file = config )
379
+ print (' echo "no {} data partition, exit"' .format (root_fs ), file = config )
380
+ print (" exit" , file = config )
381
+ print ("fi" , file = config )
382
+ print ("mkdir -p /data{}" .format (i ), file = config )
383
+ print ("mount {} /data{}" .format (root_fs , i ), file = config )
384
+ print ("" , file = config )
385
+ i += 1
374
386
375
387
off_line_cpus (args , vmid , uos_type , config )
376
388
@@ -455,9 +467,19 @@ def virtio_args_set(dm, virt_io, vmid, config):
455
467
launch_cfg_lib .virtual_dev_slot ("virtio-input{}" .format (input_val )), input_val ), file = config )
456
468
457
469
# virtio-blk set, the value type is a list
458
- for blk in virt_io ['block' ][vmid ]:
459
- if blk :
460
- print (" -s {},virtio-blk,{} \\ " .format (launch_cfg_lib .virtual_dev_slot ("virtio-blk{}" .format (blk )), blk .strip (':' )), file = config )
470
+ i = 0
471
+ for mount_flag in launch_cfg_lib .MOUNT_FLAG_DIC [vmid ]:
472
+ blk = virt_io ['block' ][vmid ][i ]
473
+ if not mount_flag :
474
+ if blk :
475
+ rootfs_img = blk .strip (':' )
476
+ print (" -s {},virtio-blk,{} \\ " .format (launch_cfg_lib .virtual_dev_slot ("virtio-blk{}" .format (blk )), rootfs_img ), file = config )
477
+ i += 1
478
+ continue
479
+
480
+ rootfs_img = blk .split (':' )[1 ].strip (':' )
481
+ print (" -s {},virtio-blk,/data{}/{} \\ " .format (launch_cfg_lib .virtual_dev_slot ("blk_mount_{}" .format (i )), i , rootfs_img ), file = config )
482
+ i += 1
461
483
462
484
# virtio-net set, the value type is a list
463
485
for net in virt_io ['network' ][vmid ]:
0 commit comments