Ejemplo n.º 1
0
    def start_console_handler(self, instance_name):
        if self._vmutils.is_secure_vm(instance_name):
            LOG.warning(
                _LW("Skipping starting serial console handler. "
                    "Shielded/Encrypted VM %(instance_name)s "
                    "doesn't support serial console."),
                {'instance_name': instance_name})
            return

        # Cleanup existing workers.
        self.stop_console_handler_unsync(instance_name)
        handler = None

        try:
            handler = serialconsolehandler.SerialConsoleHandler(instance_name)
            handler.start()
            _console_handlers[instance_name] = handler
        except Exception as exc:
            LOG.error(
                _LE('Instance %(instance_name)s serial console handler '
                    'could not start. Exception %(exc)s'), {
                        'instance_name': instance_name,
                        'exc': exc
                    })
            if handler:
                handler.stop()
    def setUp(self, mock_get_pathutils):
        super(SerialConsoleHandlerTestCase, self).setUp()
        self._consolehandler = serialconsolehandler.SerialConsoleHandler(
            mock.sentinel.instance_name)

        self._consolehandler._log_path = mock.sentinel.log_path
        self._consolehandler._pathutils = mock.Mock()
        self._consolehandler._vmutils = mock.Mock()
Ejemplo n.º 3
0
    def setUp(self):
        super(SerialConsoleHandlerTestCase, self).setUp()
        self._consolehandler = serialconsolehandler.SerialConsoleHandler(
            self._FAKE_INSTANCE_NAME)

        self._consolehandler._log_path = mock.sentinel.log_path
        self._consolehandler._pathutils = mock.Mock()
        self._consolehandler._vmutils = mock.Mock()
Ejemplo n.º 4
0
    def start_console_handler(self, instance_name):
        # Cleanup existing workers.
        self._stop_console_handler(instance_name)
        handler = None

        try:
            handler = serialconsolehandler.SerialConsoleHandler(
                instance_name)
            handler.start()
            _console_handlers[instance_name] = handler
        except Exception as exc:
            LOG.error(_LE('Instance %(instance_name)s serial console handler '
                          'could not start. Exception %(exc)s'),
                      {'instance_name': instance_name,
                       'exc': exc})
            if handler:
                handler.stop()