From 154c7d385faed72f66d4e12f2f1668ae2f0609cd Mon Sep 17 00:00:00 2001 From: Sheng Yang Date: Tue, 24 Apr 2012 16:13:12 -0700 Subject: [PATCH] CS-14618: Fix null network device name The bug is introduced by: commit 708472e1ef933e5f38abc1311a38fa6113739d59 Author: Edison Su Date: Tue Mar 20 16:49:47 2012 -0700 bug 14322: support multiple physical nic in kvm status 14322: resolved fixed The above commit cover the case of creating vif without a nic name, but didn't cover the migration case. --- .../resource/computing/LibvirtComputingResource.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java index 56fbdc56d19..0f6aa78d9d6 100755 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java +++ b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java @@ -2056,6 +2056,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements Connect conn = LibvirtConnection.getConnection(); for (NicTO nic : nics) { String vlanId = null; + String nicName = _privBridgeName; + if (nic.getName() != null) { + nicName = nic.getName(); + } if (nic.getBroadcastType() == BroadcastDomainType.Vlan) { URI broadcastUri = nic.getBroadcastUri(); vlanId = broadcastUri.getHost(); @@ -2063,7 +2067,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements if (nic.getType() == TrafficType.Guest) { if (nic.getBroadcastType() == BroadcastDomainType.Vlan && !vlanId.equalsIgnoreCase("untagged")) { - createVlanBr(vlanId, getPhysicalNetwork(nic.getName())); + createVlanBr(vlanId, getPhysicalNetwork(nicName)); } } else if (nic.getType() == TrafficType.Control) { /* Make sure the network is still there */ @@ -2071,7 +2075,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements } else if (nic.getType() == TrafficType.Public) { if (nic.getBroadcastType() == BroadcastDomainType.Vlan && !vlanId.equalsIgnoreCase("untagged")) { - createVlanBr(vlanId, getPhysicalNetwork(nic.getName())); + createVlanBr(vlanId, getPhysicalNetwork(nicName)); } } }