]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: output error when try to hotplug unsupported console type
authorLuyao Huang <lhuang@redhat.com>
Thu, 22 Jan 2015 02:28:18 +0000 (10:28 +0800)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 22 Jan 2015 10:17:14 +0000 (11:17 +0100)
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 would succeed as the command line
formatter didn't report error in such case.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
src/qemu/qemu_command.c

index 7e1f3d09587f6b10d3f76e8e65dda9398fa5b9f7..1ebfdd133dd9f9a6001cdffbdbc02ecafe81a592 100644 (file)
@@ -10068,13 +10068,18 @@ 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;
     }
 
     ret = 0;