Commit ca83454f authored by Thomas Thrainer's avatar Thomas Thrainer
Browse files

Make the disks_active flag queryable



gnt-instance list now also supports the disks_active field.
Signed-off-by: default avatarThomas Thrainer <thomasth@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent a8e07057
......@@ -2075,6 +2075,9 @@ def _BuildInstanceFields():
(_MakeField("admin_up", "Autostart", QFT_BOOL,
"Desired state of instance"),
IQ_CONFIG, 0, lambda ctx, inst: inst.admin_state == constants.ADMINST_UP),
(_MakeField("disks_active", "DisksActive", QFT_BOOL,
"Desired state of instance disks"),
IQ_CONFIG, 0, _GetItemAttr("disks_active")),
(_MakeField("tags", "Tags", QFT_OTHER, "Tags"), IQ_CONFIG, 0,
lambda ctx, inst: list(inst.GetTags())),
(_MakeField("console", "Console", QFT_OTHER,
......
......@@ -677,6 +677,7 @@ class TestInstanceQuery(unittest.TestCase):
primary_node="node1",
disk_template=constants.DT_PLAIN,
disks=[],
disks_active=True,
osparams={}),
objects.Instance(name="inst2", hvparams={}, nics=[],
uuid="73a0f8a7-068c-4630-ada2-c3440015ab1a",
......@@ -686,6 +687,7 @@ class TestInstanceQuery(unittest.TestCase):
primary_node="node5",
disk_template=constants.DT_DISKLESS,
disks=[],
disks_active=True,
beparams={
constants.BE_MAXMEM: 512,
constants.BE_MINMEM: 256,
......@@ -699,6 +701,7 @@ class TestInstanceQuery(unittest.TestCase):
primary_node="node6",
disk_template=constants.DT_DRBD8,
disks=[],
disks_active=False,
nics=[
objects.NIC(ip="192.0.2.99", mac=macs.pop(),
nicparams={
......@@ -715,6 +718,7 @@ class TestInstanceQuery(unittest.TestCase):
primary_node="nodeoff2",
disk_template=constants.DT_DRBD8,
disks=[],
disks_active=True,
nics=[
objects.NIC(ip="192.0.2.1", mac=macs.pop(),
nicparams={
......@@ -740,6 +744,7 @@ class TestInstanceQuery(unittest.TestCase):
primary_node="nodebad2",
disk_template=constants.DT_DISKLESS,
disks=[],
disks_active=True,
beparams={
constants.BE_MAXMEM: 512,
constants.BE_MINMEM: 512,
......@@ -753,6 +758,7 @@ class TestInstanceQuery(unittest.TestCase):
primary_node="node7",
disk_template=constants.DT_DISKLESS,
disks=[],
disks_active=False,
beparams={
constants.BE_MAXMEM: 768,
constants.BE_MINMEM: 256,
......@@ -768,6 +774,7 @@ class TestInstanceQuery(unittest.TestCase):
primary_node="node6",
disk_template=constants.DT_DISKLESS,
disks=[],
disks_active=False,
beparams={},
osparams={}),
objects.Instance(name="inst8", hvparams={}, nics=[],
......@@ -778,6 +785,7 @@ class TestInstanceQuery(unittest.TestCase):
primary_node="node6",
disk_template=constants.DT_DISKLESS,
disks=[],
disks_active=False,
beparams={},
osparams={}),
]
......
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