Revision c38c44ad scripts/gnt-backup
b/scripts/gnt-backup | ||
---|---|---|
24 | 24 |
# W0614: Unused import %s from wildcard import (since we need cli) |
25 | 25 |
|
26 | 26 |
import sys |
27 |
from optparse import make_option |
|
28 | 27 |
|
29 | 28 |
from ganeti.cli import * |
30 | 29 |
from ganeti import opcodes |
... | ... | |
212 | 211 |
# this is defined separately due to readability only |
213 | 212 |
import_opts = [ |
214 | 213 |
DEBUG_OPT, |
215 |
make_option("-n", "--node", dest="node",
|
|
216 |
help="Target node and optional secondary node",
|
|
217 |
metavar="<pnode>[:<snode>]"),
|
|
214 |
cli_option("-n", "--node", dest="node",
|
|
215 |
help="Target node and optional secondary node", |
|
216 |
metavar="<pnode>[:<snode>]"), |
|
218 | 217 |
cli_option("-B", "--backend", dest="beparams", |
219 | 218 |
type="keyval", default={}, |
220 | 219 |
help="Backend parameters"), |
221 |
make_option("-t", "--disk-template", dest="disk_template",
|
|
222 |
help="Custom disk setup (diskless, file, plain, drbd)",
|
|
223 |
default=None, metavar="TEMPL"),
|
|
220 |
cli_option("-t", "--disk-template", dest="disk_template",
|
|
221 |
help="Custom disk setup (diskless, file, plain, drbd)", |
|
222 |
default=None, metavar="TEMPL"), |
|
224 | 223 |
cli_option("--disk", help="Disk information", |
225 | 224 |
default=[], dest="disks", |
226 | 225 |
action="append", |
... | ... | |
233 | 232 |
default=[], dest="nics", |
234 | 233 |
action="append", |
235 | 234 |
type="identkeyval"), |
236 |
make_option("--no-nics", default=False, action="store_true",
|
|
237 |
help="Do not create any network cards for the instance"),
|
|
238 |
make_option("--no-wait-for-sync", dest="wait_for_sync", default=True,
|
|
239 |
action="store_false", help="Don't wait for sync (DANGEROUS!)"),
|
|
240 |
make_option("--src-node", dest="src_node", help="Source node",
|
|
241 |
metavar="<node>"),
|
|
242 |
make_option("--src-dir", dest="src_dir", help="Source directory",
|
|
243 |
metavar="<dir>"),
|
|
244 |
make_option("--no-ip-check", dest="ip_check", default=True,
|
|
245 |
action="store_false", help="Don't check that the instance's IP"
|
|
246 |
" is alive"),
|
|
247 |
make_option("-I", "--iallocator", metavar="<NAME>",
|
|
248 |
help="Select nodes for the instance automatically using the"
|
|
249 |
" <NAME> iallocator plugin", default=None, type="string"),
|
|
250 |
make_option("--file-storage-dir", dest="file_storage_dir",
|
|
251 |
help="Relative path under default cluster-wide file storage dir"
|
|
252 |
" to store file-based disks", default=None,
|
|
253 |
metavar="<DIR>"),
|
|
254 |
make_option("--file-driver", dest="file_driver", help="Driver to use"
|
|
255 |
" for image files", default="loop", metavar="<DRIVER>"),
|
|
235 |
cli_option("--no-nics", default=False, action="store_true",
|
|
236 |
help="Do not create any network cards for the instance"), |
|
237 |
cli_option("--no-wait-for-sync", dest="wait_for_sync", default=True,
|
|
238 |
action="store_false", help="Don't wait for sync (DANGEROUS!)"), |
|
239 |
cli_option("--src-node", dest="src_node", help="Source node",
|
|
240 |
metavar="<node>"), |
|
241 |
cli_option("--src-dir", dest="src_dir", help="Source directory",
|
|
242 |
metavar="<dir>"), |
|
243 |
cli_option("--no-ip-check", dest="ip_check", default=True,
|
|
244 |
action="store_false", help="Don't check that the instance's IP" |
|
245 |
" is alive"), |
|
246 |
cli_option("-I", "--iallocator", metavar="<NAME>",
|
|
247 |
help="Select nodes for the instance automatically using the" |
|
248 |
" <NAME> iallocator plugin", default=None, type="string"), |
|
249 |
cli_option("--file-storage-dir", dest="file_storage_dir",
|
|
250 |
help="Relative path under default cluster-wide file storage dir" |
|
251 |
" to store file-based disks", default=None, |
|
252 |
metavar="<DIR>"), |
|
253 |
cli_option("--file-driver", dest="file_driver", help="Driver to use"
|
|
254 |
" for image files", default="loop", metavar="<DRIVER>"), |
|
256 | 255 |
cli_option("-H", "--hypervisor", dest="hypervisor", |
257 |
help="Hypervisor and hypervisor options, in the format"
|
|
258 |
" hypervisor:option=value,option=value,...", default=None,
|
|
259 |
type="identkeyval"),
|
|
256 |
help="Hypervisor and hypervisor options, in the format" |
|
257 |
" hypervisor:option=value,option=value,...", default=None, |
|
258 |
type="identkeyval"), |
|
260 | 259 |
] |
261 | 260 |
|
262 | 261 |
commands = { |
263 | 262 |
'list': (PrintExportList, [], |
264 | 263 |
[DEBUG_OPT, |
265 |
make_option("--node", dest="nodes", default=[], action="append",
|
|
266 |
help="List only backups stored on this node"
|
|
267 |
" (can be used multiple times)"),
|
|
264 |
cli_option("--node", dest="nodes", default=[], action="append",
|
|
265 |
help="List only backups stored on this node" |
|
266 |
" (can be used multiple times)"), |
|
268 | 267 |
], |
269 | 268 |
"", "Lists instance exports available in the ganeti cluster"), |
270 | 269 |
'export': (ExportInstance, [ArgInstance(min=1, max=1)], |
271 | 270 |
[DEBUG_OPT, FORCE_OPT, |
272 |
make_option("-n", "--node", dest="node", help="Target node",
|
|
273 |
metavar="<node>"),
|
|
274 |
make_option("","--noshutdown", dest="shutdown",
|
|
275 |
action="store_false", default=True,
|
|
276 |
help="Don't shutdown the instance (unsafe)"), ],
|
|
271 |
cli_option("-n", "--node", dest="node", help="Target node",
|
|
272 |
metavar="<node>"), |
|
273 |
cli_option("","--noshutdown", dest="shutdown",
|
|
274 |
action="store_false", default=True, |
|
275 |
help="Don't shutdown the instance (unsafe)"), ], |
|
277 | 276 |
"-n <target_node> [opts...] <name>", |
278 | 277 |
"Exports an instance to an image"), |
279 | 278 |
'import': (ImportInstance, [ArgInstance(min=1, max=1)], import_opts, |
Also available in: Unified diff