Revision 0d68c45d lib/config.py
b/lib/config.py | ||
---|---|---|
588 | 588 |
"""Set the instance's status to a given value. |
589 | 589 |
|
590 | 590 |
""" |
591 |
if status not in ("up", "down"): |
|
592 |
raise errors.ProgrammerError("Invalid status '%s' passed to" |
|
593 |
" ConfigWriter._SetInstanceStatus()" % |
|
594 |
status) |
|
591 |
assert isinstance(status, bool), \ |
|
592 |
"Invalid status '%s' passed to SetInstanceStatus" % (status,) |
|
595 | 593 |
|
596 | 594 |
if instance_name not in self._config_data.instances: |
597 | 595 |
raise errors.ConfigurationError("Unknown instance '%s'" % |
598 | 596 |
instance_name) |
599 | 597 |
instance = self._config_data.instances[instance_name] |
600 |
if instance.status != status:
|
|
601 |
instance.status = status
|
|
598 |
if instance.admin_up != status:
|
|
599 |
instance.admin_up = status
|
|
602 | 600 |
instance.serial_no += 1 |
603 | 601 |
self._WriteConfig() |
604 | 602 |
|
... | ... | |
607 | 605 |
"""Mark the instance status to up in the config. |
608 | 606 |
|
609 | 607 |
""" |
610 |
self._SetInstanceStatus(instance_name, "up")
|
|
608 |
self._SetInstanceStatus(instance_name, True)
|
|
611 | 609 |
|
612 | 610 |
@locking.ssynchronized(_config_lock) |
613 | 611 |
def RemoveInstance(self, instance_name): |
... | ... | |
651 | 649 |
"""Mark the status of an instance to down in the configuration. |
652 | 650 |
|
653 | 651 |
""" |
654 |
self._SetInstanceStatus(instance_name, "down")
|
|
652 |
self._SetInstanceStatus(instance_name, False)
|
|
655 | 653 |
|
656 | 654 |
def _UnlockedGetInstanceList(self): |
657 | 655 |
"""Get the list of instances. |
Also available in: Unified diff