[libvirt] [PATCH v3 1/2] qemu: output error when try to hotplug unsupport console

Peter Krempa pkrempa at redhat.com
Thu Jan 22 10:19:23 UTC 2015


On Thu, Jan 22, 2015 at 10:28:18 +0800, Luyao Huang wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1164627
> 
> When using 'virsh attach-device' to hotplug an unsupported console type
> into a qemu guest, the attachment will erroneously allows the
> attachment. This patch will check to ensure that only the support target
> types are used for a running guest. NB, Although a guest can be defined
> with an improper target, startup will cause failure.

I tweaked the subject and commit message as some sentences didn't make
sense.

> 
> Signed-off-by: Luyao Huang <lhuang at redhat.com>
> ---
>  src/qemu/qemu_command.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index c041ee7..df87e1e 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -10067,13 +10067,17 @@ qemuBuildConsoleChrDeviceStr(char **deviceStr,
>          break;
>  
>      case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL:
> +        break;
>      case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE:
>      case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN:
>      case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML:
>      case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC:
>      case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ:
>      case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST:
> -        break;
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                       _("unsupported console target type %s"),
> +                       NULLSTR(virDomainChrConsoleTargetTypeToString(chr->targetType)));
> +        goto cleanup;
>      }

ACK, although the rest of the chardev command and hotplug code is a big
mess and would benefit from a cleanup/refactor.

Pushed.

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150122/349fbe47/attachment-0001.sig>


More information about the libvir-list mailing list