Re: [PATCH] qemu: Use -vga none only if it is supported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/08/2010 07:36 AM, Jiri Denemark wrote:
> Commit febc591683cf51e4551f8bcf3ce279a776056e1c introduced -vga none in
> case no video card is included in domain XML. However, old qemu
> versions do not support this and such domain cannot be successfully
> started.

> @@ -1252,11 +1253,15 @@ static unsigned long long qemudComputeCmdFlags(const char *help,
>          if (strstr(help, "readonly="))
>              flags |= QEMUD_CMD_FLAG_DRIVE_READONLY;
>      }
> -    if (strstr(help, "-vga") && !strstr(help, "-std-vga")) {
> +    if ((p = strstr(help, "-vga")) && !strstr(help, "-std-vga")) {

I think this can be simplified to work via a single scan, rather than
having to do a second scan to filter out the older -std-vga:

if ((p = strstr(help, "\n-vga") != NULL) {

> +        const char *nl = strstr(p, "\n");

If you make the above tweak, then you'd need strstr(++p, "\n") here.

> +
>          flags |= QEMUD_CMD_FLAG_VGA;
>  
>          if (strstr(help, "|qxl"))
>              flags |= QEMUD_CMD_FLAG_VGA_QXL;

Ouch - we don't have anything in tests/qemuhelpdata/ that tests this
line of code.  But that's an independent problem.

Meanwhile, that could be made more efficient via strstr(p, "|qxl") (no
need to reparse the chunk between help and p).

> +        if ((p = strstr(p, "|none")) && p < nl)
> +            flags |= QEMUD_CMD_FLAG_VGA_NONE;

qemu -help parsing is so brittle.  But this looks correct.

ACK - I can live with the patch as-is (since you want to backport it
rapidly to RHEL); or you can take the time to make the tweaks above.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]