コード例 #1
0
ファイル: __init__.py プロジェクト: Apekhsha/lago
def _deactivate_storage_domains(api, sds):
    if not sds:
        LOGGER.info('No storages to deactivate')
        return

    for sd in sds:
        if sd.status.get_state() != 'maintenance':
            sd.deactivate()
            LOGGER.info('Started deactivation of storage domain %s', sd.name)
        else:
            LOGGER.info('Storage domain %s already inactive', sd.name)

    with LogTask('Waiting for the domains to get into maintenance'):
        for sd in sds:
            dc = api.datacenters.get(id=sd.get_data_center().get_id())
            with LogTask(
                'Waiting for storage domain %s to become inactive' % sd.name,
                level='debug'
            ):
                testlib.assert_true_within_long(
                    lambda: (
                        dc.storagedomains.get(sd.name).status.state
                        == 'maintenance'
                    ),
                )
コード例 #2
0
ファイル: __init__.py プロジェクト: DavideD/lago
def _activate_storage_domains(api, sds):
    for sd in sds:
        sd.activate()

    for sd in sds:
        dc = api.datacenters.get(id=sd.get_data_center().get_id(), )
        testlib.assert_true_within_long(
            lambda: dc.storagedomains.get(sd.name).status.state == 'active',
        )
コード例 #3
0
def _deactivate_storage_domains(api, sds):
    for sd in sds:
        sd.deactivate()

    for sd in sds:
        dc = api.datacenters.get(id=sd.get_data_center().get_id())
        testlib.assert_true_within_long(
            lambda:
            dc.storagedomains.get(sd.name).status.state == 'maintenance',
        )
コード例 #4
0
    def _get_api(self, wait):
        if wait:
            self.wait_for_ssh()
            try:
                testlib.assert_true_within_long(
                    lambda: self.service('ovirt-engine').alive())

                api = []
                testlib.assert_true_within_short(
                    lambda: api.append(self._create_api()) or True)
            except AssertionError:
                raise RuntimeError('Failed to connect to the engine')
        return api.pop()
コード例 #5
0
    def _get_api(self, wait):
        if wait:
            self.wait_for_ssh()
            try:
                testlib.assert_true_within_long(
                    lambda: self.service('ovirt-engine').alive()
                )

                api = []
                testlib.assert_true_within_short(
                    lambda: api.append(self._create_api()) or True
                )
            except AssertionError:
                raise RuntimeError('Failed to connect to the engine')
        return api.pop()
コード例 #6
0
ファイル: __init__.py プロジェクト: Apekhsha/lago
    def _activate(self):
        with LogTask('Wait for ssh connectivity'):
            for vm in self.virt_env.get_vms().values():
                vm.wait_for_ssh()

        with LogTask('Wait for engine to go online'):
            testlib.assert_true_within_long(
                lambda: self.virt_env.engine_vm().get_api() or True,
                allowed_exceptions=[RequestError, ConnectionError],
            )

        api = self.virt_env.engine_vm().get_api()
        with LogTask('Activate hosts'):
            _activate_all_hosts(api)
        with LogTask('Activate storage domains'):
            _activate_all_storage_domains(api)