Revision b9322a9f lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
3650 | 3650 |
src_node = getattr(self.op, "src_node", None) |
3651 | 3651 |
src_path = getattr(self.op, "src_path", None) |
3652 | 3652 |
|
3653 |
if src_node is None or src_path is None: |
|
3654 |
raise errors.OpPrereqError("Importing an instance requires source" |
|
3655 |
" node and path options") |
|
3653 |
if src_path is None: |
|
3654 |
self.op.src_path = src_path = self.op.instance_name |
|
3656 | 3655 |
|
3657 |
if not os.path.isabs(src_path): |
|
3658 |
raise errors.OpPrereqError("The source path must be absolute") |
|
3659 |
|
|
3660 |
self.op.src_node = src_node = self._ExpandNode(src_node) |
|
3661 |
if self.needed_locks[locking.LEVEL_NODE] is not locking.ALL_SET: |
|
3662 |
self.needed_locks[locking.LEVEL_NODE].append(src_node) |
|
3656 |
if src_node is None: |
|
3657 |
self.needed_locks[locking.LEVEL_NODE] = locking.ALL_SET |
|
3658 |
self.op.src_node = None |
|
3659 |
if os.path.isabs(src_path): |
|
3660 |
raise errors.OpPrereqError("Importing an instance from an absolute" |
|
3661 |
" path requires a source node option.") |
|
3662 |
else: |
|
3663 |
self.op.src_node = src_node = self._ExpandNode(src_node) |
|
3664 |
if self.needed_locks[locking.LEVEL_NODE] is not locking.ALL_SET: |
|
3665 |
self.needed_locks[locking.LEVEL_NODE].append(src_node) |
|
3666 |
if not os.path.isabs(src_path): |
|
3667 |
self.op.src_path = src_path = \ |
|
3668 |
os.path.join(constants.EXPORT_DIR, src_path) |
|
3663 | 3669 |
|
3664 | 3670 |
else: # INSTANCE_CREATE |
3665 | 3671 |
if getattr(self.op, "os_type", None) is None: |
Also available in: Unified diff