|
|
43fe83 |
From 5ac7b872d91e8cb14fffbadc732b2d214009dd3c Mon Sep 17 00:00:00 2001
|
|
|
43fe83 |
Message-Id: <5ac7b872d91e8cb14fffbadc732b2d214009dd3c.1378475168.git.jdenemar@redhat.com>
|
|
|
43fe83 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
43fe83 |
Date: Wed, 4 Sep 2013 10:30:15 +0200
|
|
|
43fe83 |
Subject: [PATCH] conf: Remove the actual hostdev when removing a network
|
|
|
43fe83 |
|
|
|
43fe83 |
https://bugzilla.redhat.com/show_bug.cgi?id=1003537
|
|
|
43fe83 |
|
|
|
43fe83 |
Commit 50348e6edfa reused the code to remove the hostdev portion of a
|
|
|
43fe83 |
network definition on multiple places but forgot to take into account
|
|
|
43fe83 |
that sometimes the "actual" network is passed and in some cases the
|
|
|
43fe83 |
parent of that.
|
|
|
43fe83 |
|
|
|
43fe83 |
This patch uses the virDomainNetGetActualHostdev() helper to acquire the
|
|
|
43fe83 |
correct pointer all the time while removing the hostdev portion from the
|
|
|
43fe83 |
list.
|
|
|
43fe83 |
|
|
|
43fe83 |
(cherry picked from commit 991270db9969026876c3f5911143dab13ab9050d)
|
|
|
43fe83 |
---
|
|
|
43fe83 |
src/conf/domain_conf.c | 14 +++++++-------
|
|
|
43fe83 |
1 file changed, 7 insertions(+), 7 deletions(-)
|
|
|
43fe83 |
|
|
|
43fe83 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
43fe83 |
index 1a20232..7a80508 100644
|
|
|
43fe83 |
--- a/src/conf/domain_conf.c
|
|
|
43fe83 |
+++ b/src/conf/domain_conf.c
|
|
|
43fe83 |
@@ -9941,14 +9941,14 @@ void
|
|
|
43fe83 |
virDomainNetRemoveHostdev(virDomainDefPtr def,
|
|
|
43fe83 |
virDomainNetDefPtr net)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
- if (net->type == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
|
|
|
43fe83 |
- /* hostdev net devices are normally also be in the hostdevs
|
|
|
43fe83 |
- * array, but might have already been removed by the time we
|
|
|
43fe83 |
- * get here.
|
|
|
43fe83 |
- */
|
|
|
43fe83 |
- virDomainHostdevDefPtr hostdev = &net->data.hostdev.def;
|
|
|
43fe83 |
- size_t i;
|
|
|
43fe83 |
+ /* hostdev net devices are normally also be in the hostdevs
|
|
|
43fe83 |
+ * array, but might have already been removed by the time we
|
|
|
43fe83 |
+ * get here.
|
|
|
43fe83 |
+ */
|
|
|
43fe83 |
+ virDomainHostdevDefPtr hostdev = virDomainNetGetActualHostdev(net);
|
|
|
43fe83 |
+ size_t i;
|
|
|
43fe83 |
|
|
|
43fe83 |
+ if (hostdev) {
|
|
|
43fe83 |
for (i = 0; i < def->nhostdevs; i++) {
|
|
|
43fe83 |
if (def->hostdevs[i] == hostdev) {
|
|
|
43fe83 |
virDomainHostdevRemove(def, i);
|
|
|
43fe83 |
--
|
|
|
43fe83 |
1.8.3.2
|
|
|
43fe83 |
|