예제 #1
0
 def _get_ics_session(self):
     if self.ics_manager:
         return True
     try:
         from ics_sdk import session
         self.ics_manager = session.get_session()
         return True
     except:
         self.ics_manager = None
         return False
예제 #2
0
 def getPanickPolicy(self, req, id):
     # call ics_sdk
     res = {'flag': True, 'errorMessage': None, 'resData': None}
     try:
         from ics_sdk import session
         self.ics_manager = session.get_session()
         vm_obj = self.ics_manager.vm.get_info(id)
         res['resData']={'vm_id' : id, 'panickPolicy' : vm_obj['panickPolicy']}
     except Exception as e:
         # do something
         LOG.error("get vm panick policy exception : " + e.message)
         res["flag"] = False
         res["errorMessage"] = e.message
         pass
     return dict(result=res)
예제 #3
0
    def setPanickPolicy(self, req, id, body):
        context = req.environ['nova.context']
        context.can(panick_policies.BASE_POLICY_NAME)
        #call ics_sdk
        res = {'flag':True, 'errorMessage':None, 'resData':None}
        try:
            from ics_sdk import session
            self.ics_manager = session.get_session()
            vm_obj = self.ics_manager.vm.get_info(id)
            vm_obj['panickPolicy'] = body['panickPolicy']
            taskId = self.ics_manager.vm.edit_vm(id, vm_obj)
        except Exception as e:
            # do something
            LOG.error("set vm panick policy exception : " + e.message)
            res['flag'] = False
            res['errorMessage'] = e.message
            pass

        return dict(result=res)
예제 #4
0
 def __init__(self):
     self.ics_manager = ics_session.get_session()
     super(WsthostController, self).__init__()