Revision 4289f617 lib/cmdlib/instance.py
b/lib/cmdlib/instance.py | ||
---|---|---|
524 | 524 |
|
525 | 525 |
if self.op.opportunistic_locking: |
526 | 526 |
self.opportunistic_locks[locking.LEVEL_NODE] = True |
527 |
self.opportunistic_locks[locking.LEVEL_NODE_RES] = True |
|
528 | 527 |
else: |
529 | 528 |
self.op.pnode = ExpandNodeName(self.cfg, self.op.pnode) |
530 | 529 |
nodelist = [self.op.pnode] |
... | ... | |
560 | 559 |
self.needed_locks[locking.LEVEL_NODE_RES] = \ |
561 | 560 |
CopyLockList(self.needed_locks[locking.LEVEL_NODE]) |
562 | 561 |
|
562 |
def DeclareLocks(self, level): |
|
563 |
if level == locking.LEVEL_NODE_RES and \ |
|
564 |
self.opportunistic_locks[locking.LEVEL_NODE]: |
|
565 |
# Even when using opportunistic locking, we require the same set of |
|
566 |
# NODE_RES locks as we got NODE locks |
|
567 |
self.needed_locks[locking.LEVEL_NODE_RES] = \ |
|
568 |
self.owned_locks(locking.LEVEL_NODE) |
|
569 |
|
|
563 | 570 |
def _RunAllocator(self): |
564 | 571 |
"""Run the allocator based on input opcode. |
565 | 572 |
|
... | ... | |
1873 | 1880 |
|
1874 | 1881 |
if self.op.opportunistic_locking: |
1875 | 1882 |
self.opportunistic_locks[locking.LEVEL_NODE] = True |
1876 |
self.opportunistic_locks[locking.LEVEL_NODE_RES] = True |
|
1877 | 1883 |
else: |
1878 | 1884 |
nodeslist = [] |
1879 | 1885 |
for inst in self.op.instances: |
... | ... | |
1888 | 1894 |
# prevent accidential modification) |
1889 | 1895 |
self.needed_locks[locking.LEVEL_NODE_RES] = list(nodeslist) |
1890 | 1896 |
|
1897 |
def DeclareLocks(self, level): |
|
1898 |
if level == locking.LEVEL_NODE_RES and \ |
|
1899 |
self.opportunistic_locks[locking.LEVEL_NODE]: |
|
1900 |
# Even when using opportunistic locking, we require the same set of |
|
1901 |
# NODE_RES locks as we got NODE locks |
|
1902 |
self.needed_locks[locking.LEVEL_NODE_RES] = \ |
|
1903 |
self.owned_locks(locking.LEVEL_NODE) |
|
1904 |
|
|
1891 | 1905 |
def CheckPrereq(self): |
1892 | 1906 |
"""Check prerequisite. |
1893 | 1907 |
|
Also available in: Unified diff