Revision f22a8ba3
b/lib/cmdlib.py | ||
---|---|---|
1832 | 1832 |
|
1833 | 1833 |
""" |
1834 | 1834 |
_OP_REQP = ["instance_name"] |
1835 |
REQ_BGL = False |
|
1836 |
|
|
1837 |
def ExpandNames(self): |
|
1838 |
self._ExpandAndLockInstance() |
|
1839 |
self.needed_locks[locking.LEVEL_NODE] = [] |
|
1840 |
self.recalculate_locks[locking.LEVEL_NODE] = constants.LOCKS_REPLACE |
|
1841 |
|
|
1842 |
def DeclareLocks(self, level): |
|
1843 |
if level == locking.LEVEL_NODE: |
|
1844 |
self._LockInstancesNodes() |
|
1835 | 1845 |
|
1836 | 1846 |
def CheckPrereq(self): |
1837 | 1847 |
"""Check prerequisites. |
... | ... | |
1839 | 1849 |
This checks that the instance is in the cluster. |
1840 | 1850 |
|
1841 | 1851 |
""" |
1842 |
instance = self.cfg.GetInstanceInfo( |
|
1843 |
self.cfg.ExpandInstanceName(self.op.instance_name)) |
|
1844 |
if instance is None: |
|
1845 |
raise errors.OpPrereqError("Instance '%s' not known" % |
|
1846 |
self.op.instance_name) |
|
1847 |
self.instance = instance |
|
1848 |
|
|
1852 |
self.instance = self.cfg.GetInstanceInfo(self.op.instance_name) |
|
1853 |
assert self.instance is not None, \ |
|
1854 |
"Cannot retrieve locked instance %s" % self.op.instance_name |
|
1849 | 1855 |
|
1850 | 1856 |
def Exec(self, feedback_fn): |
1851 | 1857 |
"""Activate the disks. |
... | ... | |
1939 | 1945 |
|
1940 | 1946 |
""" |
1941 | 1947 |
_OP_REQP = ["instance_name"] |
1948 |
REQ_BGL = False |
|
1949 |
|
|
1950 |
def ExpandNames(self): |
|
1951 |
self._ExpandAndLockInstance() |
|
1952 |
self.needed_locks[locking.LEVEL_NODE] = [] |
|
1953 |
self.recalculate_locks[locking.LEVEL_NODE] = constants.LOCKS_REPLACE |
|
1954 |
|
|
1955 |
def DeclareLocks(self, level): |
|
1956 |
if level == locking.LEVEL_NODE: |
|
1957 |
self._LockInstancesNodes() |
|
1942 | 1958 |
|
1943 | 1959 |
def CheckPrereq(self): |
1944 | 1960 |
"""Check prerequisites. |
... | ... | |
1946 | 1962 |
This checks that the instance is in the cluster. |
1947 | 1963 |
|
1948 | 1964 |
""" |
1949 |
instance = self.cfg.GetInstanceInfo( |
|
1950 |
self.cfg.ExpandInstanceName(self.op.instance_name)) |
|
1951 |
if instance is None: |
|
1952 |
raise errors.OpPrereqError("Instance '%s' not known" % |
|
1953 |
self.op.instance_name) |
|
1954 |
self.instance = instance |
|
1965 |
self.instance = self.cfg.GetInstanceInfo(self.op.instance_name) |
|
1966 |
assert self.instance is not None, \ |
|
1967 |
"Cannot retrieve locked instance %s" % self.op.instance_name |
|
1955 | 1968 |
|
1956 | 1969 |
def Exec(self, feedback_fn): |
1957 | 1970 |
"""Deactivate the disks |
Also available in: Unified diff