"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "octavia/compute/drivers/nova_driver.py" between
octavia-7.1.1.tar.gz and octavia-8.0.0.tar.gz

About: OpenStack Octavia is an operator-grade reference implementation for Load Balancing as a Service (LBaaS).
The "Wallaby" series (latest release).

nova_driver.py  (octavia-7.1.1):nova_driver.py  (octavia-8.0.0)
skipping to change at line 22 skipping to change at line 22
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import random import random
import string import string
from novaclient import exceptions as nova_exceptions from novaclient import exceptions as nova_exceptions
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from stevedore import driver as stevedore_driver from stevedore import driver as stevedore_driver
import tenacity
from octavia.common import clients from octavia.common import clients
from octavia.common import constants from octavia.common import constants
from octavia.common import data_models as models from octavia.common import data_models as models
from octavia.common import exceptions from octavia.common import exceptions
from octavia.compute import compute_base from octavia.compute import compute_base
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
CONF = cfg.CONF CONF = cfg.CONF
skipping to change at line 181 skipping to change at line 182
''' '''
try: try:
amphora, fault = self.get_amphora(compute_id) amphora, fault = self.get_amphora(compute_id)
if amphora and amphora.status == 'ACTIVE': if amphora and amphora.status == 'ACTIVE':
return constants.UP return constants.UP
except Exception as e: except Exception as e:
LOG.exception("Error retrieving nova virtual machine status.") LOG.exception("Error retrieving nova virtual machine status.")
raise exceptions.ComputeStatusException() from e raise exceptions.ComputeStatusException() from e
return constants.DOWN return constants.DOWN
def _raise_compute_exception(self):
LOG.exception("Error retrieving nova virtual machine.")
raise exceptions.ComputeGetException()
@tenacity.retry(retry=tenacity.retry_if_exception_type(),
stop=tenacity.stop_after_attempt(CONF.compute.max_retries),
retry_error_callback=_raise_compute_exception,
wait=tenacity.wait_fixed(CONF.compute.retry_interval))
def get_amphora(self, compute_id, management_network_id=None): def get_amphora(self, compute_id, management_network_id=None):
'''Retrieve the information in nova of a virtual machine. '''Retrieve the information in nova of a virtual machine.
:param compute_id: virtual machine UUID :param compute_id: virtual machine UUID
:param management_network_id: ID of the management network :param management_network_id: ID of the management network
:returns: an amphora object :returns: an amphora object
:returns: fault message or None :returns: fault message or None
''' '''
# utilize nova client ServerManager 'get' method to retrieve info # utilize nova client ServerManager 'get' method to retrieve info
try: amphora = self.manager.get(compute_id)
amphora = self.manager.get(compute_id)
except Exception as e:
LOG.exception("Error retrieving nova virtual machine.")
raise exceptions.ComputeGetException() from e
return self._translate_amphora(amphora, management_network_id) return self._translate_amphora(amphora, management_network_id)
def _translate_amphora(self, nova_response, management_network_id=None): def _translate_amphora(self, nova_response, management_network_id=None):
'''Convert a nova virtual machine into an amphora object. '''Convert a nova virtual machine into an amphora object.
:param nova_response: JSON response from nova :param nova_response: JSON response from nova
:param management_network_id: ID of the management network :param management_network_id: ID of the management network
:returns: an amphora object :returns: an amphora object
:returns: fault message or None :returns: fault message or None
''' '''
 End of changes. 3 change blocks. 
5 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)