@@ -122,7 +122,7 @@ def get_connection(self):
122122
123123class BaseLinuxOSMountTools (BaseSSHOSMountTools ):
124124 def _get_pvs (self ):
125- out = self ._exec_cmd ("sudo pvdisplay -c" ).decode (). splitlines ()
125+ out = self ._exec_cmd ("sudo pvdisplay -c" ).splitlines ()
126126 LOG .debug ("Output of 'pvdisplay -c' command: %s" , out )
127127 pvs = {}
128128 for line in out :
@@ -150,7 +150,7 @@ def _get_vgs(self):
150150 """
151151 vgs_cmd = (
152152 "sudo vgs -o vg_name,pv_name,vg_uuid, --noheadings --separator :" )
153- out = self ._exec_cmd (vgs_cmd ).decode (). splitlines ()
153+ out = self ._exec_cmd (vgs_cmd ).splitlines ()
154154 LOG .debug ("Output of %s command: %s" , vgs_cmd , out )
155155 vgs_uuid_map = {}
156156 for line in out :
@@ -197,8 +197,7 @@ def _check_vgs(self):
197197
198198 def _get_vgnames (self ):
199199 vg_names = []
200- vgscan_out_lines = self ._exec_cmd (
201- "sudo vgscan" ).decode ().splitlines ()
200+ vgscan_out_lines = self ._exec_cmd ("sudo vgscan" ).splitlines ()
202201 LOG .debug ("Output of vgscan commnad: %s" , vgscan_out_lines )
203202 for vgscan_out_line in vgscan_out_lines :
204203 m = re .match (
@@ -212,7 +211,7 @@ def _get_vgnames(self):
212211 def _get_lv_paths (self ):
213212 """ Returns list with paths of available LVM volumes. """
214213 lvm_paths = []
215- out = self ._exec_cmd ("sudo lvdisplay -c" ).decode (). strip ()
214+ out = self ._exec_cmd ("sudo lvdisplay -c" ).strip ()
216215 if out :
217216 LOG .debug ("Decoded `lvdisplay` output data: %s" , out )
218217 out_lines = out .splitlines ()
@@ -353,7 +352,7 @@ def _check_mount_fstab_partitions(
353352 def _get_symlink_target (self , symlink ):
354353 target = symlink
355354 try :
356- target = self ._exec_cmd ('readlink -en %s' % symlink ). decode ()
355+ target = self ._exec_cmd ('readlink -en %s' % symlink )
357356 LOG .debug ("readlink %s returned: %s" % (symlink , target ))
358357 except Exception :
359358 LOG .warn ('Target not found for symlink: %s. Original link path '
@@ -375,8 +374,7 @@ def _get_device_file_paths(self, symlink_list):
375374 return dev_file_paths
376375
377376 def _get_mounted_devices (self ):
378- mounts = self ._exec_cmd (
379- "cat /proc/mounts" ).decode ().splitlines ()
377+ mounts = self ._exec_cmd ("cat /proc/mounts" ).splitlines ()
380378 ret = []
381379 mounted_device_numbers = []
382380 dev_nmb_cmd = "mountpoint -x %s"
@@ -390,10 +388,9 @@ def _get_mounted_devices(self):
390388 continue
391389 ret .append (dev_name )
392390 mounted_device_numbers .append (
393- self ._exec_cmd (dev_nmb_cmd % dev_name ).decode (). rstrip ())
391+ self ._exec_cmd (dev_nmb_cmd % dev_name ).rstrip ())
394392
395- block_devs = self ._exec_cmd (
396- "ls -al /dev | grep ^b" ).decode ().splitlines ()
393+ block_devs = self ._exec_cmd ("ls -al /dev | grep ^b" ).splitlines ()
397394 for dev_line in block_devs :
398395 dev = dev_line .split ()
399396 major_minor = "%s:%s" % (
@@ -409,8 +406,7 @@ def _get_mounted_devices(self):
409406 return ret
410407
411408 def _get_mount_destinations (self ):
412- mounts = self ._exec_cmd (
413- "cat /proc/mounts" ).decode ().splitlines ()
409+ mounts = self ._exec_cmd ("cat /proc/mounts" ).splitlines ()
414410 ret = set ()
415411 for line in mounts :
416412 colls = line .split ()
@@ -424,8 +420,7 @@ def _get_volume_block_devices(self):
424420 # where 'ln -s /dev/dm-N /dev/<VG-name>/<LV-name>'
425421 # Querying for the kernel device name (KNAME) should ensure we get the
426422 # device names we desire both for physical and logical volumes.
427- volume_devs = self ._exec_cmd (
428- "lsblk -lnao KNAME" ).decode ().splitlines ()
423+ volume_devs = self ._exec_cmd ("lsblk -lnao KNAME" ).splitlines ()
429424 LOG .debug ("All block devices: %s" , str (volume_devs ))
430425
431426 volume_devs = ["/dev/%s" % d for d in volume_devs if
@@ -446,7 +441,7 @@ def _find_dev_with_contents(self, devices, all_files=None,
446441 dev_name = None
447442 for dev_path in devices :
448443 dirs = None
449- tmp_dir = self ._exec_cmd ('mktemp -d' ).decode (). splitlines ()[0 ]
444+ tmp_dir = self ._exec_cmd ('mktemp -d' ).splitlines ()[0 ]
450445 try :
451446 self ._exec_cmd ('sudo mount %s %s' % (dev_path , tmp_dir ))
452447 # NOTE: it's possible that the device was mounted successfully
@@ -508,7 +503,7 @@ def _find_and_mount_root(self, devices):
508503 "being migrated." )
509504
510505 try :
511- tmp_dir = self ._exec_cmd ('mktemp -d' ).decode (). splitlines ()[0 ]
506+ tmp_dir = self ._exec_cmd ('mktemp -d' ).splitlines ()[0 ]
512507 self ._exec_cmd ('sudo mount %s %s' % (os_root_device , tmp_dir ))
513508 os_root_dir = tmp_dir
514509 except Exception as ex :
@@ -560,7 +555,7 @@ def mount_os(self):
560555 for volume_dev in volume_devs :
561556 self ._exec_cmd ("sudo partx -v -a %s || true" % volume_dev )
562557 dev_paths += self ._exec_cmd (
563- "sudo ls -1 %s*" % volume_dev ).decode (). splitlines ()
558+ "sudo ls -1 %s*" % volume_dev ).splitlines ()
564559 LOG .debug ("All simple devices to scan: %s" , dev_paths )
565560
566561 lvm_dev_paths = []
@@ -573,7 +568,7 @@ def mount_os(self):
573568 self ._exec_cmd ("sudo vgchange -ay -S vg_uuid=%s" % vg_uuid )
574569 self ._exec_cmd ("sudo vgchange --refresh" )
575570 dev_paths_for_group = self ._exec_cmd (
576- f"sudo ls -1 /dev/{ vg_props ['name' ]} /*" ).decode (). splitlines ()
571+ f"sudo ls -1 /dev/{ vg_props ['name' ]} /*" ).splitlines ()
577572 lvm_dev_paths .extend (dev_paths_for_group )
578573 LOG .debug ("All LVM vols to scan: %s" , lvm_dev_paths )
579574
@@ -592,8 +587,8 @@ def mount_os(self):
592587 dev_path , dev_target )
593588 continue
594589 fs_type = self ._exec_cmd (
595- "sudo blkid -o value -s TYPE %s || true" %
596- dev_path ). decode ( ).splitlines ()
590+ "sudo blkid -o value -s TYPE %s || true" % dev_path
591+ ).splitlines ()
597592 LOG .debug ('Device %s filesystem types: %s' , dev_path , fs_type )
598593 if fs_type and fs_type [0 ] in valid_filesystems :
599594 if fs_type [0 ] == "xfs" :
0 commit comments