mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-25 04:42:20 +00:00
conf: introduce virDomainDefParseBootInitOptions
Extract the code to it's own function. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
f47d06260b
commit
b07116438c
@ -19506,25 +19506,14 @@ virDomainVcpuParse(virDomainDefPtr def,
|
||||
|
||||
|
||||
static int
|
||||
virDomainDefParseBootOptions(virDomainDefPtr def,
|
||||
virDomainDefParseBootInitOptions(virDomainDefPtr def,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
char *name = NULL;
|
||||
size_t i;
|
||||
int n;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
g_autofree char *tmp = NULL;
|
||||
|
||||
/*
|
||||
* Booting options for different OS types....
|
||||
*
|
||||
* - A bootloader (and optional kernel+initrd) (xen)
|
||||
* - A kernel + initrd (xen)
|
||||
* - A boot device (and optional kernel+initrd) (hvm)
|
||||
* - An init script (exe)
|
||||
*/
|
||||
|
||||
if (def->os.type == VIR_DOMAIN_OSTYPE_EXE) {
|
||||
def->os.init = virXPathString("string(./os/init[1])", ctxt);
|
||||
def->os.cmdline = virXPathString("string(./os/cmdline[1])", ctxt);
|
||||
def->os.initdir = virXPathString("string(./os/initdir[1])", ctxt);
|
||||
@ -19571,7 +19560,31 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
|
||||
def->os.initenv[i]->value = g_strdup((const char *)nodes[i]->children->content);
|
||||
}
|
||||
def->os.initenv[n] = NULL;
|
||||
VIR_FREE(nodes);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virDomainDefParseBootOptions(virDomainDefPtr def,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
int n;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
g_autofree char *tmp = NULL;
|
||||
|
||||
/*
|
||||
* Booting options for different OS types....
|
||||
*
|
||||
* - A bootloader (and optional kernel+initrd) (xen)
|
||||
* - A kernel + initrd (xen)
|
||||
* - A boot device (and optional kernel+initrd) (hvm)
|
||||
* - An init script (exe)
|
||||
*/
|
||||
|
||||
if (def->os.type == VIR_DOMAIN_OSTYPE_EXE) {
|
||||
if (virDomainDefParseBootInitOptions(def, ctxt) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (def->os.type == VIR_DOMAIN_OSTYPE_XEN ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user