コード例 #1
0
def main():
    provider = Vm('aws')

    # print(provider.list())
    # pprit(provider.start('a-b=luoyu-0'))
    # provider.stop('a-b=luoyu-0')
    # pprint(provider.stop('a-b=luoyu-0'))
    # print(provider.status('a-b=luoyu-0'))
    # pprint(vars(provider.info('a-b=luoyu-0')))

    provider = Vm('azure')
    # print(provider.list())
    # pprit(provider.start('a-b=luoyu-1'))
    # provider.stop('a-b=luoyu-1')
    # pprint(provider.stop('a-b=luoyu-1'))
    # print(provider.status('a-b=luoyu-1'))
    # pprint(vars(provider.info('a-b=luoyu-1')))

    provider = Vm('chameleon')
    # print(provider.list())
    # pprit(provider.start('a-b=luoyu-2'))
    # provider.stop('a-b=luoyu-2')
    # pprint(provider.stop('a-b=luoyu-2'))
    # print(provider.status('a-b=luoyu-2'))
    # pprint(vars(provider.info('a-b=luoyu-2')))

    provider.mongo.close_client()
コード例 #2
0
ファイル: demo.py プロジェクト: xin-gu/cloudmesh-cloud
def main():
    test = Vm('aws')
    # test.start('i-0fad7e92ffea8b345')
    # test.stop('i-0fad7e92ffea8b345')
    print(test.list())
    # print(test.status('i-0fad7e92ffea8b345'))
    test.mongo.close_client()
コード例 #3
0
def openstack_test1():
    """
    1. test for vm
    """
    vm = Vm('chameleon')
    refactor = VmRefactor(vm)

    names = vm.list()  # instances
    sizes = refactor.list_sizes()  # available sizes
    images = refactor.list_images()  # available images

    # create new instance if necessary
    # create and auto start

    print("creating instance with provider: chameleon")
    node = vm.provider.create('testgroup-experiment-01')
    node_id = node.id
    name = node.name
    while vm.info(name).state == 'pending':
        sleep(3)
    print("At time " + str(datetime.datetime.now()) + " the state is " +
          vm.info(name).state)
    print(node)
    print("Node:" + node_id + " has been set up")

    # name = vm.list()[0].name
    # print("We are testing with cloud provider: chameleon, node name: %s " % name)
    # print("At time " + str(datetime.datetime.now()) + " the state is " + str(vm.info(name).state))

    # resize test - checked
    # *** chameleon requires extra confirmation for resizing request
    input("Press Enter to continue...")
    print("resizing.........")
    sizes = refactor.list_sizes()
    print(sizes)
    refactor.resize(name=name, size=sizes[2])  # resize to medium
    print("resizing finished")

    input("Press Enter to continue...")
    node = refactor.confirm_resize(name)
    print("resizing confirmed")

    # change image test - checked
    input("Press Enter to continue...")
    print("refactoring image.............")
    print(images)
    node = refactor.rebuild(name, image=images[2])
    print("image changed")

    # rename test - checked
    input("Press Enter to continue...")
    node = refactor.rename(name, "new name")

    # destroy
    input("Press Enter to continue...")
    print("call d.destroy() function")
    vm.destroy(name)
    sleep(10)
コード例 #4
0
ファイル: vm.py プロジェクト: laszewsk/cloudmesh-cloud
def vm_list():
    cloud = request.args.get('cloud')
    if cloud:
        rep = Vm(cloud).list()
        return 'No node is found on {}!\n'.format(cloud) if not rep else \
               jsonify(**{'records': [db.var_to_json(x.__dict__) for x in rep]})
    else:
        return jsonify(**{
            'records':
            [db.var_to_json(x) for x in db.db['cloud'].find_image()]
        })
コード例 #5
0
ファイル: vm.py プロジェクト: laszewsk/cloudmesh-cloud
 def vm_manager():
     config = Config()
     default_cloud = config.data["cloudmesh"]["default"]["cloud"]
     vm = Vm(default_cloud)
     return vm
コード例 #6
0
 def setup(self):
     self.config = Config()
     self.azure = Vm("azure")
     self.test_node_name = 'test1'
     self.test_node_id = ''
コード例 #7
0
 def setup(self):
     self.config = Config()
     self.azure = Vm('azure')
     self.test_node_name = 'cm-test-vm-1'
     self.test_node_id = ''
コード例 #8
0
 def setup(self):
     self.config = Config()
     self.aws = Vm("aws")
     self.test_node_name = 'test1'
     self.test_node_id = ''