提交 898e76f0 编写于 作者: L Luyao Huang 提交者: Martin Kletzander

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: NLuyao Huang <lhuang@redhat.com>
上级 dc7339fc
...@@ -4299,7 +4299,7 @@ libxlDomainOpenConsole(virDomainPtr dom, ...@@ -4299,7 +4299,7 @@ libxlDomainOpenConsole(virDomainPtr dom,
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) { if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("character device %s is not using a PTY"), _("character device %s is not using a PTY"),
NULLSTR(dev_name)); dev_name ? dev_name : NULLSTR(chr->info.alias));
goto cleanup; goto cleanup;
} }
......
...@@ -3484,7 +3484,8 @@ lxcDomainOpenConsole(virDomainPtr dom, ...@@ -3484,7 +3484,8 @@ lxcDomainOpenConsole(virDomainPtr dom,
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) { if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
virReportError(VIR_ERR_INTERNAL_ERROR, 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; goto cleanup;
} }
......
...@@ -15958,7 +15958,7 @@ qemuDomainOpenConsole(virDomainPtr dom, ...@@ -15958,7 +15958,7 @@ qemuDomainOpenConsole(virDomainPtr dom,
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) { if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("character device %s is not using a PTY"), _("character device %s is not using a PTY"),
NULLSTR(dev_name)); dev_name ? dev_name : NULLSTR(chr->info.alias));
goto cleanup; goto cleanup;
} }
...@@ -16032,7 +16032,7 @@ qemuDomainOpenChannel(virDomainPtr dom, ...@@ -16032,7 +16032,7 @@ qemuDomainOpenChannel(virDomainPtr dom,
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_UNIX) { if (chr->source.type != VIR_DOMAIN_CHR_TYPE_UNIX) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("channel %s is not using a UNIX socket"), _("channel %s is not using a UNIX socket"),
NULLSTR(name)); name ? name : NULLSTR(chr->info.alias));
goto cleanup; goto cleanup;
} }
......
...@@ -2640,7 +2640,8 @@ umlDomainOpenConsole(virDomainPtr dom, ...@@ -2640,7 +2640,8 @@ umlDomainOpenConsole(virDomainPtr dom,
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) { if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
virReportError(VIR_ERR_INTERNAL_ERROR, 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; goto cleanup;
} }
......
...@@ -2705,7 +2705,8 @@ xenUnifiedDomainOpenConsole(virDomainPtr dom, ...@@ -2705,7 +2705,8 @@ xenUnifiedDomainOpenConsole(virDomainPtr dom,
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) { if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
virReportError(VIR_ERR_INTERNAL_ERROR, 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; goto cleanup;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册