git://git.onelab.eu
/
bootmanager.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
64ddfcb
)
rename util get_block_device_list into get_block_devices_dict and clean up its usage
author
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Wed, 24 Jun 2015 14:47:45 +0000
(16:47 +0200)
committer
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Wed, 24 Jun 2015 14:47:45 +0000
(16:47 +0200)
source/steps/ChainBootNode.py
patch
|
blob
|
history
source/steps/CheckForNewDisks.py
patch
|
blob
|
history
source/steps/CheckHardwareRequirements.py
patch
|
blob
|
history
source/steps/InstallBootstrapFS.py
patch
|
blob
|
history
source/steps/ValidateNodeInstall.py
patch
|
blob
|
history
source/systeminfo.py
patch
|
blob
|
history
diff --git
a/source/steps/ChainBootNode.py
b/source/steps/ChainBootNode.py
index
f21a2ff
..
820aa7d
100644
(file)
--- a/
source/steps/ChainBootNode.py
+++ b/
source/steps/ChainBootNode.py
@@
-78,7
+78,7
@@
def Run(vars, log):
# simply creating an instance of this class and listing the system
# block devices will make them show up so vgscan can find the planetlab
# volume group
# simply creating an instance of this class and listing the system
# block devices will make them show up so vgscan can find the planetlab
# volume group
- systeminfo.get_block_device
_lis
t(vars, log)
+ systeminfo.get_block_device
s_dic
t(vars, log)
utils.sysexec("vgscan", log)
utils.sysexec("vgchange -ay planetlab", log)
utils.sysexec("vgscan", log)
utils.sysexec("vgchange -ay planetlab", log)
diff --git
a/source/steps/CheckForNewDisks.py
b/source/steps/CheckForNewDisks.py
index
60ae952
..
223c3ae
100644
(file)
--- a/
source/steps/CheckForNewDisks.py
+++ b/
source/steps/CheckForNewDisks.py
@@
-50,7
+50,7
@@
def Run(vars, log):
except ValueError as var:
raise BootManagerException("Variable in vars, shouldn't be: {}\n".format(var))
except ValueError as var:
raise BootManagerException("Variable in vars, shouldn't be: {}\n".format(var))
-
all_devices = systeminfo.get_block_device_lis
t(vars, log)
+
devices_dict = systeminfo.get_block_devices_dic
t(vars, log)
# will contain the new devices to add to the volume group
new_devices = []
# will contain the new devices to add to the volume group
new_devices = []
@@
-58,9
+58,9
@@
def Run(vars, log):
# total amount of new space in gb
extended_gb_size = 0
# total amount of new space in gb
extended_gb_size = 0
- for device
in all_devices.key
s():
+ for device
, details in devices_dict.item
s():
- (major, minor, blocks, gb_size, readonly) =
all_devices[device]
+ (major, minor, blocks, gb_size, readonly) =
details
if device[:14] == "/dev/planetlab":
log.write("Skipping device {} in volume group.\n".format(device))
if device[:14] == "/dev/planetlab":
log.write("Skipping device {} in volume group.\n".format(device))
diff --git
a/source/steps/CheckHardwareRequirements.py
b/source/steps/CheckHardwareRequirements.py
index
a3f8677
..
1e10362
100644
(file)
--- a/
source/steps/CheckHardwareRequirements.py
+++ b/
source/steps/CheckHardwareRequirements.py
@@
-110,7
+110,7
@@
def Run(vars, log):
# get a list of block devices to attempt to install on
# (may include cdrom devices)
# get a list of block devices to attempt to install on
# (may include cdrom devices)
- install_devices = systeminfo.get_block_device
_lis
t(vars, log)
+ install_devices = systeminfo.get_block_device
s_dic
t(vars, log)
# save the list of block devices in the log
log.write("Detected block devices:\n")
# save the list of block devices in the log
log.write("Detected block devices:\n")
@@
-147,37
+147,39
@@
def Run(vars, log):
# also, keep track of the total size for all devices that appear usable
total_size = 0
# also, keep track of the total size for all devices that appear usable
total_size = 0
- for device in install_devices.keys():
+ # do not modify subject of current loop
+ ignored_devices = []
+ for device, details in install_devices.items():
- major, minor, blocks, gb_size, readonly =
install_devices[device]
+ major, minor, blocks, gb_size, readonly =
details
# if the device string starts with
# planetlab or dm- (device mapper), ignore it (could be old lvm setup)
if device[:14] == "/dev/planetlab" or device[:8] == "/dev/dm-":
# if the device string starts with
# planetlab or dm- (device mapper), ignore it (could be old lvm setup)
if device[:14] == "/dev/planetlab" or device[:8] == "/dev/dm-":
- del install_devices[device]
+ ignored_devices.append(device)
continue
if gb_size < MINIMUM_DISK_SIZE:
log.write("Device is too small to use: {} \n"
"(appears to be {:4.2f} Gb)\n".format(device, gb_size))
continue
if gb_size < MINIMUM_DISK_SIZE:
log.write("Device is too small to use: {} \n"
"(appears to be {:4.2f} Gb)\n".format(device, gb_size))
- try:
- del install_devices[device]
- except KeyError as e:
- pass
+ ignored_devices.append(device)
continue
if readonly:
log.write("Device is readonly, not using: {}\n".format(device))
continue
if readonly:
log.write("Device is readonly, not using: {}\n".format(device))
- try:
- del install_devices[device]
- except KeyError as e:
- pass
+ ignored_devices.append(device)
continue
# add this sector count to the total count of usable
# sectors we've found.
total_size = total_size + gb_size
continue
# add this sector count to the total count of usable
# sectors we've found.
total_size = total_size + gb_size
+ # delayed erasure
+ for device in ignored_devices:
+ try:
+ del install_devices[device]
+ except KeyError as e:
+ pass
if len(install_devices) == 0:
log.write("No suitable block devices found for install.\n")
if len(install_devices) == 0:
log.write("No suitable block devices found for install.\n")
diff --git
a/source/steps/InstallBootstrapFS.py
b/source/steps/InstallBootstrapFS.py
index
24ea4bf
..
70d22a5
100644
(file)
--- a/
source/steps/InstallBootstrapFS.py
+++ b/
source/steps/InstallBootstrapFS.py
@@
-78,6
+78,13
@@
def Run(vars, upgrade, log):
bs_request = BootServerRequest.BootServerRequest(vars)
bs_request = BootServerRequest.BootServerRequest(vars)
+ # in upgrade mode, since we skip InstallPartitionDisks
+ # we need to run this
+ if upgrade:
+ log.write("Running vgscan for devices (upgrade mode)\n")
+ systeminfo.get_block_devices_dict(vars, log)
+ utils.sysexec_noerr("vgscan", log)
+
log.write("turning on swap space\n")
utils.sysexec("swapon {}".format(PARTITIONS["swap"]), log)
log.write("turning on swap space\n")
utils.sysexec("swapon {}".format(PARTITIONS["swap"]), log)
diff --git
a/source/steps/ValidateNodeInstall.py
b/source/steps/ValidateNodeInstall.py
index
529400d
..
becb675
100644
(file)
--- a/
source/steps/ValidateNodeInstall.py
+++ b/
source/steps/ValidateNodeInstall.py
@@
-71,7
+71,7
@@
def Run(vars, log):
# simply creating an instance of this class and listing the system
# block devices will make them show up so vgscan can find the planetlab
# volume group
# simply creating an instance of this class and listing the system
# block devices will make them show up so vgscan can find the planetlab
# volume group
- systeminfo.get_block_device
_lis
t(vars, log)
+ systeminfo.get_block_device
s_dic
t(vars, log)
try:
utils.sysexec("vgscan", log)
try:
utils.sysexec("vgscan", log)
diff --git
a/source/systeminfo.py
b/source/systeminfo.py
index
4536294
..
3140755
100755
(executable)
--- a/
source/systeminfo.py
+++ b/
source/systeminfo.py
@@
-103,7
+103,7
@@
def get_total_phsyical_mem(vars = {}, log = sys.stderr):
meminfo_file.close()
return total_memory
meminfo_file.close()
return total_memory
-def get_block_device
_lis
t(vars = {}, log = sys.stderr):
+def get_block_device
s_dic
t(vars = {}, log = sys.stderr):
"""
get a list of block devices from this system.
return an associative array, where the device name
"""
get a list of block devices from this system.
return an associative array, where the device name
@@
-348,7
+348,7
@@
def getKernelVersion(vars = {}, log = sys.stderr):
if __name__ == "__main__":
if __name__ == "__main__":
- devices = get_block_device
_lis
t()
+ devices = get_block_device
s_dic
t()
print("block devices detected:")
if not devices:
print("no devices found!")
print("block devices detected:")
if not devices:
print("no devices found!")