def stopVM(id,vm):
		try:
			#Just try to stop
			XendManager.stopDomain(vm)
	
			XenProvisioningDispatcher.logger.info("VM named "+vm.name+" has been stopped.")
			#Send async notification
			XmlRpcClient.sendAsyncProvisioningActionStatus(id,"SUCCESS","")
		except Exception as e:
			XenProvisioningDispatcher.logger.error(str(e))
			#Send async notification
			XmlRpcClient.sendAsyncProvisioningActionStatus(id,"FAILED",str(e))
			return
Beispiel #2
0
    def stopVM(id, vm):
        try:
            #Just try to stop
            XendManager.stopDomain(vm)

            XenProvisioningDispatcher.logger.info("VM named " + vm.name +
                                                  " has been stopped.")
            #Send async notification
            XmlRpcClient.sendAsyncProvisioningActionStatus(id, "SUCCESS", "")
        except Exception as e:
            XenProvisioningDispatcher.logger.error(str(e))
            #Send async notification
            XmlRpcClient.sendAsyncProvisioningActionStatus(
                id, "FAILED", str(e))
            return
Beispiel #3
0
 def force_list_active_vms(self, password, vm_uuid):
     from xen.XendManager import XendManager
     if password != XMLRPC_SERVER_PASSWORD:
         raise Exception("Password mismatch")
     active_vms = dict()
     XendManager.retrieveActiveDomainsByUUID()
     for vm in XendManager.retrieveActiveDomainsByUUID():
         if (str(vm_uuid) != 'None'):
             if vm[0] == vm_uuid:
                 active_vms[vm[0]] = vm[1]
                 break
             else:
                 continue
         active_vms[vm[0]] = vm[1]
     return active_vms
	def deleteVM(id,vm):
		try:
			try:
				#if it wasn't stopped, do it
				XendManager.stopDomain(vm)	
			except Exception as e:
				pass
			
			#Trigger Hd Deletion in Remote	
			HdManager.delete(vm)	

			#Send async notification
			XmlRpcClient.sendAsyncProvisioningActionStatus(id,"SUCCESS","")
		except Exception as e:
			XenProvisioningDispatcher.logger.error(str(e))
			#Send async notification
			XmlRpcClient.sendAsyncProvisioningActionStatus(id,"FAILED",str(e))
			return
Beispiel #5
0
    def deleteVM(id, vm):
        try:
            try:
                #if it wasn't stopped, do it
                XendManager.stopDomain(vm)
            except Exception as e:
                pass

            #Trigger Hd Deletion in Remote
            HdManager.delete(vm)

            #Send async notification
            XmlRpcClient.sendAsyncProvisioningActionStatus(id, "SUCCESS", "")
        except Exception as e:
            XenProvisioningDispatcher.logger.error(str(e))
            #Send async notification
            XmlRpcClient.sendAsyncProvisioningActionStatus(
                id, "FAILED", str(e))
            return
Beispiel #6
0
	def listActiveVMs(id,server):
		try:		
			doms = XendManager.retrieveActiveDomainsByUUID()
			XmlRpcClient.sendAsyncMonitoringActiveVMsInfo(id,"SUCCESS",doms,server)

		except Exception as e:
			#Send async notification
			XmlRpcClient.sendAsyncMonitoringActionStatus(id,"FAILED",str(e))
			XenMonitoringDispatcher.logger.error(str(e))
			return
Beispiel #7
0
 def force_list_active_vms(self, password, vm_uuid):
     """
     Returns dictionary with VM's UUIDs and names.
     Parameters:
         vm_uuid: if passed, it will return data for that domain only.
                  Otherwise, the whole list of VMs will be returned
     """
     from xen.XendManager import XendManager
     if password != XMLRPC_SERVER_PASSWORD:
         raise Exception("Password mismatch")
     active_vms = dict()
     active_domains = XendManager.retrieveActiveDomainsByUUID()
     for vm in active_domains:
         if (str(vm_uuid) != 'None'):
             if vm[0] == vm_uuid:
                 active_vms[vm[0]] = vm[1]
                 break
         else:
             active_vms[vm[0]] = vm[1]
     return active_vms