projects
/
ganeti-local
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cfgupgrade: Refactor code
[ganeti-local]
/
tools
/
lvmstrap
diff --git
a/tools/lvmstrap
b/tools/lvmstrap
index
eb87cd2
..
b79dc11
100755
(executable)
--- a/
tools/lvmstrap
+++ b/
tools/lvmstrap
@@
-1,7
+1,7
@@
#!/usr/bin/python
#
#!/usr/bin/python
#
-# Copyright (C) 2006, 2007, 2011 Google Inc.
+# Copyright (C) 2006, 2007, 2011, 2012 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@
-68,7
+68,7
@@
SUPPORTED_TYPES = [
]
#: Excluded filesystem types
]
#: Excluded filesystem types
-EXCLUDED_FS = frozenset([
+EXCLUDED_FS = compat.UniqueFrozenset([
"nfs",
"nfs4",
"autofs",
"nfs",
"nfs4",
"autofs",
@@
-208,7
+208,7
@@
def IsPartitioned(disk):
Currently only md devices are used as is.
"""
Currently only md devices are used as is.
"""
- return not (disk.startswith('md') or PART_RE.match(disk))
+ return not (disk.startswith("md") or PART_RE.match(disk))
def DeviceName(disk):
def DeviceName(disk):
@@
-219,9
+219,9
@@
def DeviceName(disk):
"""
if IsPartitioned(disk):
"""
if IsPartitioned(disk):
- device = '/dev/%s1' % disk
+ device = "/dev/%s1" % disk
else:
else:
- device = '/dev/%s' % disk
+ device = "/dev/%s" % disk
return device
return device
@@
-268,13
+268,13
@@
def CheckPrereq():
raise PrereqError("This tool runs as root only. Really.")
osname, _, release, _, _ = os.uname()
raise PrereqError("This tool runs as root only. Really.")
osname, _, release, _, _ = os.uname()
- if osname != 'Linux':
+ if osname != "Linux":
raise PrereqError("This tool only runs on Linux"
" (detected OS: %s)." % osname)
raise PrereqError("This tool only runs on Linux"
" (detected OS: %s)." % osname)
- if not release.startswith("2.6."):
+ if not (release.startswith("2.6.") or release.startswith("3.")):
raise PrereqError("Wrong major kernel version (detected %s, needs"
raise PrereqError("Wrong major kernel version (detected %s, needs"
- " 2.6.*)" % release)
+ " 2.6.* or 3.*)" % release)
if not os.path.ismount("/sys"):
raise PrereqError("Can't find a filesystem mounted at /sys."
if not os.path.ismount("/sys"):
raise PrereqError("Can't find a filesystem mounted at /sys."
@@
-336,7
+336,7
@@
def CheckSysDev(name, devnum):
@param name: the device name, e.g. 'sda'
@param devnum: the device number, e.g. 0x803 (2051 in decimal) for sda3
@param name: the device name, e.g. 'sda'
@param devnum: the device number, e.g. 0x803 (2051 in decimal) for sda3
- @raises L{SysconfigError}: in case of failure of the check
+ @raises SysconfigError: in case of failure of the check
"""
path = "/dev/%s" % name
"""
path = "/dev/%s" % name
@@
-568,13
+568,13
@@
def ShowDiskInfo(opts):
print "------- Disk information -------"
headers = {
print "------- Disk information -------"
headers = {
- "name": "Name",
- "size": "Size[M]",
- "used": "Used",
- "mount": "Mount",
- "lvm": "LVM?",
- "info": "Info"
- }
+ "name": "Name",
+ "size": "Size[M]",
+ "used": "Used",
+ "mount": "Mount",
+ "lvm": "LVM?",
+ "info": "Info",
+ }
fields = ["name", "size", "used", "mount", "lvm", "info"]
flatlist = []
fields = ["name", "size", "used", "mount", "lvm", "info"]
flatlist = []
@@
-905,7
+905,7
@@
def BootStrap():
status, lv_count, size, _ = CheckVGExists(vgname)
if status:
print "Done! %s: size %s GiB, disks: %s" % (vgname, size,
status, lv_count, size, _ = CheckVGExists(vgname)
if status:
print "Done! %s: size %s GiB, disks: %s" % (vgname, size,
- ",".join(disklist))
+ ",".join(disklist))
else:
raise OperationalError("Although everything seemed ok, the volume"
" group did not get created.")
else:
raise OperationalError("Although everything seemed ok, the volume"
" group did not get created.")