コード例 #1
0
 def remove_instance(self, id):
     from novaclient.v1_1 import client # nova client v3 raises exception for this
     nova = client.Client(self.__os_username,self.__os_password,"admin",self.__os_auth_url)
     sm = ServerManager(nova)
     instancia = sm.get(id)
     sm.delete(instancia)
     return True
コード例 #2
0
    def create_snapshot(self, instance_id):
        from novaclient.v1_1 import client # nova client v3 raises exception for this
        nova = client.Client(self.__os_username,self.__os_password,self.__os_tenant_admin, self.__os_auth_url)

        server_manager = ServerManager(nova)
        instance_obj = server_manager.get(instance_id)
        snapshot_name = 'snapshot--%s--%s' % (instance_obj.name, datetime.datetime.now())
        print snapshot_name
        nova.servers.create_image(instance_id, snapshot_name)
コード例 #3
0
 def suspend_instance(self, instance_id):
     from novaclient.v1_1 import client # nova client v3 raises exception for this
     nova = client.Client(self.__os_username,self.__os_password,self.__os_tenant_admin, self.__os_auth_url)
     server_manager = ServerManager(nova)
     server_manager.suspend(instance_id)
コード例 #4
0
 def vm_hostname(self,project_name,instance_id):
     nova = client.Client(env.OS_USERNAME, env.OS_PASSWORD, project_name, env.OS_AUTH_URL)
     server = ServerManager(nova)
     return server.get(instance_id)
コード例 #5
0
 def vm_migration(self,project_name,host_name,instance_id):
     nova = client.Client(env.OS_USERNAME, env.OS_PASSWORD, project_name, env.OS_AUTH_URL)
     server = ServerManager(nova)
     block = True
     disk_commit = False 
     server.live_migrate(instance_id,host_name,block,disk_commit)
コード例 #6
0
 def remove_instance(self, id):
     nova = client.Client(env.OS_USERNAME,env.OS_PASSWORD,"admin",env.OS_AUTH_URL)
     sm = ServerManager(nova)
     instancia = sm.get(id)
     sm.delete(instancia)
     return True