This time it only builds one device.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_command.c | 44 ++++++++++++++++++++++++++---------------
1 file changed, 28 insertions(+), 16 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9d5d54fd6e..02a6642207 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2801,6 +2801,33 @@ qemuBuildFSDevStr(const virDomainDef *def,
}
+static int
+qemuBuildFSDevCommandLine(virCommandPtr cmd,
+ virDomainFSDefPtr fs,
+ const virDomainDef *def,
+ virQEMUCapsPtr qemuCaps)
+{
+ char *optstr;
+
+ virCommandAddArg(cmd, "-fsdev");
+ if (!(optstr = qemuBuildFSStr(fs)))
+ return -1;
+ virCommandAddArg(cmd, optstr);
+ VIR_FREE(optstr);
+
+ if (qemuCommandAddExtDevice(cmd, &fs->info) < 0)
+ return -1;
+
+ virCommandAddArg(cmd, "-device");
+ if (!(optstr = qemuBuildFSDevStr(def, fs, qemuCaps)))
+ return -1;
+ virCommandAddArg(cmd, optstr);
+ VIR_FREE(optstr);
+
+ return 0;
+}
+
+
static int
qemuBuildFilesystemCommandLine(virCommandPtr cmd,
const virDomainDef *def,
@@ -2809,23 +2836,8 @@ qemuBuildFilesystemCommandLine(virCommandPtr cmd,
size_t i;
for (i = 0; i < def->nfss; i++) {
- char *optstr;
- virDomainFSDefPtr fs = def->fss[i];
-
- virCommandAddArg(cmd, "-fsdev");
- if (!(optstr = qemuBuildFSStr(fs)))
- return -1;
- virCommandAddArg(cmd, optstr);
- VIR_FREE(optstr);
-
- if (qemuCommandAddExtDevice(cmd, &fs->info) < 0)
- return -1;
-
- virCommandAddArg(cmd, "-device");
- if (!(optstr = qemuBuildFSDevStr(def, fs, qemuCaps)))
+ if (qemuBuildFSDevCommandLine(cmd, def->fss[i], def, qemuCaps) < 0)
return -1;
- virCommandAddArg(cmd, optstr);
- VIR_FREE(optstr);
}
return 0;
--
2.19.2