}
}
-static void
+static int
vboxAttachDrives(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
{
size_t i;
- int type, format;
+ int type, format, ret = 0;
const char *src = NULL;
nsresult rc = 0;
virDomainDiskDefPtr disk = NULL;
deviceType = DeviceType_Floppy;
accessMode = AccessMode_ReadWrite;
} else {
+ ret = -1;
goto cleanup;
}
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to attach the following disk/dvd/floppy "
"to the machine: %s, rc=%08x"), src, rc);
+ ret = -1;
goto cleanup;
}
_("Can't get the UUID of the file to be attached "
"as harddisk/dvd/floppy: %s, rc=%08x"),
src, rc);
+ ret = -1;
goto cleanup;
}
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not attach the file as "
"harddisk/dvd/floppy: %s, rc=%08x"), src, rc);
+ ret = -1;
+ goto cleanup;
} else {
DEBUGIID("Attached HDD/DVD/Floppy with UUID", &mediumUUID);
}
vboxIIDUnalloc(&mediumUUID);
VBOX_UTF16_FREE(mediumFileUtf16);
VBOX_UTF16_FREE(storageCtlName);
+
+ if (ret < 0)
+ break;
}
}
+
+ return ret;
}
static void
gVBoxAPI.UISession.GetMachine(data->vboxSession, &machine);
vboxSetBootDeviceOrder(def, data, machine);
- vboxAttachDrives(def, data, machine);
+ if (vboxAttachDrives(def, data, machine) < 0)
+ goto cleanup;
vboxAttachSound(def, machine);
if (vboxAttachNetwork(def, data, machine) < 0)
goto cleanup;