From 06c77533c61f65886bf0a9236d8f13085b2f3e51 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Thu, 25 Feb 2021 23:14:40 -0500 Subject: [PATCH 43/54] failover: make sure that id always exist RH-Author: Laurent Vivier Message-id: <20210225231447.2187738-21-lvivier@redhat.com> Patchwork-id: 101257 O-Subject: [RHEL-AV-8.4.0 qemu-kvm PATCH v2 20/27] failover: make sure that id always exist Bugzilla: 1819991 RH-Acked-by: Juan Quintela RH-Acked-by: Dr. David Alan Gilbert RH-Acked-by: Jens Freimann RH-Acked-by: Michael S. Tsirkin From: Juan Quintela BZ: https://bugzilla.redhat.com/1819991 BRANCH: rhel-av-8.4.0 UPSTREAM: Merged We check that it exist at device creation time, so we don't have to check anywhere else. Signed-off-by: Juan Quintela Message-Id: <20201118083748.1328-22-quintela@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit fec037c1e2da0a7ea54eabce65cc14d461fdc5eb) Signed-off-by: Laurent Vivier Signed-off-by: Danilo C. L. de Paula --- hw/net/virtio-net.c | 3 --- softmmu/qdev-monitor.c | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index ff82f1017d..c708c03cf6 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3173,9 +3173,6 @@ static bool failover_hide_primary_device(DeviceListener *listener, hide = qatomic_read(&n->failover_primary_hidden); g_free(n->primary_device_id); n->primary_device_id = g_strdup(device_opts->id); - if (!n->primary_device_id) { - warn_report("primary_device_id not set"); - } return hide; } diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 0e10f0466f..301089eaea 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -613,6 +613,10 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp) } if (qemu_opt_get(opts, "failover_pair_id")) { + if (!opts->id) { + error_setg(errp, "Device with failover_pair_id don't have id"); + return NULL; + } if (qdev_should_hide_device(opts)) { if (bus && !qbus_is_hotpluggable(bus)) { error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name); -- 2.27.0