Blame SOURCES/kvm-qdev-monitor-set-DeviceState-opts-before-calling-rea.patch

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