mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
vmx: Allow missing cdrom image file in virVMXParseFileName
This will be used later. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
@@ -139,7 +139,8 @@ testCompareHelper(const void *data)
|
||||
static int
|
||||
testParseVMXFileName(const char *fileName,
|
||||
void *opaque G_GNUC_UNUSED,
|
||||
char **src)
|
||||
char **src,
|
||||
bool allow_missing)
|
||||
{
|
||||
g_autofree char *copyOfFileName = NULL;
|
||||
char *tmp = NULL;
|
||||
@@ -160,6 +161,16 @@ testParseVMXFileName(const char *fileName,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (STREQ(datastoreName, "missing") ||
|
||||
STRPREFIX(directoryAndFileName, "missing")) {
|
||||
if (allow_missing)
|
||||
return 0;
|
||||
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"Referenced missing file '%s'", fileName);
|
||||
return -1;
|
||||
}
|
||||
|
||||
*src = g_strdup_printf("[%s] %s", datastoreName, directoryAndFileName);
|
||||
} else if (STRPREFIX(fileName, "/")) {
|
||||
/* Found absolute path referencing a file outside a datastore */
|
||||
|
||||
Reference in New Issue
Block a user