1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-07 21:17:55 +03:00

Improve some errors for openconsole/channel

Functions like virDomainOpenConsole() and virDomainOpenChannel() accept
NULL as a dev_name parameter.  Try using alias for the error message if
dev_name is not specified.

Before:
  error: internal error: character device <null> is not using a PTY

After:
  error: internal error: character device serial0 is not using a PTY

Signed-off-by: Luyao Huang <lhuang@redhat.com>
This commit is contained in:
Luyao Huang 2015-06-15 21:58:36 +08:00 committed by Martin Kletzander
parent dc7339fc4f
commit 898e76f0aa
5 changed files with 9 additions and 6 deletions

View File

@ -4299,7 +4299,7 @@ libxlDomainOpenConsole(virDomainPtr dom,
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("character device %s is not using a PTY"),
NULLSTR(dev_name));
dev_name ? dev_name : NULLSTR(chr->info.alias));
goto cleanup;
}

View File

@ -3484,7 +3484,8 @@ lxcDomainOpenConsole(virDomainPtr dom,
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("character device %s is not using a PTY"), dev_name);
_("character device %s is not using a PTY"),
dev_name ? dev_name : NULLSTR(chr->info.alias));
goto cleanup;
}

View File

@ -15958,7 +15958,7 @@ qemuDomainOpenConsole(virDomainPtr dom,
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("character device %s is not using a PTY"),
NULLSTR(dev_name));
dev_name ? dev_name : NULLSTR(chr->info.alias));
goto cleanup;
}
@ -16032,7 +16032,7 @@ qemuDomainOpenChannel(virDomainPtr dom,
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_UNIX) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("channel %s is not using a UNIX socket"),
NULLSTR(name));
name ? name : NULLSTR(chr->info.alias));
goto cleanup;
}

View File

@ -2640,7 +2640,8 @@ umlDomainOpenConsole(virDomainPtr dom,
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("character device %s is not using a PTY"), dev_name);
_("character device %s is not using a PTY"),
dev_name ? dev_name : NULLSTR(chr->info.alias));
goto cleanup;
}

View File

@ -2705,7 +2705,8 @@ xenUnifiedDomainOpenConsole(virDomainPtr dom,
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("character device %s is not using a PTY"), dev_name);
_("character device %s is not using a PTY"),
dev_name ? dev_name : NULLSTR(chr->info.alias));
goto cleanup;
}