Revision 4082e6f9
b/scripts/gnt-instance | ||
---|---|---|
418 | 418 |
"start": True, |
419 | 419 |
"ip_check": True, |
420 | 420 |
"hypervisor": None, |
421 |
"hvparams": {}, |
|
421 | 422 |
"file_storage_dir": None, |
422 | 423 |
"file_driver": 'loop'} |
423 | 424 |
|
... | ... | |
444 | 445 |
raise errors.OpPrereqError('You have to provide at least a primary_node' |
445 | 446 |
' or an iallocator.') |
446 | 447 |
|
447 |
if (spec['hypervisor'] and
|
|
448 |
not isinstance(spec['hypervisor'], dict)):
|
|
448 |
if (spec['hvparams'] and
|
|
449 |
not isinstance(spec['hvparams'], dict)):
|
|
449 | 450 |
raise errors.OpPrereqError('Hypervisor parameters must be a dict.') |
450 | 451 |
|
451 | 452 |
json_filename = args[0] |
452 |
fd = open(json_filename, 'r') |
|
453 | 453 |
try: |
454 |
fd = open(json_filename, 'r') |
|
454 | 455 |
instance_data = simplejson.load(fd) |
455 |
finally: |
|
456 | 456 |
fd.close() |
457 |
except Exception, err: |
|
458 |
ToStderr("Can't parse the instance definition file: %s" % str(err)) |
|
459 |
return 1 |
|
457 | 460 |
|
458 | 461 |
# Iterate over the instances and do: |
459 | 462 |
# * Populate the specs with default value |
... | ... | |
464 | 467 |
specs = _PopulateWithDefaults(specs) |
465 | 468 |
_Validate(specs) |
466 | 469 |
|
467 |
hypervisor = None |
|
468 |
hvparams = {} |
|
469 |
if specs['hypervisor']: |
|
470 |
hypervisor, hvparams = specs['hypervisor'].iteritems() |
|
470 |
hypervisor = specs['hypervisor'] |
|
471 |
hvparams = specs['hvparams'] |
|
471 | 472 |
|
472 | 473 |
disks = [] |
473 | 474 |
for elem in specs['disk_size']: |
Also available in: Unified diff