Revision bdd55f71
b/lib/cmdlib.py | ||
---|---|---|
2694 | 2694 |
HTYPE = constants.HTYPE_INSTANCE |
2695 | 2695 |
_OP_REQP = ["instance_name", "mem_size", "disk_size", "pnode", |
2696 | 2696 |
"disk_template", "swap_size", "mode", "start", "vcpus", |
2697 |
"wait_for_sync"] |
|
2697 |
"wait_for_sync", "ip_check"]
|
|
2698 | 2698 |
|
2699 | 2699 |
def BuildHooksEnv(self): |
2700 | 2700 |
"""Build hooks env. |
... | ... | |
2862 | 2862 |
inst_ip = ip |
2863 | 2863 |
self.inst_ip = inst_ip |
2864 | 2864 |
|
2865 |
command = ["fping", "-q", hostname1.ip] |
|
2866 |
result = utils.RunCmd(command) |
|
2867 |
if not result.failed: |
|
2868 |
raise errors.OpPrereqError("IP %s of instance %s already in use" % |
|
2869 |
(hostname1.ip, instance_name)) |
|
2865 |
if self.op.start and not self.op.ip_check: |
|
2866 |
raise errors.OpPrereqError("Cannot ignore IP address conflicts when" |
|
2867 |
" adding an instance in start mode") |
|
2868 |
|
|
2869 |
if self.op.ip_check: |
|
2870 |
command = ["fping", "-q", hostname1.ip] |
|
2871 |
result = utils.RunCmd(command) |
|
2872 |
if not result.failed: |
|
2873 |
raise errors.OpPrereqError("IP address %s of instance %s already" |
|
2874 |
" in use" % (hostname1.ip, instance_name)) |
|
2870 | 2875 |
|
2871 | 2876 |
# bridge verification |
2872 | 2877 |
bridge = getattr(self.op, "bridge", None) |
b/lib/opcodes.py | ||
---|---|---|
138 | 138 |
__slots__ = ["instance_name", "mem_size", "disk_size", "os_type", "pnode", |
139 | 139 |
"disk_template", "snode", "swap_size", "mode", |
140 | 140 |
"vcpus", "ip", "bridge", "src_node", "src_path", "start", |
141 |
"wait_for_sync"] |
|
141 |
"wait_for_sync", "ip_check"]
|
|
142 | 142 |
|
143 | 143 |
|
144 | 144 |
class OpReinstallInstance(OpCode): |
b/scripts/gnt-backup | ||
---|---|---|
131 | 131 |
metavar="<node>"), |
132 | 132 |
make_option("--src-dir", dest="src_dir", help="Source directory", |
133 | 133 |
metavar="<dir>"), |
134 |
make_option("--no-ip-check", dest="ip_check", default=True, |
|
135 |
action="store_false", help="Don't check that the instance's IP" |
|
136 |
" is alive"), |
|
134 | 137 |
] |
135 | 138 |
|
136 | 139 |
commands = { |
b/scripts/gnt-instance | ||
---|---|---|
187 | 187 |
mode=constants.INSTANCE_CREATE, |
188 | 188 |
os_type=opts.os, pnode=opts.node, |
189 | 189 |
snode=opts.snode, vcpus=opts.vcpus, |
190 |
ip=opts.ip, bridge=opts.bridge, start=True, |
|
190 |
ip=opts.ip, bridge=opts.bridge, |
|
191 |
start=opts.start, ip_check=opts.ip_check, |
|
191 | 192 |
wait_for_sync=opts.wait_for_sync) |
192 | 193 |
SubmitOpCode(op) |
193 | 194 |
return 0 |
... | ... | |
602 | 603 |
metavar="<node>"), |
603 | 604 |
make_option("-b", "--bridge", dest="bridge", |
604 | 605 |
help="Bridge to connect this instance to", |
605 |
default=None, metavar="<bridge>") |
|
606 |
default=None, metavar="<bridge>"), |
|
607 |
make_option("--no-start", dest="start", default=True, |
|
608 |
action="store_false", help="Don't start the instance after" |
|
609 |
" creation"), |
|
610 |
make_option("--no-ip-check", dest="ip_check", default=True, |
|
611 |
action="store_false", help="Don't check that the instance's IP" |
|
612 |
" is alive (only valid with --no-start)"), |
|
606 | 613 |
] |
607 | 614 |
|
608 | 615 |
commands = { |
Also available in: Unified diff