yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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