def export(server, vm_obj): # Request an export request = VI.ExportVmRequestMsg() _this = request.new__this(vm_obj._mor) _this.set_attribute_type(vm_obj._mor.get_attribute_type()) request.set_element__this(_this) ret = server._proxy.ExportVm(request) # List of urls to download mor = ret._returnval http = VIProperty(connection, ret._returnval) url = http.info.deviceUrl[0].url # TODO: actually download them. # Set to 100% request = VI.HttpNfcLeaseProgressRequestMsg() _this = request.new__this(mor) _this.set_attribute_type(MORTypes.HttpNfcLease) request.set_element__this(_this) request.set_element_percent(100) server._proxy.HttpNfcLeaseProgress(request) # Completes the request request = VI.HttpNfcLeaseCompleteRequestMsg() _this = request.new__this(mor) _this.set_attribute_type(MORTypes.HttpNfcLease) request.set_element__this(_this) server._proxy.HttpNfcLeaseComplete(request)
def keep_lease_alive(lease): request = VI.HttpNfcLeaseProgressRequestMsg() _this = request.new__this(lease) _this.set_attribute_type(lease.get_attribute_type()) request.set_element__this(_this) request.set_element_percent(50) #then we can add logic to set a real one while go_on: s._proxy.HttpNfcLeaseProgress(request) time.sleep(5)
def keep_lease_alive(lease): u"""プロセスを継続させる @param leaese 仮のVM """ request = VI.HttpNfcLeaseProgressRequestMsg() _this = request.new__this(lease) _this.set_attribute_type(lease.get_attribute_type()) request.set_element__this(_this) request.set_element_percent(50) while go_on: server._proxy.HttpNfcLeaseProgress(request)