Revision 57821cac lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
4312 | 4312 |
"""Query runtime instance data. |
4313 | 4313 |
|
4314 | 4314 |
""" |
4315 |
_OP_REQP = ["instances"] |
|
4315 |
_OP_REQP = ["instances", "static"]
|
|
4316 | 4316 |
REQ_BGL = False |
4317 | 4317 |
|
4318 | 4318 |
def ExpandNames(self): |
... | ... | |
4359 | 4359 |
"""Compute block device status. |
4360 | 4360 |
|
4361 | 4361 |
""" |
4362 |
self.cfg.SetDiskID(dev, instance.primary_node) |
|
4363 |
dev_pstatus = self.rpc.call_blockdev_find(instance.primary_node, dev) |
|
4362 |
static = self.op.static |
|
4363 |
if not static: |
|
4364 |
self.cfg.SetDiskID(dev, instance.primary_node) |
|
4365 |
dev_pstatus = self.rpc.call_blockdev_find(instance.primary_node, dev) |
|
4366 |
else: |
|
4367 |
dev_pstatus = None |
|
4368 |
|
|
4364 | 4369 |
if dev.dev_type in constants.LDS_DRBD: |
4365 | 4370 |
# we change the snode then (otherwise we use the one passed in) |
4366 | 4371 |
if dev.logical_id[0] == instance.primary_node: |
... | ... | |
4368 | 4373 |
else: |
4369 | 4374 |
snode = dev.logical_id[0] |
4370 | 4375 |
|
4371 |
if snode: |
|
4376 |
if snode and not static:
|
|
4372 | 4377 |
self.cfg.SetDiskID(dev, snode) |
4373 | 4378 |
dev_sstatus = self.rpc.call_blockdev_find(snode, dev) |
4374 | 4379 |
else: |
... | ... | |
4396 | 4401 |
"""Gather and return data""" |
4397 | 4402 |
result = {} |
4398 | 4403 |
for instance in self.wanted_instances: |
4399 |
remote_info = self.rpc.call_instance_info(instance.primary_node, |
|
4400 |
instance.name, |
|
4401 |
instance.hypervisor) |
|
4402 |
if remote_info and "state" in remote_info: |
|
4403 |
remote_state = "up" |
|
4404 |
if not self.op.static: |
|
4405 |
remote_info = self.rpc.call_instance_info(instance.primary_node, |
|
4406 |
instance.name, |
|
4407 |
instance.hypervisor) |
|
4408 |
if remote_info and "state" in remote_info: |
|
4409 |
remote_state = "up" |
|
4410 |
else: |
|
4411 |
remote_state = "down" |
|
4404 | 4412 |
else: |
4405 |
remote_state = "down"
|
|
4413 |
remote_state = None
|
|
4406 | 4414 |
if instance.status == "down": |
4407 | 4415 |
config_state = "down" |
4408 | 4416 |
else: |
Also available in: Unified diff