|
|
7711c0 |
From 8278c1cf3ba3ad55f42ab690a83de66a76ec9316 Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
7711c0 |
Date: Fri, 17 May 2019 06:51:12 +0200
|
|
|
7711c0 |
Subject: [PATCH 45/53] vl: Factor configure_blockdev() out of main()
|
|
|
7711c0 |
MIME-Version: 1.0
|
|
|
7711c0 |
Content-Type: text/plain; charset=UTF-8
|
|
|
7711c0 |
Content-Transfer-Encoding: 8bit
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: Markus Armbruster <armbru@redhat.com>
|
|
|
7711c0 |
Message-id: <20190517065120.12028-24-armbru@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 88008
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH v3 23/31] vl: Factor configure_blockdev() out of main()
|
|
|
7711c0 |
Bugzilla: 1624009
|
|
|
7711c0 |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
7711c0 |
Message-Id: <20190308131445.17502-7-armbru@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
7711c0 |
(cherry picked from commit d11bf9bf0fd66057aa5e8acb1bbc797419d5a4e6)
|
|
|
7711c0 |
[Conflict in vl.c due to lack of commit c4f26c9f37c and 7c89fcbac86]
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
vl.c | 72 +++++++++++++++++++++++++++++++++++++++-----------------------------
|
|
|
7711c0 |
1 file changed, 41 insertions(+), 31 deletions(-)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/vl.c b/vl.c
|
|
|
7711c0 |
index a5c17a0..e0e60fb 100644
|
|
|
7711c0 |
--- a/vl.c
|
|
|
7711c0 |
+++ b/vl.c
|
|
|
7711c0 |
@@ -1279,6 +1279,46 @@ typedef struct BlockdevOptionsQueueEntry {
|
|
|
7711c0 |
|
|
|
7711c0 |
typedef QSIMPLEQ_HEAD(, BlockdevOptionsQueueEntry) BlockdevOptionsQueue;
|
|
|
7711c0 |
|
|
|
7711c0 |
+static void configure_blockdev(BlockdevOptionsQueue *bdo_queue,
|
|
|
7711c0 |
+ MachineClass *machine_class, int snapshot)
|
|
|
7711c0 |
+{
|
|
|
7711c0 |
+ /*
|
|
|
7711c0 |
+ * If the currently selected machine wishes to override the
|
|
|
7711c0 |
+ * units-per-bus property of its default HBA interface type, do so
|
|
|
7711c0 |
+ * now.
|
|
|
7711c0 |
+ */
|
|
|
7711c0 |
+ if (machine_class->units_per_default_bus) {
|
|
|
7711c0 |
+ override_max_devs(machine_class->block_default_type,
|
|
|
7711c0 |
+ machine_class->units_per_default_bus);
|
|
|
7711c0 |
+ }
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ /* open the virtual block devices */
|
|
|
7711c0 |
+ while (!QSIMPLEQ_EMPTY(bdo_queue)) {
|
|
|
7711c0 |
+ BlockdevOptionsQueueEntry *bdo = QSIMPLEQ_FIRST(bdo_queue);
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ QSIMPLEQ_REMOVE_HEAD(bdo_queue, entry);
|
|
|
7711c0 |
+ loc_push_restore(&bdo->loc);
|
|
|
7711c0 |
+ qmp_blockdev_add(bdo->bdo, &error_fatal);
|
|
|
7711c0 |
+ loc_pop(&bdo->loc);
|
|
|
7711c0 |
+ qapi_free_BlockdevOptions(bdo->bdo);
|
|
|
7711c0 |
+ g_free(bdo);
|
|
|
7711c0 |
+ }
|
|
|
7711c0 |
+ if (snapshot || replay_mode != REPLAY_MODE_NONE) {
|
|
|
7711c0 |
+ qemu_opts_foreach(qemu_find_opts("drive"), drive_enable_snapshot,
|
|
|
7711c0 |
+ NULL, NULL);
|
|
|
7711c0 |
+ }
|
|
|
7711c0 |
+ if (qemu_opts_foreach(qemu_find_opts("drive"), drive_init_func,
|
|
|
7711c0 |
+ &machine_class->block_default_type, NULL)) {
|
|
|
7711c0 |
+ exit(1);
|
|
|
7711c0 |
+ }
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ default_drive(default_cdrom, snapshot, machine_class->block_default_type, 2,
|
|
|
7711c0 |
+ CDROM_OPTS);
|
|
|
7711c0 |
+ default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS);
|
|
|
7711c0 |
+ default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS);
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+}
|
|
|
7711c0 |
+
|
|
|
7711c0 |
static QemuOptsList qemu_smp_opts = {
|
|
|
7711c0 |
.name = "smp-opts",
|
|
|
7711c0 |
.implied_opt_name = "cpus",
|
|
|
7711c0 |
@@ -4550,37 +4590,7 @@ int main(int argc, char **argv, char **envp)
|
|
|
7711c0 |
ram_mig_init();
|
|
|
7711c0 |
dirty_bitmap_mig_init();
|
|
|
7711c0 |
|
|
|
7711c0 |
- /* If the currently selected machine wishes to override the units-per-bus
|
|
|
7711c0 |
- * property of its default HBA interface type, do so now. */
|
|
|
7711c0 |
- if (machine_class->units_per_default_bus) {
|
|
|
7711c0 |
- override_max_devs(machine_class->block_default_type,
|
|
|
7711c0 |
- machine_class->units_per_default_bus);
|
|
|
7711c0 |
- }
|
|
|
7711c0 |
-
|
|
|
7711c0 |
- /* open the virtual block devices */
|
|
|
7711c0 |
- while (!QSIMPLEQ_EMPTY(&bdo_queue)) {
|
|
|
7711c0 |
- BlockdevOptionsQueueEntry *bdo = QSIMPLEQ_FIRST(&bdo_queue);
|
|
|
7711c0 |
-
|
|
|
7711c0 |
- QSIMPLEQ_REMOVE_HEAD(&bdo_queue, entry);
|
|
|
7711c0 |
- loc_push_restore(&bdo->loc);
|
|
|
7711c0 |
- qmp_blockdev_add(bdo->bdo, &error_fatal);
|
|
|
7711c0 |
- loc_pop(&bdo->loc);
|
|
|
7711c0 |
- qapi_free_BlockdevOptions(bdo->bdo);
|
|
|
7711c0 |
- g_free(bdo);
|
|
|
7711c0 |
- }
|
|
|
7711c0 |
- if (snapshot || replay_mode != REPLAY_MODE_NONE) {
|
|
|
7711c0 |
- qemu_opts_foreach(qemu_find_opts("drive"), drive_enable_snapshot,
|
|
|
7711c0 |
- NULL, NULL);
|
|
|
7711c0 |
- }
|
|
|
7711c0 |
- if (qemu_opts_foreach(qemu_find_opts("drive"), drive_init_func,
|
|
|
7711c0 |
- &machine_class->block_default_type, NULL)) {
|
|
|
7711c0 |
- exit(1);
|
|
|
7711c0 |
- }
|
|
|
7711c0 |
-
|
|
|
7711c0 |
- default_drive(default_cdrom, snapshot, machine_class->block_default_type, 2,
|
|
|
7711c0 |
- CDROM_OPTS);
|
|
|
7711c0 |
- default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS);
|
|
|
7711c0 |
- default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS);
|
|
|
7711c0 |
+ configure_blockdev(&bdo_queue, machine_class, snapshot);
|
|
|
7711c0 |
|
|
|
7711c0 |
if (qemu_opts_foreach(qemu_find_opts("mon"),
|
|
|
7711c0 |
mon_init_func, NULL, NULL)) {
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|