Revision f4ad2ef0 tools/lvmstrap
b/tools/lvmstrap | ||
---|---|---|
192 | 192 |
if os.getuid() != 0: |
193 | 193 |
raise PrereqError("This tool runs as root only. Really.") |
194 | 194 |
|
195 |
osname, nodename, release, version, arch = os.uname()
|
|
195 |
osname, _, release, _, _ = os.uname()
|
|
196 | 196 |
if osname != 'Linux': |
197 | 197 |
raise PrereqError("This tool only runs on Linux" |
198 | 198 |
" (detected OS: %s)." % osname) |
... | ... | |
271 | 271 |
""" |
272 | 272 |
|
273 | 273 |
path = "/dev/%s" % name |
274 |
for retries in range(40):
|
|
274 |
for _ in range(40):
|
|
275 | 275 |
if os.path.exists(path): |
276 | 276 |
break |
277 | 277 |
time.sleep(0.250) |
... | ... | |
426 | 426 |
mountlines = ReadFile("/proc/mounts").splitlines() |
427 | 427 |
mounts = {} |
428 | 428 |
for line in mountlines: |
429 |
device, mountpoint, fstype, rest = line.split(None, 3)
|
|
429 |
_, mountpoint, fstype, _ = line.split(None, 3)
|
|
430 | 430 |
# fs type blacklist |
431 | 431 |
if fstype in ["nfs", "nfs4", "autofs", "tmpfs", "proc", "sysfs"]: |
432 | 432 |
continue |
... | ... | |
542 | 542 |
boolean, the in-use status of the device |
543 | 543 |
""" |
544 | 544 |
|
545 |
for retries in range(3):
|
|
545 |
for _ in range(3):
|
|
546 | 546 |
result = ExecCommand("blockdev --rereadpt /dev/%s" % name) |
547 | 547 |
if not result.failed: |
548 | 548 |
break |
... | ... | |
672 | 672 |
" non-removable block devices).") |
673 | 673 |
sysd_free = [] |
674 | 674 |
sysd_used = [] |
675 |
for name, size, dev, part, used in sysdisks:
|
|
675 |
for name, _, _, _, used in sysdisks:
|
|
676 | 676 |
if used: |
677 | 677 |
sysd_used.append(name) |
678 | 678 |
else: |
... | ... | |
726 | 726 |
CreatePVOnDisk(disk) |
727 | 727 |
CreateVG(vgname, disklist) |
728 | 728 |
|
729 |
status, lv_count, size, free = CheckVGExists(vgname)
|
|
729 |
status, lv_count, size, _ = CheckVGExists(vgname)
|
|
730 | 730 |
if status: |
731 | 731 |
print "Done! %s: size %s GiB, disks: %s" % (vgname, size, |
732 | 732 |
",".join(disklist)) |
Also available in: Unified diff