Ejemplo n.º 1
0
 def createVm(self, vmParams, vmRecover=False):
     with self.vmContainerLock:
         if not vmRecover:
             if vmParams['vmId'] in self.vmContainer:
                 return errCode['exist']
         vm = Vm(self, vmParams, vmRecover)
         self.vmContainer[vmParams['vmId']] = vm
     vm.run()
     return {'status': doneCode, 'vmList': vm.status()}
Ejemplo n.º 2
0
 def createVm(self, vmParams, vmRecover=False):
     with self.vmContainerLock:
         if not vmRecover:
             if vmParams['vmId'] in self.vmContainer:
                 return errCode['exist']
         vm = Vm(self, vmParams, vmRecover)
         ret = vm.run()
         if not response.is_error(ret):
             self.vmContainer[vmParams['vmId']] = vm
         return ret
Ejemplo n.º 3
0
 def createVm(self, vmParams, vmRecover=False):
     with self.vmContainerLock:
         self.log.info("vmContainerLock acquired by vm %s",
                       vmParams['vmId'])
         try:
             if not vmRecover:
                 if vmParams['vmId'] in self.vmContainer:
                     self.log.warning('vm %s already exists' %
                                      vmParams['vmId'])
                     return errCode['exist']
             vm = Vm(self, vmParams, vmRecover)
             self.vmContainer[vmParams['vmId']] = vm
         finally:
             container_len = len(self.vmContainer)
     vm.run()
     self.log.debug("Total desktops after creation of %s is %d" %
                    (vmParams['vmId'], container_len))
     return {'status': doneCode, 'vmList': vm.status()}