Commit 519719fd authored by Marco Casavecchia's avatar Marco Casavecchia Committed by Iustin Pop
Browse files

Add 2 new variables to the OS scripts environment



Add INSTANCE_PRIMARY_NODE and INSTANCE_SECONDARY_NODES. These new
values are useful for OS scripts that needs to know the nodes where
the instance lives.. or has lived.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
[iustin@google.com: fixed small issue with SECONDARY_NODES]
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 456798ab
......@@ -2138,12 +2138,14 @@ def OSEnvironment(instance, inst_os, debug=0):
"""
result = OSCoreEnv(instance.os, inst_os, instance.osparams, debug=debug)
for attr in ["name", "os", "uuid", "ctime", "mtime"]:
for attr in ["name", "os", "uuid", "ctime", "mtime", "primary_node"]:
result["INSTANCE_%s" % attr.upper()] = str(getattr(instance, attr))
result['HYPERVISOR'] = instance.hypervisor
result['DISK_COUNT'] = '%d' % len(instance.disks)
result['NIC_COUNT'] = '%d' % len(instance.nics)
result['INSTANCE_SECONDARY_NODES'] = \
('%s' % " ".join(instance.secondary_nodes))
# Disks
for idx, disk in enumerate(instance.disks):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment