Revision 1fe10404
b/tools/cfgupgrade | ||
---|---|---|
52 | 52 |
#: Target major version we will upgrade to |
53 | 53 |
TARGET_MAJOR = 2 |
54 | 54 |
#: Target minor version we will upgrade to |
55 |
TARGET_MINOR = 9
|
|
55 |
TARGET_MINOR = 10
|
|
56 | 56 |
#: Target major version for downgrade |
57 | 57 |
DOWNGRADE_MAJOR = 2 |
58 | 58 |
#: Target minor version for downgrade |
59 |
DOWNGRADE_MINOR = 8
|
|
59 |
DOWNGRADE_MINOR = 9
|
|
60 | 60 |
|
61 | 61 |
|
62 | 62 |
class Error(Exception): |
... | ... | |
350 | 350 |
UpgradeInstanceIndices(config_data) |
351 | 351 |
|
352 | 352 |
|
353 |
def DowngradeDisks(disks, owner): |
|
354 |
for disk in disks: |
|
355 |
# Remove spindles to downgrade to 2.8 |
|
356 |
if "spindles" in disk: |
|
357 |
logging.warning("Removing spindles (value=%s) from disk %s (%s) of" |
|
358 |
" instance %s", |
|
359 |
disk["spindles"], disk["iv_name"], disk["uuid"], owner) |
|
360 |
del disk["spindles"] |
|
361 |
|
|
362 |
|
|
363 |
def DowngradeInstances(config_data): |
|
364 |
if "instances" not in config_data: |
|
365 |
raise Error("Cannot find the 'instances' key in the configuration!") |
|
366 |
for (iname, iobj) in config_data["instances"].items(): |
|
367 |
if "disks" not in iobj: |
|
368 |
raise Error("Cannot find 'disks' key for instance %s" % iname) |
|
369 |
DowngradeDisks(iobj["disks"], iname) |
|
370 |
|
|
371 |
|
|
372 |
def DowngradeNodeIndices(config_data): |
|
373 |
ChangeNodeIndices(config_data, "uuid", "name") |
|
374 |
|
|
375 |
|
|
376 |
def DowngradeInstanceIndices(config_data): |
|
377 |
ChangeInstanceIndices(config_data, "uuid", "name") |
|
378 |
|
|
379 |
|
|
380 | 353 |
def DowngradeAll(config_data): |
381 | 354 |
# Any code specific to a particular version should be labeled that way, so |
382 | 355 |
# it can be removed when updating to the next version. |
383 | 356 |
config_data["version"] = constants.BuildVersion(DOWNGRADE_MAJOR, |
384 | 357 |
DOWNGRADE_MINOR, 0) |
385 |
DowngradeInstances(config_data) |
|
386 |
DowngradeNodeIndices(config_data) |
|
387 |
DowngradeInstanceIndices(config_data) |
|
388 | 358 |
|
389 | 359 |
|
390 | 360 |
def main(): |
Also available in: Unified diff