1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-11 09:17:52 +03:00

qemu: Drop emitBootindex parameter

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2016-06-28 23:13:17 +02:00
parent 0dd67acfa7
commit 77437410d7

View File

@ -1905,8 +1905,7 @@ qemuBuildDriveDevStr(const virDomainDef *def,
static int static int
qemuBuildDiskDriveCommandLine(virCommandPtr cmd, qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
const virDomainDef *def, const virDomainDef *def,
virQEMUCapsPtr qemuCaps, virQEMUCapsPtr qemuCaps)
bool emitBootindex)
{ {
size_t i; size_t i;
unsigned int bootCD = 0; unsigned int bootCD = 0;
@ -1915,7 +1914,8 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
virBuffer fdc_opts = VIR_BUFFER_INITIALIZER; virBuffer fdc_opts = VIR_BUFFER_INITIALIZER;
char *fdc_opts_str = NULL; char *fdc_opts_str = NULL;
if ((virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) || emitBootindex)) { if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) ||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) {
/* bootDevs will get translated into either bootindex=N or boot=on /* bootDevs will get translated into either bootindex=N or boot=on
* depending on what qemu supports */ * depending on what qemu supports */
for (i = 0; i < def->os.nBootDevs; i++) { for (i = 0; i < def->os.nBootDevs; i++) {
@ -1936,6 +1936,7 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
for (i = 0; i < def->ndisks; i++) { for (i = 0; i < def->ndisks; i++) {
char *optstr; char *optstr;
unsigned int bootindex = 0; unsigned int bootindex = 0;
bool driveBoot = false;
virDomainDiskDefPtr disk = def->disks[i]; virDomainDiskDefPtr disk = def->disks[i];
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
qemuDomainSecretInfoPtr secinfo = diskPriv->secinfo; qemuDomainSecretInfoPtr secinfo = diskPriv->secinfo;
@ -1948,20 +1949,28 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
return -1; return -1;
} }
switch (disk->device) { if (disk->info.bootIndex) {
case VIR_DOMAIN_DISK_DEVICE_CDROM: bootindex = disk->info.bootIndex;
bootindex = bootCD; } else {
bootCD = 0; switch (disk->device) {
break; case VIR_DOMAIN_DISK_DEVICE_CDROM:
case VIR_DOMAIN_DISK_DEVICE_FLOPPY: bootindex = bootCD;
bootindex = bootFloppy; bootCD = 0;
bootFloppy = 0; break;
break; case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
case VIR_DOMAIN_DISK_DEVICE_DISK: bootindex = bootFloppy;
case VIR_DOMAIN_DISK_DEVICE_LUN: bootFloppy = 0;
bootindex = bootDisk; break;
bootDisk = 0; case VIR_DOMAIN_DISK_DEVICE_DISK:
break; case VIR_DOMAIN_DISK_DEVICE_LUN:
bootindex = bootDisk;
bootDisk = 0;
break;
}
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) {
driveBoot = !!bootindex;
bootindex = 0;
}
} }
if (qemuBuildDiskSecinfoCommandLine(cmd, secinfo) < 0) if (qemuBuildDiskSecinfoCommandLine(cmd, secinfo) < 0)
@ -1969,19 +1978,11 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
virCommandAddArg(cmd, "-drive"); virCommandAddArg(cmd, "-drive");
optstr = qemuBuildDriveStr(disk, if (!(optstr = qemuBuildDriveStr(disk, driveBoot, qemuCaps)))
emitBootindex ? false : !!bootindex,
qemuCaps);
if (!optstr)
return -1; return -1;
virCommandAddArg(cmd, optstr); virCommandAddArg(cmd, optstr);
VIR_FREE(optstr); VIR_FREE(optstr);
if (!emitBootindex)
bootindex = 0;
else if (disk->info.bootIndex)
bootindex = disk->info.bootIndex;
if (qemuDiskBusNeedsDeviceArg(disk->bus)) { if (qemuDiskBusNeedsDeviceArg(disk->bus)) {
if (disk->bus == VIR_DOMAIN_DISK_BUS_FDC) { if (disk->bus == VIR_DOMAIN_DISK_BUS_FDC) {
if (virAsprintf(&optstr, "drive%c=drive-%s", if (virAsprintf(&optstr, "drive%c=drive-%s",
@ -6018,8 +6019,7 @@ qemuBuildPMCommandLine(virCommandPtr cmd,
static int static int
qemuBuildBootCommandLine(virCommandPtr cmd, qemuBuildBootCommandLine(virCommandPtr cmd,
const virDomainDef *def, const virDomainDef *def,
virQEMUCapsPtr qemuCaps, virQEMUCapsPtr qemuCaps)
bool *emitBootindex)
{ {
size_t i; size_t i;
virBuffer boot_buf = VIR_BUFFER_INITIALIZER; virBuffer boot_buf = VIR_BUFFER_INITIALIZER;
@ -6029,8 +6029,9 @@ qemuBuildBootCommandLine(virCommandPtr cmd,
* We prefer using explicit bootindex=N parameters for predictable * We prefer using explicit bootindex=N parameters for predictable
* results even though domain XML doesn't use per device boot elements. * results even though domain XML doesn't use per device boot elements.
*/ */
*emitBootindex = true;
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) {
char boot[VIR_DOMAIN_BOOT_LAST+1];
if (def->os.nBootDevs == 0) { if (def->os.nBootDevs == 0) {
/* def->os.nBootDevs is guaranteed to be > 0 unless per-device boot /* def->os.nBootDevs is guaranteed to be > 0 unless per-device boot
* configuration is used * configuration is used
@ -6039,11 +6040,6 @@ qemuBuildBootCommandLine(virCommandPtr cmd,
_("hypervisor lacks deviceboot feature")); _("hypervisor lacks deviceboot feature"));
goto error; goto error;
} }
*emitBootindex = false;
}
if (!*emitBootindex) {
char boot[VIR_DOMAIN_BOOT_LAST+1];
for (i = 0; i < def->os.nBootDevs; i++) { for (i = 0; i < def->os.nBootDevs; i++) {
switch (def->os.bootDevs[i]) { switch (def->os.bootDevs[i]) {
@ -8018,7 +8014,6 @@ qemuBuildNetCommandLine(virCommandPtr cmd,
virQEMUCapsPtr qemuCaps, virQEMUCapsPtr qemuCaps,
virNetDevVPortProfileOp vmop, virNetDevVPortProfileOp vmop,
bool standalone, bool standalone,
bool emitBootindex,
size_t *nnicindexes, size_t *nnicindexes,
int **nicindexes, int **nicindexes,
unsigned int *bootHostdevNet) unsigned int *bootHostdevNet)
@ -8030,7 +8025,7 @@ qemuBuildNetCommandLine(virCommandPtr cmd,
if (def->nnets) { if (def->nnets) {
unsigned int bootNet = 0; unsigned int bootNet = 0;
if (emitBootindex) { if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) {
/* convert <boot dev='network'/> to bootindex since we didn't emit /* convert <boot dev='network'/> to bootindex since we didn't emit
* -boot n * -boot n
*/ */
@ -9137,7 +9132,6 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
size_t i; size_t i;
char uuid[VIR_UUID_STRING_BUFLEN]; char uuid[VIR_UUID_STRING_BUFLEN];
virCommandPtr cmd = NULL; virCommandPtr cmd = NULL;
bool emitBootindex = false;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
unsigned int bootHostdevNet = 0; unsigned int bootHostdevNet = 0;
@ -9245,7 +9239,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
if (qemuBuildPMCommandLine(cmd, def, qemuCaps, monitor_json) < 0) if (qemuBuildPMCommandLine(cmd, def, qemuCaps, monitor_json) < 0)
goto error; goto error;
if (qemuBuildBootCommandLine(cmd, def, qemuCaps, &emitBootindex) < 0) if (qemuBuildBootCommandLine(cmd, def, qemuCaps) < 0)
goto error; goto error;
if (qemuBuildGlobalControllerCommandLine(cmd, def, qemuCaps) < 0) if (qemuBuildGlobalControllerCommandLine(cmd, def, qemuCaps) < 0)
@ -9257,15 +9251,14 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
if (qemuBuildHubCommandLine(cmd, def, qemuCaps) < 0) if (qemuBuildHubCommandLine(cmd, def, qemuCaps) < 0)
goto error; goto error;
if (qemuBuildDiskDriveCommandLine(cmd, def, qemuCaps, emitBootindex) < 0) if (qemuBuildDiskDriveCommandLine(cmd, def, qemuCaps) < 0)
goto error; goto error;
if (qemuBuildFSDevCommandLine(cmd, def, qemuCaps) < 0) if (qemuBuildFSDevCommandLine(cmd, def, qemuCaps) < 0)
goto error; goto error;
if (qemuBuildNetCommandLine(cmd, driver, def, qemuCaps, vmop, standalone, if (qemuBuildNetCommandLine(cmd, driver, def, qemuCaps, vmop, standalone,
emitBootindex, nnicindexes, nicindexes, nnicindexes, nicindexes, &bootHostdevNet) < 0)
&bootHostdevNet) < 0)
goto error; goto error;
if (qemuBuildSmartcardCommandLine(logManager, cmd, cfg, def, qemuCaps) < 0) if (qemuBuildSmartcardCommandLine(logManager, cmd, cfg, def, qemuCaps) < 0)