#!/usr/bin/python
from __future__ import print_function
import os
import sys

from resources.resources import VirtualMachines
from resources.shell import Shell


def to_array(networks):
    return [net for net in networks.split(',')]


args = sys.argv
f = os.path.basename(args[0])
until_c = Shell.define_until_completion(args, False)
vm = None

if len(args) == 3:
    vm = Shell(VirtualMachines()).deploy(name=args[1],
                                         networks=to_array(args[2]),
                                         until_completion=until_c,
                                         short_duration=False)

elif len(args) == 4:
    vm = Shell(VirtualMachines()).deploy(name=args[1],
                                         networks=to_array(args[2]),
                                         template=args[3],
                                         until_completion=until_c,
                                         short_duration=False)
Example #2
0
#!/usr/bin/python
from __future__ import print_function
import os
import sys

from resources.resources import Networks
from resources.shell import Shell

args = sys.argv
f = os.path.basename(args[0])
until_c = Shell.define_until_completion(args, True)

if len(args) == 3:
    Shell(Networks()).migrate(network=args[1],
                              offering=args[2],
                              until_completion=until_c)

elif len(args) == 4 and args[3] == 'resume':
    Shell(Networks()).migrate(network=args[1],
                              offering=args[2],
                              resume=True,
                              until_completion=until_c)

else:
    print('Usage: {} [--(a)sync] {{network}} {{offering}} [resume]'.format(f))