Re: [libvirt] PATCH: Support bootloaders in QEMU driver

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

 



On Tue, May 13, 2008 at 12:31:36AM +0100, Daniel P. Berrange wrote:
> The QEMU driver supports booting Xen guests via the Xenner hypervisor.  For
> such paravirtualized guests there is no regular BIOS, so the bootloader has
> to be run on the host. Xenner defaults  to pygrub, but since libvirt has a
> generic syntax for bootloaders, we should use it. So this patch adds support
> for the <bootloader> syntax in the QEMU drive, and passes this to Xenner via
> the -bootloader arg.
> 
> The patch is overly large, because when we have a bootloader we need to skip
> the kernel/initrd/cmdline/boot elements & thus caused alot of intrusive code
> re-indentation .
[...]
>  
> +    /* Extract bootloader */
> +    obj = xmlXPathEval(BAD_CAST "string(/domain/bootloader)", ctxt);
> +    if ((obj != NULL) && (obj->type == XPATH_STRING) &&
> +        (obj->stringval != NULL) && (obj->stringval[0] != 0)) {
> +        strncpy(def->os.bootloader, (const char*)obj->stringval, sizeof(def->os.bootloader));
> +        NUL_TERMINATE(def->os.bootloader);
> +        xmlXPathFreeObject(obj);
> +
> +        /* Set a default OS type, since <type> is optional with bootloader */
> +        strcpy(def->os.type, "xen");
> +    }
> +
>      /* Extract OS type info */
>      obj = xmlXPathEval(BAD_CAST "string(/domain/os/type[1])", ctxt);
>      if ((obj == NULL) || (obj->type != XPATH_STRING) ||
>          (obj->stringval == NULL) || (obj->stringval[0] == 0)) {
> +        if (!def->os.type[0]) {
> +            qemudReportError(conn, NULL, NULL, VIR_ERR_OS_TYPE,
> +                             "%s", _("no OS type"));
> +            goto error;
> +        }
> +    } else {
> +        strcpy(def->os.type, (const char *)obj->stringval);
> +        xmlXPathFreeObject(obj);
> +    }

  Argh, that part of the code has not been cleaned up, using virXPathString
there would make this way easier to read and check.

  The big indentation block change inflated the patch size a bit. it still
look fine.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard@xxxxxxxxxx  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

--
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]