Пример #1
0
    def execute(self, vthunder, amphora):
        """Execute get_info routine for a vThunder until it responds."""
        try:
            axapi_client = a10_utils.get_axapi_client(vthunder)
            LOG.info("Attempting to connect vThunder device for connection.")
            attempts = 30
            while attempts >= 0:
                try:
                    attempts = attempts - 1
                    axapi_client.system.information()
                    break
                except (req_exceptions.ConnectionError,
                        acos_errors.ACOSException, http_client.BadStatusLine,
                        req_exceptions.ReadTimeout):
                    attemptid = 21 - attempts
                    time.sleep(20)
                    LOG.debug("VThunder connection attempt - " +
                              str(attemptid))
                    pass
            if attempts < 0:
                LOG.error(
                    "Failed to connect vThunder in expected amount of boot time: %s",
                    vthunder.id)
                raise req_exceptions.ConnectionError

        except driver_except.TimeOutException as e:
            LOG.exception(
                "Amphora compute instance failed to become reachable. "
                "This either means the compute driver failed to fully "
                "boot the instance inside the timeout interval or the "
                "instance is not reachable via the lb-mgmt-net.")
            self.amphora_repo.update(db_apis.get_session(),
                                     amphora.id,
                                     status=constants.ERROR)
            raise e
Пример #2
0
 def execute(self, vthunder):
     try:
         axapi_client = a10_utils.get_axapi_client(vthunder)
         if not axapi_client.system.partition.exists(vthunder.partition_name):
             axapi_client.system.partition.create(vthunder.partition_name)
             LOG.info("Partition %s created", vthunder.partition_name)
     except acos_errors.Exists:
         pass
     except Exception as e:
         LOG.exception("Failed to create parition on vThunder: %s", str(e))
         raise
Пример #3
0
 def execute(self, vthunder):
     try:
         axapi_client = a10_utils.get_axapi_client(vthunder)
         if not axapi_client.system.partition.exists(
                 vthunder.partition_name):
             axapi_client.system.partition.create(vthunder.partition_name)
             axapi_client.system.action.write_memory(partition="shared")
             LOG.info("Partition %s created", vthunder.partition_name)
     except (acos_errors.ACOSException,
             req_exceptions.ConnectionError) as e:
         LOG.exception("Failed to create parition on vThunder: %s", str(e))
         raise e
Пример #4
0
    def execute(self, vthunder):
        axapi_client = a10_utils.get_axapi_client(vthunder)
        try:
            partition = axapi_client.system.partition.get(
                vthunder.partition_name)
        except acos_errors.NotFound:
            partition = None

        if partition is None:
            try:
                axapi_client.system.partition.create(vthunder.partition_name)
                axapi_client.system.action.write_memory(partition="shared")
                LOG.info("Partition %s created", vthunder.partition_name)
            except (acos_errors.ACOSException,
                    req_exceptions.ConnectionError) as e:
                LOG.exception("Failed to create parition on vThunder: %s",
                              str(e))
                raise e
        elif partition.get("status") == "Not-Active":
            raise exceptions.PartitionNotActiveError(partition,
                                                     vthunder.ip_address)
Пример #5
0
 def revert(self, vthunder, *args, **kwargs):
     try:
         axapi_client = a10_utils.get_axapi_client(vthunder)
         axapi_client.system.partition.delete(vthunder.partition_name)
     except Exception as e:
         LOG.exception("Failed to revert partition create : %s", str(e))