From 0bc5bd314b821409555ed0c0b281733a8c66d39d Mon Sep 17 00:00:00 2001 From: Bandan Das Date: Thu, 27 Feb 2014 18:31:16 +0100 Subject: [PATCH 4/6] qdev-monitor: set DeviceState opts before calling realize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RH-Author: Bandan Das Message-id: <1393525877-32262-2-git-send-email-bsd@redhat.com> Patchwork-id: 57932 O-Subject: [PATCH RHEL-7.0 qemu-kvm v2 1/2] qdev-monitor: set DeviceState opts before calling realize Bugzilla: 1037956 RH-Acked-by: Alex Williamson RH-Acked-by: Michael S. Tsirkin RH-Acked-by: Marcel Apfelbaum Setting opts before the realize property is set allows the following patch to make decisions based on whether the user specified "rombar". This also avoids having to create a new tristate property especially for this purpose Reviewed-by: Andreas Färber Signed-off-by: Bandan Das Signed-off-by: Alex Williamson (cherry picked from commit 52aa17cbd800b9e71b67cf7f80c3498183d34ec8) --- qdev-monitor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Signed-off-by: Miroslav Rezanina --- qdev-monitor.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/qdev-monitor.c b/qdev-monitor.c index ac65a10..d7b9f04 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -548,16 +548,18 @@ DeviceState *qdev_device_add(QemuOpts *opts) OBJECT(dev), NULL); g_free(name); } + + dev->opts = opts; object_property_set_bool(OBJECT(dev), true, "realized", &err); if (err != NULL) { qerror_report_err(err); error_free(err); + dev->opts = NULL; object_unparent(OBJECT(dev)); object_unref(OBJECT(dev)); qerror_report(QERR_DEVICE_INIT_FAILED, driver); return NULL; } - dev->opts = opts; return dev; } -- 1.7.1