[libvirt] [PATCH 1/3] Remove chardev port calculation from DomainDefParse

Ján Tomko jtomko at redhat.com
Thu May 15 15:50:42 UTC 2014


It's already in DeviceDefPostParse, the only difference is
that the removed code only looked at ports of devices
before the current one, the new code looks at all of them.
---
 src/conf/domain_conf.c | 33 ---------------------------------
 1 file changed, 33 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6c3bdad..46294fa 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12355,15 +12355,6 @@ virDomainDefParseXML(xmlDocPtr xml,
         if (!chr)
             goto error;
 
-        if (chr->target.port == -1) {
-            int maxport = -1;
-            size_t j;
-            for (j = 0; j < i; j++) {
-                if (def->parallels[j]->target.port > maxport)
-                    maxport = def->parallels[j]->target.port;
-            }
-            chr->target.port = maxport + 1;
-        }
         def->parallels[def->nparallels++] = chr;
     }
     VIR_FREE(nodes);
@@ -12383,15 +12374,6 @@ virDomainDefParseXML(xmlDocPtr xml,
         if (!chr)
             goto error;
 
-        if (chr->target.port == -1) {
-            int maxport = -1;
-            size_t j;
-            for (j = 0; j < i; j++) {
-                if (def->serials[j]->target.port > maxport)
-                    maxport = def->serials[j]->target.port;
-            }
-            chr->target.port = maxport + 1;
-        }
         def->serials[def->nserials++] = chr;
     }
     VIR_FREE(nodes);
@@ -12439,21 +12421,6 @@ virDomainDefParseXML(xmlDocPtr xml,
             chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO &&
             chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
             chr->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL;
-
-        if (chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL &&
-            chr->info.addr.vioserial.port == 0) {
-            int maxport = 0;
-            size_t j;
-            for (j = 0; j < i; j++) {
-                virDomainChrDefPtr thischr = def->channels[j];
-                if (thischr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL &&
-                    thischr->info.addr.vioserial.controller == chr->info.addr.vioserial.controller &&
-                    thischr->info.addr.vioserial.bus == chr->info.addr.vioserial.bus &&
-                    (int)thischr->info.addr.vioserial.port > maxport)
-                    maxport = thischr->info.addr.vioserial.port;
-            }
-            chr->info.addr.vioserial.port = maxport + 1;
-        }
     }
     VIR_FREE(nodes);
 
-- 
1.8.3.2




More information about the libvir-list mailing list