This commit is contained in:
committed by
Git OBS Bridge
parent
28b141bb6f
commit
0a63222b01
@@ -115,9 +115,9 @@ class Wholedisk:
|
||||
if not os.path.exists(ldev):
|
||||
break
|
||||
i += 1
|
||||
fd = os.popen("losetup %s %s 2> /dev/null" % (ldev, self.pdev))
|
||||
fd = os.popen("losetup %s '%s' 2> /dev/null" % (ldev, self.pdev))
|
||||
if not fd.close():
|
||||
verbose_print("losetup %s %s" % (ldev, self.pdev))
|
||||
verbose_print("losetup %s '%s'" % (ldev, self.pdev))
|
||||
self.ldev = ldev
|
||||
break
|
||||
if not self.ldev:
|
||||
@@ -149,13 +149,14 @@ class Wholedisk:
|
||||
self.loopsetup()
|
||||
# TODO: We could use fdisk -l instead and look at the type of
|
||||
# partitions; this way we could also detect LVM and support it.
|
||||
fd = os.popen("kpartx -l %s" % self.physdev())
|
||||
fd = os.popen("kpartx -l '%s'" % self.physdev())
|
||||
pcount = 0
|
||||
for line in fd.readlines():
|
||||
line = line.strip()
|
||||
verbose_print("kpartx -l: %s" % (line,))
|
||||
(pname, params) = line.split(':')
|
||||
pno = int(traildigits(pname.strip()))
|
||||
pname = pname.strip()
|
||||
pno = int(traildigits(pname))
|
||||
#if pname.rfind('/') != -1:
|
||||
# pname = pname[pname.rfind('/')+1:]
|
||||
#pname = self.pdev[:self.pdev.rfind('/')] + '/' + pname
|
||||
@@ -177,8 +178,8 @@ class Wholedisk:
|
||||
if not self.mapped:
|
||||
self.loopsetup()
|
||||
if self.pcount:
|
||||
verbose_print("kpartx -a %s" % self.physdev())
|
||||
fd = os.popen("kpartx -a %s" % self.physdev())
|
||||
verbose_print("kpartx -a '%s'" % self.physdev())
|
||||
fd = os.popen("kpartx -a '%s'" % self.physdev())
|
||||
fd.close()
|
||||
self.mapped += 1
|
||||
|
||||
@@ -192,8 +193,8 @@ class Wholedisk:
|
||||
self.mapped -= 1
|
||||
if not self.mapped:
|
||||
if self.pcount:
|
||||
verbose_print("kpartx -d %s" % self.physdev())
|
||||
fd = os.popen("kpartx -d %s" % self.physdev())
|
||||
verbose_print("kpartx -d '%s'" % self.physdev())
|
||||
fd = os.popen("kpartx -d '%s'" % self.physdev())
|
||||
fd.close()
|
||||
self.loopclean()
|
||||
|
||||
@@ -251,11 +252,11 @@ class Partition:
|
||||
if fstype:
|
||||
mopts += " -t %s" % fstype
|
||||
mopts += " -o %s" % options
|
||||
verbose_print("mount %s %s %s" % (mopts, self.pdev, mtpt))
|
||||
fd = os.popen("mount %s %s %s" % (mopts, self.pdev, mtpt))
|
||||
verbose_print("mount %s '%s' %s" % (mopts, self.pdev, mtpt))
|
||||
fd = os.popen("mount %s '%s' %s" % (mopts, self.pdev, mtpt))
|
||||
err = fd.close()
|
||||
if err:
|
||||
raise RuntimeError("Error %i from mount %s %s on %s" % \
|
||||
raise RuntimeError("Error %i from mount %s '%s' on %s" % \
|
||||
(err, mopts, self.pdev, mtpt))
|
||||
self.mountpoint = mtpt
|
||||
|
||||
|
Reference in New Issue
Block a user