Revision d962dbf9 lib/watcher/__init__.py
b/lib/watcher/__init__.py | ||
---|---|---|
137 | 137 |
"""Abstraction for a Virtual Machine instance. |
138 | 138 |
|
139 | 139 |
""" |
140 |
def __init__(self, name, status, autostart, snodes):
|
|
140 |
def __init__(self, name, status, disks_active, snodes):
|
|
141 | 141 |
self.name = name |
142 | 142 |
self.status = status |
143 |
self.autostart = autostart
|
|
143 |
self.disks_active = disks_active
|
|
144 | 144 |
self.snodes = snodes |
145 | 145 |
|
146 | 146 |
def Restart(self, cl): |
... | ... | |
246 | 246 |
instance_name) |
247 | 247 |
continue |
248 | 248 |
|
249 |
if not inst.autostart:
|
|
250 |
logging.info("Skipping disk activation for non-autostart"
|
|
251 |
" instance '%s'", inst.name)
|
|
249 |
if not inst.disks_active:
|
|
250 |
logging.info("Skipping disk activation for instance with not"
|
|
251 |
" activated disks '%s'", inst.name)
|
|
252 | 252 |
continue |
253 | 253 |
|
254 | 254 |
if inst.name in started: |
... | ... | |
626 | 626 |
job = [ |
627 | 627 |
# Get all primary instances in group |
628 | 628 |
opcodes.OpQuery(what=constants.QR_INSTANCE, |
629 |
fields=["name", "status", "admin_state", "snodes",
|
|
629 |
fields=["name", "status", "disks_active", "snodes",
|
|
630 | 630 |
"pnode.group.uuid", "snodes.group.uuid"], |
631 | 631 |
qfilter=[qlang.OP_EQUAL, "pnode.group.uuid", uuid], |
632 | 632 |
use_locking=True), |
... | ... | |
657 | 657 |
instances = [] |
658 | 658 |
|
659 | 659 |
# Load all instances |
660 |
for (name, status, autostart, snodes, pnode_group_uuid,
|
|
660 |
for (name, status, disks_active, snodes, pnode_group_uuid,
|
|
661 | 661 |
snodes_group_uuid) in raw_instances: |
662 | 662 |
if snodes and set([pnode_group_uuid]) != set(snodes_group_uuid): |
663 | 663 |
logging.error("Ignoring split instance '%s', primary group %s, secondary" |
664 | 664 |
" groups %s", name, pnode_group_uuid, |
665 | 665 |
utils.CommaJoin(snodes_group_uuid)) |
666 | 666 |
else: |
667 |
instances.append(Instance(name, status, autostart, snodes))
|
|
667 |
instances.append(Instance(name, status, disks_active, snodes))
|
|
668 | 668 |
|
669 | 669 |
for node in snodes: |
670 | 670 |
secondaries.setdefault(node, set()).add(name) |
Also available in: Unified diff