Revision 5f23e043 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
5619 | 5619 |
"hvparams", "beparams"] |
5620 | 5620 |
REQ_BGL = False |
5621 | 5621 |
|
5622 |
def CheckArguments(self): |
|
5623 |
"""Check arguments. |
|
5624 |
|
|
5625 |
""" |
|
5626 |
# do not require name_check to ease forward/backward compatibility |
|
5627 |
# for tools |
|
5628 |
if not hasattr(self.op, "name_check"): |
|
5629 |
self.op.name_check = True |
|
5630 |
if self.op.ip_check and not self.op.name_check: |
|
5631 |
# TODO: make the ip check more flexible and not depend on the name check |
|
5632 |
raise errors.OpPrereqError("Cannot do ip checks without a name check", |
|
5633 |
errors.ECODE_INVAL) |
|
5634 |
|
|
5622 | 5635 |
def _ExpandNode(self, node): |
5623 | 5636 |
"""Expands and checks one node name. |
5624 | 5637 |
|
... | ... | |
5683 | 5696 |
#### instance parameters check |
5684 | 5697 |
|
5685 | 5698 |
# instance name verification |
5686 |
hostname1 = utils.GetHostInfo(self.op.instance_name) |
|
5687 |
self.op.instance_name = instance_name = hostname1.name |
|
5699 |
if self.op.name_check: |
|
5700 |
hostname1 = utils.GetHostInfo(self.op.instance_name) |
|
5701 |
self.op.instance_name = instance_name = hostname1.name |
|
5702 |
# used in CheckPrereq for ip ping check |
|
5703 |
self.check_ip = hostname1.ip |
|
5704 |
else: |
|
5705 |
instance_name = self.op.instance_name |
|
5706 |
self.check_ip = None |
|
5688 | 5707 |
|
5689 | 5708 |
# this is just a preventive check, but someone might still add this |
5690 | 5709 |
# instance in the meantime, and creation will fail at lock-add time |
... | ... | |
5713 | 5732 |
if ip is None or ip.lower() == constants.VALUE_NONE: |
5714 | 5733 |
nic_ip = None |
5715 | 5734 |
elif ip.lower() == constants.VALUE_AUTO: |
5735 |
if not self.op.name_check: |
|
5736 |
raise errors.OpPrereqError("IP address set to auto but name checks" |
|
5737 |
" have been skipped. Aborting.", |
|
5738 |
errors.ECODE_INVAL) |
|
5716 | 5739 |
nic_ip = hostname1.ip |
5717 | 5740 |
else: |
5718 | 5741 |
if not utils.IsValidIP(ip): |
... | ... | |
5780 | 5803 |
errors.ECODE_INVAL) |
5781 | 5804 |
self.disks.append({"size": size, "mode": mode}) |
5782 | 5805 |
|
5783 |
# used in CheckPrereq for ip ping check |
|
5784 |
self.check_ip = hostname1.ip |
|
5785 |
|
|
5786 | 5806 |
# file storage checks |
5787 | 5807 |
if (self.op.file_driver and |
5788 | 5808 |
not self.op.file_driver in constants.FILE_DRIVER): |
Also available in: Unified diff