def run(self): try: nova = Node() except Exception: LOG.exception("Error initialising Nova connection") self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg LOG.info( "Removing Floating IP {0} from {1}" .format(self.msg['ip'], self.msg['name']) ) try: node_id = nova.get_node(self.msg['name']) nova.vip_remove(node_id, self.msg['ip']) except: LOG.exception( 'Error removing Floating IP {0} from {1}' .format(self.msg['ip'], self.msg['name']) ) self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg self.msg[self.RESPONSE_FIELD] = self.RESPONSE_SUCCESS return self.msg
def run(self): try: nova = Node() except Exception: LOG.exception("Error initialising Nova connection") self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg LOG.info( "Assigning Floating IP {0} to {1}" .format(self.msg['ip'], self.msg['name']) ) try: node_id = nova.get_node(self.msg['name']) LOG.info( 'Node name {0} identified as ID {1}' .format(self.msg['name'], node_id) ) nova.vip_assign(node_id, self.msg['ip']) self._wait_until_ip_assigned(nova, node_id, self.msg['ip']) if cfg.CONF['mgm']['tcp_check_port']: self.check_ip(self.msg['ip'], cfg.CONF['mgm']['tcp_check_port']) except: LOG.exception( 'Error assigning Floating IP {0} to {1}' .format(self.msg['ip'], self.msg['name']) ) self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg self.msg[self.RESPONSE_FIELD] = self.RESPONSE_SUCCESS return self.msg
def run(self): try: nova = Node() except Exception: LOG.exception("Error initialising Nova connection") self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg LOG.info("Assigning Floating IP {0} to {1}".format( self.msg['ip'], self.msg['name'])) try: node_id = nova.get_node(self.msg['name']) LOG.info('Node name {0} identified as ID {1}'.format( self.msg['name'], node_id)) nova.vip_assign(node_id, self.msg['ip']) self._wait_until_ip_assigned(nova, node_id, self.msg['ip']) if cfg.CONF['mgm']['tcp_check_port']: self.check_ip(self.msg['ip'], cfg.CONF['mgm']['tcp_check_port']) except: LOG.exception('Error assigning Floating IP {0} to {1}'.format( self.msg['ip'], self.msg['name'])) self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg self.msg[self.RESPONSE_FIELD] = self.RESPONSE_SUCCESS return self.msg
def run(self): try: nova = Node() except Exception: LOG.exception("Error initialising Nova connection") self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg LOG.info( "Deleting a requested Nova instance {0}".format(self.msg['name']) ) try: node_id = nova.get_node(self.msg['name']) except NotFound: LOG.error( "No node found for {0}".format(self.msg['name']) ) self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg nova.delete(node_id) self.msg[self.RESPONSE_FIELD] = self.RESPONSE_SUCCESS LOG.info( 'Deleted node {0}, id {1}'.format(self.msg['name'], node_id) ) return self.msg
def run(self): try: nova = Node() except Exception: LOG.exception("Error initialising Nova connection") self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg LOG.info("Building a requested Nova instance") try: node_id = nova.build() LOG.info("Build command sent to Nova") except BuildError as exc: LOG.exception( "{0}, node {1}".format(exc.msg, exc.node_name) ) name = exc.node_name # Node may have built despite error try: node_id = nova.get_node(name) except NotFound: LOG.error( "No node found for {0}, giving up on it".format(name) ) self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg except exceptions.ClientException: LOG.exception( 'Error getting failed node info from Nova for {0}' .format(name) ) self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg if node_id > 0: self._wait_until_node_ready(nova, node_id) if self.msg[self.RESPONSE_FIELD] == self.RESPONSE_SUCCESS: status = self._test_node(self.msg['name']) if not status: self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg else: LOG.error( 'Node build did not return an ID, cannot find it' ) self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg
def run(self): try: nova = Node() except Exception: LOG.exception("Error initialising Nova connection") self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg LOG.info("Deleting a requested Nova instance {0}".format( self.msg['name'])) try: node_id = nova.get_node(self.msg['name']) except NotFound: LOG.error("No node found for {0}".format(self.msg['name'])) self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg nova.delete(node_id) self.msg[self.RESPONSE_FIELD] = self.RESPONSE_SUCCESS LOG.info('Deleted node {0}, id {1}'.format(self.msg['name'], node_id)) return self.msg
def run(self): try: nova = Node() except Exception: LOG.exception("Error initialising Nova connection") self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg LOG.info("Removing Floating IP {0} from {1}".format( self.msg['ip'], self.msg['name'])) try: node_id = nova.get_node(self.msg['name']) nova.vip_remove(node_id, self.msg['ip']) except: LOG.exception('Error removing Floating IP {0} from {1}'.format( self.msg['ip'], self.msg['name'])) self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE return self.msg self.msg[self.RESPONSE_FIELD] = self.RESPONSE_SUCCESS return self.msg