CS-14618: Fix null network device name

The bug is introduced by:

    commit 708472e1ef
    Author: Edison Su <sudison@gmail.com>
    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.
This commit is contained in:
Sheng Yang 2012-04-24 16:13:12 -07:00
parent 319d4c5cfd
commit 154c7d385f
1 changed files with 6 additions and 2 deletions

View File

@ -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));
}
}
}