You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by lf...@apache.org on 2021/08/19 16:32:06 UTC

[incubator-datalab] 01/01: [DATALAB-1837]: fixed inability to cp/mv files due to wrong disk mount path

This is an automated email from the ASF dual-hosted git repository.

lfrolov pushed a commit to branch DATALAB-1837
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git

commit 3b1d971d18a45dd904587922458df8ba294a325b
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Thu Aug 19 19:31:52 2021 +0300

    [DATALAB-1837]: fixed inability to cp/mv files due to wrong disk mount path
---
 .../src/general/lib/azure/actions_lib.py                      | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/infrastructure-provisioning/src/general/lib/azure/actions_lib.py b/infrastructure-provisioning/src/general/lib/azure/actions_lib.py
index 66859ff..3a5accf 100644
--- a/infrastructure-provisioning/src/general/lib/azure/actions_lib.py
+++ b/infrastructure-provisioning/src/general/lib/azure/actions_lib.py
@@ -1232,6 +1232,15 @@ def remount_azure_disk(creds=False, os_user='', hostname='', keyfile=''):
     if creds:
         conn.close()
 
+def ensure_right_mount_paths():
+    opt_disk = datalab.fab.conn.sudo("cat /etc/fstab | grep /opt/ | awk '{print $1}'").stdout.split('\n')[0].split('/')[2]
+    if opt_disk not in datalab.fab.conn.sudo("lsblk | grep /opt", warn=True).stdout or opt_disk in datalab.fab.conn.sudo("fdisk -l | grep 'BIOS boot'").stdout:
+         disk_names = datalab.fab.conn.sudo("lsblk | grep disk | awk '{print $1}' | sort").stdout.split('\n')
+         for disk in disk_names:
+             if disk != '' and disk not in datalab.fab.conn.sudo('lsblk | grep -E "(mnt|media)"').stdout and disk not in datalab.fab.conn.sudo("fdisk -l | grep 'BIOS boot'").stdout:
+                 datalab.fab.conn.sudo("umount -l /opt")
+                 datalab.fab.conn.sudo("mount /dev/{}1 /opt".format(disk))
+                 datalab.fab.conn.sudo('sed -i "/opt/ s|/dev/{}|/dev/{}1|g" /etc/fstab'.format(opt_disk, disk))
 
 def prepare_vm_for_image(creds=False, os_user='', hostname='', keyfile=''):
     if creds:
@@ -1285,6 +1294,8 @@ def prepare_disk(os_user):
             traceback.print_exc()
             print('Error:', str(err))
             sys.exit(1)
+    else:
+        ensure_right_mount_paths()
 
 
 def ensure_local_spark(os_user, spark_link, spark_version, hadoop_version, local_spark_path):

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org