Exemplo n.º 1
0
    def test_mgmt_uuid(self, mock_get_partition):
        mock_get_partition.return_value = mock.Mock(uuid='mock_mgmt')
        adpt = mock.Mock()

        # First run should call the partition only once
        self.assertEqual('mock_mgmt', mgmt.mgmt_uuid(adpt))
        mock_get_partition.assert_called_once_with(adpt)

        # But a subsequent call should effectively no-op
        mock_get_partition.reset_mock()
        self.assertEqual('mock_mgmt', mgmt.mgmt_uuid(adpt))
        self.assertEqual(mock_get_partition.call_count, 0)
Exemplo n.º 2
0
    def test_mgmt_uuid(self, mock_get_partition):
        mock_get_partition.return_value = mock.Mock(uuid='mock_mgmt')
        adpt = mock.Mock()

        # First run should call the partition only once
        self.assertEqual('mock_mgmt', mgmt.mgmt_uuid(adpt))
        mock_get_partition.assert_called_once_with(adpt)

        # But a subsequent call should effectively no-op
        mock_get_partition.reset_mock()
        self.assertEqual('mock_mgmt', mgmt.mgmt_uuid(adpt))
        self.assertEqual(mock_get_partition.call_count, 0)
Exemplo n.º 3
0
    def __init__(self, adapter, host_uuid):
        """Initialize the SSPDiskAdapter.

        :param adapter: pypowervm.adapter.Adapter for the PowerVM REST API.
        :param host_uuid: PowerVM UUID of the managed system.
        """
        self._adapter = adapter
        self._host_uuid = host_uuid
        self.mp_uuid = mgmt.mgmt_uuid(self._adapter)
        try:
            self._clust = pvm_clust.Cluster.get(self._adapter)[0]
            self._ssp = pvm_stg.SSP.get_by_href(self._adapter,
                                                self._clust.ssp_uri)
            self._tier = tsk_stg.default_tier_for_ssp(self._ssp)
        except pvm_exc.Error:
            LOG.exception("A unique PowerVM Cluster and Shared Storage Pool "
                          "is required in the default Tier.")
            raise exception.NotFound()

        LOG.info(
            "SSP Storage driver initialized. Cluster '%(clust_name)s'; "
            "SSP '%(ssp_name)s'; Tier '%(tier_name)s'", {
                'clust_name': self._clust.name,
                'ssp_name': self._ssp.name,
                'tier_name': self._tier.name
            })
Exemplo n.º 4
0
    def __init__(self, adapter, host_uuid):
        """Initialize the DiskAdapter.

        :param adapter: The pypowervm adapter.
        :param host_uuid: The UUID of the PowerVM host.
        """
        self._adapter = adapter
        self._host_uuid = host_uuid
        self.mp_uuid = mgmt.mgmt_uuid(self._adapter)