On Fri, Nov 03, 2017 at 01:03:34PM +0100, Peter Krempa wrote:
Stash all the disk definition and capability checks into one
function.
---
src/qemu/qemu_command.c | 324 ++++++++++++++++++++++++------------------------
src/qemu/qemu_command.h | 3 +-
src/qemu/qemu_driver.c | 2 +-
3 files changed, 166 insertions(+), 163 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f7e9c0fa4..fa02a3895 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1199,9 +1199,16 @@ qemuCheckDiskConfigBlkdeviotune(virDomainDiskDefPtr disk,
}
-/* Perform disk definition config validity checks */
+/**
+ * qemuCheckDiskConfig:
+ * @disk: disk definition
+ * @qemuCaps: qemu capabilities, may be NULL for cold-plug check
+ *
+ * Perform disk definition config validity checks. Returns -1 on error with
+ * error reported */
Please put the ending */ on a separate line.
[...]
+ }
+ /* We can only have 1 FDC bus (currently) */
+ if (disk->info.addr.drive.bus != 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Only 1 fdc bus is supported"));
Extra space.
+ return -1;
+ }
@@ -1633,7 +1633,9 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
virDomainDiskGeometryTransTypeToString(disk->geometry.trans);
bool emitDeviceSyntax = qemuDiskBusNeedsDeviceArg(disk->bus);
- if (qemuBuildDriveStrValidate(disk, qemuCaps) < 0)
+ /* if we are using -device this was already chekced elsewhere */
s/chekced/checked/
s/was/will be/
The device string is built at a later time than the drive string.
+ if (!emitDeviceSyntax &&
+ qemuCheckDiskConfig(disk, qemuCaps) < 0)
goto error;
if (qemuBuildDriveSourceStr(disk, cfg, &opt, qemuCaps) < 0)
Jan