Exemplo n.º 1
0
 def get_console_output(self, context, instance):
     azure_name = self._get_omni_name_from_instance(instance)
     if drv_conf.storage_account_name != "":
         LOG.info("Getting connsole output from azure instance: %s",
                  azure_name)
         output = utils.get_instance_view(self.compute_client,
                                          drv_conf.resource_group,
                                          azure_name)
         return output.boot_diagnostics.serial_console_log_blob_uri
     raise exception.ConsoleLogOutputException(
         instance_id=instance.uuid,
         reason="Cannot get console logs as Azure storage account name has "
         "not been configured for instance %s" % azure_name)
Exemplo n.º 2
0
    def get_console_output(self, instance):
        console_log_paths = (
            self._pathutils.get_vm_console_log_paths(instance.name))

        try:
            instance_log = ''
            # Start with the oldest console log file.
            for console_log_path in console_log_paths[::-1]:
                if os.path.exists(console_log_path):
                    with open(console_log_path, 'rb') as fp:
                        instance_log += fp.read()
            return instance_log
        except IOError as err:
            raise exception.ConsoleLogOutputException(
                instance_id=instance.uuid, reason=six.text_type(err))
    def get_console_output(self, instance_name):
        console_log_paths = self._pathutils.get_vm_console_log_paths(
            instance_name)

        try:
            log = b''
            # Start with the oldest console log file.
            for log_path in reversed(console_log_paths):
                if os.path.exists(log_path):
                    with open(log_path, 'rb') as fp:
                        log += fp.read()
            return log
        except IOError as err:
            raise exception.ConsoleLogOutputException(
                instance_id=instance_name, reason=six.text_type(err))
Exemplo n.º 4
0
    def get_console_output(self, instance_name):
        if self._vmutils.is_secure_vm(instance_name):
            err = _("Shielded/Encrypted VMs don't support serial console.")
            raise exception.ConsoleNotAvailable(err)

        console_log_paths = self._pathutils.get_vm_console_log_paths(
            instance_name)

        try:
            log = b''
            # Start with the oldest console log file.
            for log_path in reversed(console_log_paths):
                if os.path.exists(log_path):
                    with open(log_path, 'rb') as fp:
                        log += fp.read()
            return log
        except IOError as err:
            raise exception.ConsoleLogOutputException(
                instance_id=instance_name, reason=six.text_type(err))