Fallback to saved ovf-env.xml file
This commit is contained in:
parent
01e02ae0aa
commit
0bd6427d39
2 changed files with 17 additions and 5 deletions
|
@ -653,17 +653,27 @@ azure_getovfenv(struct system_config *sc)
|
||||||
int mount = 0, ret = -1, fd = -1;
|
int mount = 0, ret = -1, fd = -1;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
/* try to mount the cdrom */
|
/* Silently try to mount the cdrom */
|
||||||
if (shell("mount", "-r", sc->sc_cdrom, "/mnt", NULL) == 0) {
|
fd = disable_output(sc, STDERR_FILENO);
|
||||||
|
ret = shell("mount", "-r", sc->sc_cdrom, "/mnt", NULL);
|
||||||
|
enable_output(sc, STDERR_FILENO, fd);
|
||||||
|
fd = -1;
|
||||||
|
|
||||||
|
if (ret == 0) {
|
||||||
log_debug("%s: mounted %s", __func__, sc->sc_cdrom);
|
log_debug("%s: mounted %s", __func__, sc->sc_cdrom);
|
||||||
mount = 1;
|
mount = 1;
|
||||||
}
|
}
|
||||||
|
ret = -1;
|
||||||
|
|
||||||
if (xml_init(&xml) != 0) {
|
if (xml_init(&xml) != 0) {
|
||||||
log_debug("%s: xml", __func__);
|
log_debug("%s: xml", __func__);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
xml_parse(&xml, "/mnt/ovf-env.xml");
|
|
||||||
|
/* Fallback to and older ovf-env.xml file */
|
||||||
|
if (xml_parse(&xml, "/mnt/ovf-env.xml") == -1 &&
|
||||||
|
xml_parse(&xml, sc->sc_ovfenv) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
/* unmount if we mounted the cdrom before */
|
/* unmount if we mounted the cdrom before */
|
||||||
if (mount && shell("umount", "/mnt", NULL) == 0) {
|
if (mount && shell("umount", "/mnt", NULL) == 0) {
|
||||||
|
|
|
@ -341,8 +341,10 @@ xml_parse(struct xml *env, const char *file)
|
||||||
void *xml;
|
void *xml;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
|
||||||
if ((fd = open(file, O_RDONLY)) == -1)
|
if ((fd = open(file, O_RDONLY)) == -1) {
|
||||||
fatal("open %s", file);
|
log_debug("%s: open %s", __func__, file);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if ((xml = XML_GetBuffer(parser, BUFSIZ)) == NULL)
|
if ((xml = XML_GetBuffer(parser, BUFSIZ)) == NULL)
|
||||||
|
|
Loading…
Reference in a new issue