Exemple #1
0
    def init_host(self, host):
        """Initialize anything that is necessary for the driver to function.

        Includes catching up with currently running VMs on the given host.
        """
        # Build the adapter. May need to attempt the connection multiple times
        # in case the PowerVM management API service is starting.
        # TODO(efried): Implement async compute service enable/disable like
        # I73a34eb6e0ca32d03e54d12a5e066b2ed4f19a61
        self.adapter = pvm_apt.Adapter(
            pvm_apt.Session(conn_tries=60),
            helpers=[log_hlp.log_helper, vio_hlp.vios_busy_retry_helper])
        # Make sure the Virtual I/O Server(s) are available.
        pvm_par.validate_vios_ready(self.adapter)
        self.host_wrapper = pvm_ms.System.get(self.adapter)[0]

        # Do a scrub of the I/O plane to make sure the system is in good shape
        LOG.info("Clearing stale I/O connections on driver init.")
        pvm_stor.ComprehensiveScrub(self.adapter).execute()

        # Initialize the disk adapter
        self.disk_dvr = importutils.import_object_ns(
            DISK_ADPT_NS, DISK_ADPT_MAPPINGS[CONF.powervm.disk_driver.lower()],
            self.adapter, self.host_wrapper.uuid)
        self.image_api = image.API()

        LOG.info("The PowerVM compute driver has been initialized.")
Exemple #2
0
    def init_host(self, host):
        """Initialize anything that is necessary for the driver to function.

        Includes catching up with currently running VMs on the given host.
        """
        # Build the adapter. May need to attempt the connection multiple times
        # in case the PowerVM management API service is starting.
        # TODO(efried): Implement async compute service enable/disable like
        # I73a34eb6e0ca32d03e54d12a5e066b2ed4f19a61
        self.adapter = pvm_apt.Adapter(
            pvm_apt.Session(conn_tries=60),
            helpers=[log_hlp.log_helper, vio_hlp.vios_busy_retry_helper])
        # Make sure the Virtual I/O Server(s) are available.
        pvm_par.validate_vios_ready(self.adapter)
        self.host_wrapper = pvm_ms.System.get(self.adapter)[0]

        # Do a scrub of the I/O plane to make sure the system is in good shape
        LOG.info("Clearing stale I/O connections on driver init.")
        pvm_stor.ComprehensiveScrub(self.adapter).execute()

        # Initialize the disk adapter
        # TODO(efried): Other disk adapters (localdisk), by conf selection.
        self.disk_dvr = ssp.SSPDiskAdapter(self.adapter,
                                           self.host_wrapper.uuid)
        self.image_api = image.API()

        LOG.info("The PowerVM compute driver has been initialized.")
Exemple #3
0
    def init_host(self, host):
        """Initialize anything that is necessary for the driver to function.

        Includes catching up with currently running VMs on the given host.
        """
        LOG.warning(
            'The powervm virt driver is deprecated and may be removed in a '
            'future release. The driver is not tested by the OpenStack '
            'project nor does it have clear maintainers and thus its quality'
            'can not be ensured. If you are using the driver in production '
            'please let us know the openstack-discuss mailing list or on IRC'
        )

        # Build the adapter. May need to attempt the connection multiple times
        # in case the PowerVM management API service is starting.
        # TODO(efried): Implement async compute service enable/disable like
        # I73a34eb6e0ca32d03e54d12a5e066b2ed4f19a61
        self.adapter = pvm_apt.Adapter(
            pvm_apt.Session(conn_tries=60),
            helpers=[log_hlp.log_helper, vio_hlp.vios_busy_retry_helper])
        # Make sure the Virtual I/O Server(s) are available.
        pvm_par.validate_vios_ready(self.adapter)
        self.host_wrapper = pvm_ms.System.get(self.adapter)[0]

        # Do a scrub of the I/O plane to make sure the system is in good shape
        LOG.info("Clearing stale I/O connections on driver init.")
        pvm_stor.ComprehensiveScrub(self.adapter).execute()

        # Initialize the disk adapter
        self.disk_dvr = importutils.import_object_ns(
            DISK_ADPT_NS, DISK_ADPT_MAPPINGS[CONF.powervm.disk_driver.lower()],
            self.adapter, self.host_wrapper.uuid)
        self.image_api = glance.API()

        LOG.info("The PowerVM compute driver has been initialized.")
Exemple #4
0
    def test_timeout_short(self, mock_warn):
        """Short timeout because relevant VIOSes have been up a while."""

        self.mock_vios_get.return_value = self._mk_mock_vioses()

        tpar.validate_vios_ready('adap')
        # We slept 120s, (24 x 5s) because all VIOSes have been up >1h
        self.assertEqual(24, self.mock_sleep.call_count)
        self.mock_sleep.assert_called_with(5)
        # We wound up with rmc_down_vioses
        mock_warn.assert_called_once_with(mock.ANY, {'time': 120,
                                                     'vioses': 'vios3, vios6'})
Exemple #5
0
 def test_exception_and_good_path(self, mock_warn):
     """VIOS.get raises, then succeeds with some halfsies, then succeeds."""
     vios1_good = mock_vios('vios1', bp.LPARState.RUNNING,
                            bp.RMCState.BUSY)
     vios2_bad = mock_vios('vios2', bp.LPARState.RUNNING,
                           bp.RMCState.UNKNOWN)
     vios2_good = mock_vios('vios2', bp.LPARState.RUNNING,
                            bp.RMCState.ACTIVE)
     self.mock_vios_get.side_effect = (ValueError('foo'),
                                       [vios1_good, vios2_bad],
                                       [vios1_good, vios2_good])
     tpar.validate_vios_ready('adap')
     self.assertEqual(3, self.mock_vios_get.call_count)
     self.assertEqual(2, self.mock_sleep.call_count)
     mock_warn.assert_called_once_with(mock.ANY)
Exemple #6
0
    def test_rmc_down_vioses(self, mock_warn):
        """Time out waiting for up/inactive partitions, but succeed."""

        vioses = self._mk_mock_vioses()
        # This one booted "recently"
        vioses[5].uptime = 3559
        self.mock_vios_get.return_value = vioses

        tpar.validate_vios_ready('adap')
        # We slept 600s, (120 x 5s) because one VIOS booted "recently"
        self.assertEqual(120, self.mock_sleep.call_count)
        self.mock_sleep.assert_called_with(5)
        # We wound up with rmc_down_vioses
        mock_warn.assert_called_once_with(mock.ANY, {'time': 600,
                                                     'vioses': 'vios3, vios6'})
Exemple #7
0
    def init_host(self, host):
        """Initialize anything that is necessary for the driver to function.

        Includes catching up with currently running VMs on the given host.
        """
        # Build the adapter.  May need to attempt the connection multiple times
        # in case the PowerVM management API service is starting.
        # TODO(efried): Implement async compute service enable/disable like
        # I73a34eb6e0ca32d03e54d12a5e066b2ed4f19a61
        self.adapter = pvm_apt.Adapter(
            pvm_apt.Session(conn_tries=60),
            helpers=[log_hlp.log_helper, vio_hlp.vios_busy_retry_helper])
        # Make sure the Virtual I/O Server(s) are available.
        pvm_par.validate_vios_ready(self.adapter)
        self.host_wrapper = pvm_ms.System.get(self.adapter)[0]
        LOG.info("The PowerVM compute driver has been initialized.")