def processResponse(rspec): logging.debug("PROCESSING RESPONSE proocessResponse() STARTED...") for action in rspec.response.provisioning.action: try: actionModel = ActionController.getAction(action.id) except Exception as e: logging.error("No action in DB with the incoming uuid\n%s", e) return ''' If the response is for an action only in QUEUED or ONGOING status, SUCCESS or FAILED actions are finished ''' if actionModel.getStatus() is Action.QUEUED_STATUS or Action.ONGOING_STATUS: logging.debug("The incoming response has id: %s and NEW status: %s",actionModel.uuid,actionModel.status) actionModel.status = action.status actionModel.description = action.description actionModel.save() #Complete information required for the Plugin: action type and VM ActionController.completeActionRspec(action, actionModel) #XXX:Implement this method or some other doing this job vm = VTDriver.getVMbyUUID(actionModel.getObjectUUID()) controller=VTDriver.getDriver(vm.Server.get().getVirtTech()) failedOnCreate = 0 if actionModel.getStatus() == Action.SUCCESS_STATUS: ProvisioningResponseDispatcher.__updateVMafterSUCCESS(actionModel, vm) elif actionModel.getStatus() == Action.ONGOING_STATUS: ProvisioningResponseDispatcher.__updateVMafterONGOING(actionModel, vm) elif actionModel.getStatus() == Action.FAILED_STATUS: failedOnCreate = ProvisioningResponseDispatcher.__updateVMafterFAILED(actionModel, vm) else: vm.setState(VirtualMachine.UNKNOWN_STATE) try: logging.debug("Sending response to Plugin in sendAsync") XmlRpcClient.callRPCMethod(vm.getCallBackURL(), "sendAsync", XmlHelper.craftXmlClass(rspec)) if failedOnCreate == 1: controller.deleteVM(vm) except Exception as e: logging.error("Could not connect to Plugin in sendAsync\n%s",e) return #If response is for a finished action else: try: #XXX: What should be done if this happen? logging.error("Received response for an action in wrong state\n") XmlRpcClient.callRPCMethod(vm.getCallBackURL(), "sendAsync", XmlHelper.getProcessingResponse(Action.ACTION_STATUS_FAILED_TYPE, action, "Received response for an action in wrong state")) except Exception as e: logging.error(e) return
def __createVM(controller, actionModel, action): try: actionModel.checkActionIsPresentAndUnique() Server, VMmodel = controller.getServerAndCreateVM(action) ActionController.completeConfiguratorInActionRspec(action.server.virtual_machines[0].xen_configuration) ActionController.PopulateNetworkingParams(action.server.virtual_machines[0].xen_configuration.interfaces.interface, VMmodel) #XXX:Change action Model actionModel.objectUUID = VMmodel.getUUID() #actionModel.callBackUrl = threading.currentThread().callBackURL actionModel.save() return VMmodel except: raise
def __createVM(controller, actionModel, action): try: actionModel.checkActionIsPresentAndUnique() Server, VMmodel = controller.getServerAndCreateVM(action) ActionController.completeConfiguratorInActionRspec(action.server.virtual_machines[0].xen_configuration) ActionController.PopulateNetworkingParams(action.server.virtual_machines[0].xen_configuration.interfaces.interface, VMmodel) #XXX:Change action Model actionModel.objectUUID = VMmodel.getUUID() #actionModel.callBackUrl = threading.currentThread().callBackURL actionModel.save() return VMmodel except: raise
def PropagateActionToProvisioningDispatcher(vm_id, serverUUID, action): from vt_manager.communication.utils.XmlHelper import XmlHelper from vt_manager.controller.dispatchers.xmlrpc.DispatcherLauncher import DispatcherLauncher vm = VirtualMachine.objects.get(id=vm_id).getChildObject() rspec = XmlHelper.getSimpleActionSpecificQuery(action, serverUUID) ActionController.PopulateNewActionWithVM(rspec.query.provisioning.action[0], vm) ServiceThread.startMethodInNewThread(DispatcherLauncher.processXmlQuery, rspec)
def check(rspec): actionModel = ActionController.ActionToModel( rspec.query.provisioning.action[0], "provisioning") if actionModel.getAction( rspec.query.provisioning.action[0] ).status == actionModel.SUCCESS_STATUS or actionModel.getAction( rspec.query.provisioning.action[0] ).status == actionModel.FAILED_STATUS: return True
def sendUpdateVMs(server): #Recover from the client the list of active VMs obj = XmlHelper.getListActiveVMsQuery() #Create new Action action = ActionController.createNewAction(Action.MONITORING_SERVER_VMS_TYPE,Action.QUEUED_STATUS,server.getUUID(),"") obj.query.monitoring.action[0].id = action.getUUID() obj.query.monitoring.action[0].server.virtualization_type = server.getid = server.getVirtTech() XmlRpcClient.callRPCMethod(server.getAgentURL(),"send",UrlUtils.getOwnCallbackURL(),0,server.agentPassword,XmlHelper.craftXmlClass(obj))
def processProvisioning(provisioning): logging.debug("PROVISIONING STARTED...\n") for action in provisioning.action: actionModel = ActionController.ActionToModel(action,"provisioning") logging.debug("ACTION type: %s with id: %s" % (actionModel.type, actionModel.uuid)) try: RuleTableManager.Evaluate(action,RuleTableManager.getDefaultName()) except Exception as e: MAX_CHARS_ALLOWED = 200 XmlRpcClient.callRPCMethod(threading.currentThread().callBackURL,"sendAsync",XmlHelper.craftXmlClass(XmlHelper.getProcessingResponse(Action.FAILED_STATUS, action,str(e)[0:MAX_CHARS_ALLOWED-1]))) return None try: controller = VTDriver.getDriver(action.server.virtualization_type) #XXX:Change this when xml schema is updated server = VTDriver.getServerByUUID(action.server.uuid) #if actionModel.getType() == Action.PROVISIONING_VM_CREATE_TYPE: # server = VTDriver.getServerByUUID(action.virtual_machine.server_id) #else: # server = VTDriver.getVMbyUUID(action.virtual_machine.uuid).Server.get() except Exception as e: logging.error(e) raise e try: #PROVISIONING CREATE if actionModel.getType() == Action.PROVISIONING_VM_CREATE_TYPE: try: vm = ProvisioningDispatcher.__createVM(controller, actionModel, action) except: vm = None raise #PROVISIONING DELETE, START, STOP, REBOOT else : ProvisioningDispatcher.__deleteStartStopRebootVM(controller, actionModel, action) XmlRpcClient.callRPCMethod(server.getAgentURL() ,"send", UrlUtils.getOwnCallbackURL(), 1, server.getAgentPassword(),XmlHelper.craftXmlClass(XmlHelper.getSimpleActionQuery(action)) ) return except Exception as e: if actionModel.getType() == Action.PROVISIONING_VM_CREATE_TYPE: # If the VM creation was interrupted in the network # configuration, the created VM won't be returned try: if not vm: vm = controller.getVMbyUUID(action.server.virtual_machines[0].uuid) controller.deleteVM(vm) # Keep actions table up-to-date after each deletion actionModel.delete() except Exception as e: print "Could not delete VM. Exception: %s" % str(e) #XmlRpcClient.callRPCMethod(threading.currentThread().callBackURL,"sendAsync",XmlHelper.craftXmlClass(XmlHelper.getProcessingResponse(Action.FAILED_STATUS, action, str(e)))) logging.debug("PROVISIONING FINISHED...")
def sendUpdateVMs(server): #Recover from the client the list of active VMs obj = XmlHelper.getListActiveVMsQuery() #Create new Action action = ActionController.createNewAction( Action.MONITORING_SERVER_VMS_TYPE, Action.QUEUED_STATUS, server.getUUID(), "") obj.query.monitoring.action[0].id = action.getUUID() obj.query.monitoring.action[ 0].server.virtualization_type = server.getid = server.getVirtTech( ) XmlRpcClient.callRPCMethod(server.getAgentURL(), "send", UrlUtils.getOwnCallbackURL(), 0, server.agentPassword, XmlHelper.craftXmlClass(obj))
def __VMmodelToClass(VMmodel, VMxmlClass): VMxmlClass.name = VMmodel.getName() VMxmlClass.uuid = VMmodel.getUUID() VMxmlClass.status = VMmodel.getState() VMxmlClass.project_id = VMmodel.getProjectId() VMxmlClass.slice_id = VMmodel.getSliceId() VMxmlClass.project_name = VMmodel.getProjectName() VMxmlClass.slice_name = VMmodel.getSliceName() VMxmlClass.operating_system_type = VMmodel.getOSType() VMxmlClass.operating_system_version = VMmodel.getOSVersion() VMxmlClass.operating_system_distribution = VMmodel.getOSDistribution() VMxmlClass.virtualization_type = VMmodel.Server.get().getVirtTech() VMxmlClass.server_id = VMmodel.Server.get().getUUID() VMxmlClass.xen_configuration.hd_setup_type = VMmodel.getHdSetupType() VMxmlClass.xen_configuration.hd_origin_path = VMmodel.getHdOriginPath() VMxmlClass.xen_configuration.virtualization_setup_type = VMmodel.getVirtualizationSetupType( ) VMxmlClass.xen_configuration.memory_mb = VMmodel.getMemory() ActionController.PopulateNetworkingParams( VMxmlClass.xen_configuration.interfaces.interface, VMmodel)
def __createVM(controller, actionModel, action): try: actionModel.checkActionIsPresentAndUnique() if not PolicyManager.checkPolicies(action): logging.error( "The requested action do not pass the Aggregate Manager Policies" ) raise Exception( "The requested action do not pass the Aggregate Manager Policies" ) Server, VMmodel = controller.getServerAndCreateVM(action) ActionController.PopulateNetworkingParams( action.server.virtual_machines[0].xen_configuration.interfaces. interface, VMmodel) #XXX:Change action Model actionModel.objectUUID = VMmodel.getUUID() actionModel.save() return VMmodel except: raise
def processResponse(rspec): logging.debug("PROCESSING RESPONSE processResponse() STARTED...") for action in rspec.response.provisioning.action: try: actionModel = ActionController.getAction(action.id) except Exception as e: logging.error("No action in DB with the incoming uuid\n%s", e) return ''' If the response is for an action only in QUEUED or ONGOING status, SUCCESS or FAILED actions are finished ''' #if str(actionModel.callBackUrl) == str(SfaCommunicator.SFAUrl): #Avoiding unicodes # event = pull(str(action.id)) # event.send('continue') # return if actionModel.getStatus( ) is Action.QUEUED_STATUS or Action.ONGOING_STATUS: logging.debug( "The incoming response has id: %s and NEW status: %s" % (actionModel.uuid, actionModel.status)) was_creating = False was_created = False actionModel.status = action.status actionModel.description = action.description actionModel.save() #Complete information required for the Plugin: action type and VM ActionController.completeActionRspec(action, actionModel) #XXX:Implement this method or some other doing this job vm = VTDriver.getVMbyUUID(actionModel.getObjectUUID()) if vm.state == "creating...": was_creating = True elif vm.state == "starting...": was_created = True controller = VTDriver.getDriver(vm.Server.get().getVirtTech()) failedOnCreate = 0 # Update VM model with new status from OXAD if actionModel.getStatus() == Action.SUCCESS_STATUS: ProvisioningResponseDispatcher.__updateVMafterSUCCESS( actionModel, vm) elif actionModel.getStatus() == Action.ONGOING_STATUS: ProvisioningResponseDispatcher.__updateVMafterONGOING( actionModel, vm) elif actionModel.getStatus() == Action.FAILED_STATUS: failedOnCreate = ProvisioningResponseDispatcher.__updateVMafterFAILED( actionModel, vm) else: vm.setState(VirtualMachine.UNKNOWN_STATE) try: created = False vm_started = False if vm.state == "created (stopped)": created = True elif vm.state == "running": vm_started = True logging.debug("Sending response to plug-in in sendAsync") if str(vm.callBackURL) == 'SFA.OCF.VTM': logging.debug("callback: %s" % vm.callBackURL) print "-------------->PRD: Created:", created, "Was_creating:", was_creating, "vm_started:", vm_started print "-------------->PRD Action:", action, action.server.__dict__ # Start VM just after creating sliver/VM if created and was_creating: from vt_manager.communication.sfa.drivers.VTSfaDriver import VTSfaDriver driver = VTSfaDriver(None) driver.crud_slice(vm.sliceName, vm.projectName, "start_slice") ProvisioningResponseDispatcher.__clean_up_reservations( vm.uuid) return #if was_created and vm_started: if vm_started: ifaces = vm.getNetworkInterfaces() for iface in ifaces: if iface.isMgmt: ip = iface.ip4s.all()[0].ip # Contextualize VMs ProvisioningResponseDispatcher.__contextualize_vm( vm, ip) # Cleaning up reservation objects return XmlRpcClient.callRPCMethod(vm.getCallBackURL(), "sendAsync", XmlHelper.craftXmlClass(rspec)) if failedOnCreate == 1: controller.deleteVM(vm) # Keep actions table up-to-date after each deletion actionModel.delete() except Exception as e: logging.error( "Could not connect to Plugin in sendAsync\n%s", e) return #If response is for a finished action else: try: #XXX: What should be done if this happen? logging.error( "Received response for an action in wrong state\n") XmlRpcClient.callRPCMethod( vm.getCallBackURL(), "sendAsync", XmlHelper.getProcessingResponse( Action.ACTION_STATUS_FAILED_TYPE, action, "Received response for an action in wrong state")) except Exception as e: logging.error(e) return
def processresponseSync(rspec): """ Thread-free implementation. """ logging.debug("PROCESSING RESPONSE processResponseSync() STARTED...") for action in rspec.response.provisioning.action: try: actionModel = ActionController.getAction(action.id) except Exception as e: logging.error("No action in DB with the incoming uuid\n%s", e) return """ If the response is for an action only in QUEUED or ONGOING status, SUCCESS or FAILED actions are finished """ #if str(actionModel.callBackUrl) == str(SfaCommunicator.SFAUrl): #Avoiding unicodes # event = pull(str(action.id)) # event.send('continue') # return logging.debug( "................................ actionModel.getStatus(): %s ................." % str(actionModel.getStatus())) if actionModel.getStatus( ) is Action.QUEUED_STATUS or Action.ONGOING_STATUS: logging.debug( "The incoming response has id: %s and NEW status: %s" % (actionModel.uuid, actionModel.status)) actionModel.status = action.status actionModel.description = action.description actionModel.save() #Complete information required for the Plugin: action type and VM ActionController.completeActionRspec(action, actionModel) #XXX:Implement this method or some other doing this job vm = VTDriver.getVMbyUUID(actionModel.getObjectUUID()) controller = VTDriver.getDriver(vm.Server.get().getVirtTech()) failedOnCreate = 0 if actionModel.getStatus() == Action.SUCCESS_STATUS: ProvisioningResponseDispatcher.__updateVMafterSUCCESS( actionModel, vm) elif actionModel.getStatus() == Action.ONGOING_STATUS: ProvisioningResponseDispatcher.__updateVMafterONGOING( actionModel, vm) elif actionModel.getStatus() == Action.FAILED_STATUS: failedOnCreate = ProvisioningResponseDispatcher.__updateVMafterFAILED( actionModel, vm) else: vm.setState(VirtualMachine.UNKNOWN_STATE) try: logging.debug("Sending response to Plugin in sendAsync") if str(actionModel.callBackUrl) == 'SFA.OCF.VTM': logging.debug(">>>>>>> SFA.OCF.VTM\n\n\n") if failedOnCreate: logging.debug( "........... failedOnCreate.........") expiring_slices = vm.objects.filter( sliceName=vm.sliceName, projectName=vm.projectName) logging.debug( "........... expiring_slices: %s ..........." % str(expiring_slices)) if len(expiring_slices) == 1: expiring_slices[0].delete() # Cleaning up reservation objects ProvisioningResponseDispatcher.__clean_up_reservations( vm.name) XmlRpcClient.callRPCMethod(vm.getCallBackURL(), "sendSync", XmlHelper.craftXmlClass(rspec)) if failedOnCreate == 1: controller.deleteVM(vm) # Keep actions table up-to-date after each deletion actionModel.delete() except Exception as e: logging.error( "Could not connect to Plugin in sendSync. Exception: %s", e) return # If response is for a finished action else: try: #XXX: What should be done if this happen? logging.error( "Received response for an action in wrong state") XmlRpcClient.callRPCMethod( vm.getCallBackURL(), "sendSync", XmlHelper.getProcessingResponse( Action.ACTION_STATUS_FAILED_TYPE, action, "Received response for an action in wrong state")) except Exception as e: logging.error(e) return
def processProvisioning(provisioning): logging.debug("PROVISIONING STARTED...\n") for action in provisioning.action: actionModel = ActionController.ActionToModel( action, "provisioning") logging.debug("ACTION type: %s with id: %s" % (actionModel.type, actionModel.uuid)) try: RuleTableManager.Evaluate(action, RuleTableManager.getDefaultName()) except Exception as e: a = str(e) if len(a) > 200: a = a[0:199] XmlRpcClient.callRPCMethod( threading.currentThread().callBackURL, "sendAsync", XmlHelper.craftXmlClass( XmlHelper.getProcessingResponse( Action.FAILED_STATUS, action, a))) # XmlRpcClient.callRPCMethod(threading.currentThread().callBackURL,"sendAsync",XmlHelper.craftXmlClass(XmlHelper.getProcessingResponse('FAILED', action, 'You requested more than the 128Mbytes allowed for your project'))) return None try: controller = VTDriver.getDriver( action.server.virtualization_type) #XXX:Change this when xml schema is updated server = VTDriver.getServerByUUID(action.server.uuid) #if actionModel.getType() == Action.PROVISIONING_VM_CREATE_TYPE: # server = VTDriver.getServerByUUID(action.virtual_machine.server_id) #else: # server = VTDriver.getVMbyUUID(action.virtual_machine.uuid).Server.get() except Exception as e: logging.error(e) raise e try: #PROVISIONING CREATE if actionModel.getType() == Action.PROVISIONING_VM_CREATE_TYPE: try: vm = ProvisioningDispatcher.__createVM( controller, actionModel, action) except: vm = None raise #PROVISIONING DELETE, START, STOP, REBOOT else: ProvisioningDispatcher.__deleteStartStopRebootVM( controller, actionModel, action) XmlRpcClient.callRPCMethod( server.getAgentURL(), "send", UrlUtils.getOwnCallbackURL(), 1, server.getAgentPassword(), XmlHelper.craftXmlClass( XmlHelper.getSimpleActionQuery(action))) except Exception as e: if actionModel.getType( ) == Action.PROVISIONING_VM_CREATE_TYPE and vm: controller.deleteVM(vm) XmlRpcClient.callRPCMethod( threading.currentThread().callBackURL, "sendAsync", XmlHelper.craftXmlClass( XmlHelper.getProcessingResponse( Action.FAILED_STATUS, action, str(e)))) logging.debug("PROVISIONING FINISHED...")
def processResponse(rspec): logging.debug("PROCESSING RESPONSE processResponse() STARTED...") for action in rspec.response.provisioning.action: try: actionModel = ActionController.getAction(action.id) except Exception as e: logging.error("No action in DB with the incoming uuid\n%s", e) return ''' If the response is for an action only in QUEUED or ONGOING status, SUCCESS or FAILED actions are finished ''' #if str(actionModel.callBackUrl) == str(SfaCommunicator.SFAUrl): #Avoiding unicodes # event = pull(str(action.id)) # event.send('continue') # return if actionModel.getStatus() is Action.QUEUED_STATUS or Action.ONGOING_STATUS: logging.debug("The incoming response has id: %s and NEW status: %s" % (actionModel.uuid,actionModel.status)) was_creating = False was_created = False actionModel.status = action.status actionModel.description = action.description actionModel.save() #Complete information required for the Plugin: action type and VM ActionController.completeActionRspec(action, actionModel) #XXX:Implement this method or some other doing this job vm = VTDriver.getVMbyUUID(actionModel.getObjectUUID()) if vm.state == "creating...": was_creating = True elif vm.state == "starting...": was_created = True controller=VTDriver.getDriver(vm.Server.get().getVirtTech()) failedOnCreate = 0 # Update VM model with new status from OXAD if actionModel.getStatus() == Action.SUCCESS_STATUS: ProvisioningResponseDispatcher.__updateVMafterSUCCESS(actionModel, vm) elif actionModel.getStatus() == Action.ONGOING_STATUS: ProvisioningResponseDispatcher.__updateVMafterONGOING(actionModel, vm) elif actionModel.getStatus() == Action.FAILED_STATUS: failedOnCreate = ProvisioningResponseDispatcher.__updateVMafterFAILED(actionModel, vm) else: vm.setState(VirtualMachine.UNKNOWN_STATE) try: created = False vm_started = False if vm.state == "created (stopped)": created = True elif vm.state == "running": vm_started = True logging.debug("Sending response to plug-in in sendAsync") if str(vm.callBackURL) == 'SFA.OCF.VTM': logging.debug("callback: %s" % vm.callBackURL) print "-------------->PRD: Created:", created, "Was_creating:", was_creating, "vm_started:", vm_started print "-------------->PRD Action:", action, action.server.__dict__ # Start VM just after creating sliver/VM if created and was_creating: from vt_manager.communication.sfa.drivers.VTSfaDriver import VTSfaDriver driver = VTSfaDriver(None) driver.crud_slice(vm.sliceName,vm.projectName, "start_slice") ProvisioningResponseDispatcher.__clean_up_reservations(vm.uuid) return #if was_created and vm_started: if vm_started: ifaces = vm.getNetworkInterfaces() for iface in ifaces: if iface.isMgmt: ip = iface.ip4s.all()[0].ip # Contextualize VMs ProvisioningResponseDispatcher.__contextualize_vm(vm, ip) # Cleaning up reservation objects return XmlRpcClient.callRPCMethod(vm.getCallBackURL(), "sendAsync", XmlHelper.craftXmlClass(rspec)) if failedOnCreate == 1: controller.deleteVM(vm) # Keep actions table up-to-date after each deletion actionModel.delete() except Exception as e: logging.error("Could not connect to Plugin in sendAsync\n%s",e) return #If response is for a finished action else: try: #XXX: What should be done if this happen? logging.error("Received response for an action in wrong state\n") XmlRpcClient.callRPCMethod(vm.getCallBackURL(), "sendAsync", XmlHelper.getProcessingResponse(Action.ACTION_STATUS_FAILED_TYPE, action, "Received response for an action in wrong state")) except Exception as e: logging.error(e) return
def processresponseSync(rspec): """ Thread-free implementation. """ logging.debug("PROCESSING RESPONSE processResponseSync() STARTED...") for action in rspec.response.provisioning.action: try: actionModel = ActionController.getAction(action.id) except Exception as e: logging.error("No action in DB with the incoming uuid\n%s", e) return """ If the response is for an action only in QUEUED or ONGOING status, SUCCESS or FAILED actions are finished """ #if str(actionModel.callBackUrl) == str(SfaCommunicator.SFAUrl): #Avoiding unicodes # event = pull(str(action.id)) # event.send('continue') # return logging.debug("................................ actionModel.getStatus(): %s ................." % str(actionModel.getStatus())) if actionModel.getStatus() is Action.QUEUED_STATUS or Action.ONGOING_STATUS: logging.debug("The incoming response has id: %s and NEW status: %s" % (actionModel.uuid,actionModel.status)) actionModel.status = action.status actionModel.description = action.description actionModel.save() #Complete information required for the Plugin: action type and VM ActionController.completeActionRspec(action, actionModel) #XXX:Implement this method or some other doing this job vm = VTDriver.getVMbyUUID(actionModel.getObjectUUID()) controller = VTDriver.getDriver(vm.Server.get().getVirtTech()) failedOnCreate = 0 if actionModel.getStatus() == Action.SUCCESS_STATUS: ProvisioningResponseDispatcher.__updateVMafterSUCCESS(actionModel, vm) elif actionModel.getStatus() == Action.ONGOING_STATUS: ProvisioningResponseDispatcher.__updateVMafterONGOING(actionModel, vm) elif actionModel.getStatus() == Action.FAILED_STATUS: failedOnCreate = ProvisioningResponseDispatcher.__updateVMafterFAILED(actionModel, vm) else: vm.setState(VirtualMachine.UNKNOWN_STATE) try: logging.debug("Sending response to Plugin in sendAsync") if str(actionModel.callBackUrl) == 'SFA.OCF.VTM': logging.debug(">>>>>>> SFA.OCF.VTM\n\n\n") if failedOnCreate: logging.debug("........... failedOnCreate.........") expiring_slices = vm.objects.filter(sliceName=vm.sliceName,projectName=vm.projectName) logging.debug("........... expiring_slices: %s ..........." % str(expiring_slices)) if len(expiring_slices) == 1: expiring_slices[0].delete() # Cleaning up reservation objects ProvisioningResponseDispatcher.__clean_up_reservations(vm.name) XmlRpcClient.callRPCMethod(vm.getCallBackURL(), "sendSync", XmlHelper.craftXmlClass(rspec)) if failedOnCreate == 1: controller.deleteVM(vm) # Keep actions table up-to-date after each deletion actionModel.delete() except Exception as e: logging.error("Could not connect to Plugin in sendSync. Exception: %s",e) return # If response is for a finished action else: try: #XXX: What should be done if this happen? logging.error("Received response for an action in wrong state") XmlRpcClient.callRPCMethod(vm.getCallBackURL(), "sendSync", XmlHelper.getProcessingResponse(Action.ACTION_STATUS_FAILED_TYPE, action, "Received response for an action in wrong state")) except Exception as e: logging.error(e) return