We allow do not pass the dev_name to openconsole() and openchannel() function, but the error message is not good when we do not specified the console/channel name. the error message after this patch: error: internal error: character device serial0 is not using a PTY Signed-off-by: Luyao Huang <lhuang@xxxxxxxxxx> --- src/libxl/libxl_driver.c | 4 ++-- src/lxc/lxc_driver.c | 3 ++- src/qemu/qemu_driver.c | 8 ++++---- src/uml/uml_driver.c | 3 ++- src/xen/xen_driver.c | 3 ++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index a7be745..c64d9be 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -4292,14 +4292,14 @@ libxlDomainOpenConsole(virDomainPtr dom, if (!chr) { virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find character device %s"), - NULLSTR(dev_name)); + dev_name ? dev_name : "to open"); goto cleanup; } 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; } diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 31fb470..cc1277b 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -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; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6bb8549..282b32f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16041,14 +16041,14 @@ qemuDomainOpenConsole(virDomainPtr dom, if (!chr) { virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find character device %s"), - NULLSTR(dev_name)); + dev_name ? dev_name : "to open"); goto cleanup; } 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; } @@ -16115,14 +16115,14 @@ qemuDomainOpenChannel(virDomainPtr dom, if (!chr) { virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find channel %s"), - NULLSTR(name)); + name ? name : "to open"); goto cleanup; } 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; } diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index f09e79b..7a95458 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -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; } diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index da9e6f4..ce31f0f 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -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; } -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list