fmaximus commented on a change in pull request #2672: CLOUDSTACK-10377: Fix
Network restart for Nuage
URL: https://github.com/apache/cloudstack/pull/2672#discussion_r191499663
##########
File path:
plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
##########
@@ -528,29 +533,35 @@ public void reserve(NicProfile nic, Network network,
VirtualMachineProfile vm, D
nic.setBroadcastUri(network.getBroadcastUri());
nic.setIsolationUri(network.getBroadcastUri());
- //NicProfile does not contain the NIC UUID. We need this
information to set it in the VMInterface and VPort
- //that we create in VSP
- NicVO nicFromDb = _nicDao.findById(nic.getId());
- IPAddressVO staticNatIp =
_ipAddressDao.findByVmIdAndNetworkId(network.getId(), vm.getId());
VspVm vspVm =
_nuageVspEntityBuilder.buildVspVm(vm.getVirtualMachine(), network);
- VspNic vspNic =
_nuageVspEntityBuilder.buildVspNic(nicFromDb.getUuid(), nic);
- VspStaticNat vspStaticNat = null;
- if (staticNatIp != null) {
- VlanVO staticNatVlan =
_vlanDao.findById(staticNatIp.getVlanId());
- vspStaticNat = _nuageVspEntityBuilder.buildVspStaticNat(null,
staticNatIp, staticNatVlan, vspNic);
- }
- boolean defaultHasDns = getDefaultHasDns(networkHasDnsCache,
nicFromDb);
- VspDhcpVMOption dhcpOption =
_nuageVspEntityBuilder.buildVmDhcpOption(nicFromDb, defaultHasDns,
networkHasDns);
- ReserveVmInterfaceVspCommand cmd = new
ReserveVmInterfaceVspCommand(vspNetwork, vspVm, vspNic, vspStaticNat,
dhcpOption);
- Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
+ if
(!Boolean.TRUE.equals(vm.getParameter(VirtualMachineProfile.Param.RollingRestart)))
{
+
+ //NicProfile does not contain the NIC UUID. We need this
information to set it in the VMInterface and VPort
+ //that we create in VSP
+ NicVO nicFromDb = _nicDao.findById(nic.getId());
+ IPAddressVO staticNatIp =
_ipAddressDao.findByVmIdAndNetworkId(network.getId(), vm.getId());
+ VspNic vspNic =
_nuageVspEntityBuilder.buildVspNic(nicFromDb.getUuid(), nic);
+ VspStaticNat vspStaticNat = null;
+ if (staticNatIp != null) {
+ VlanVO staticNatVlan =
_vlanDao.findById(staticNatIp.getVlanId());
+ vspStaticNat =
_nuageVspEntityBuilder.buildVspStaticNat(null, staticNatIp, staticNatVlan,
vspNic);
+ }
- if (answer == null || !answer.getResult()) {
- s_logger.error("ReserveVmInterfaceNuageVspCommand failed for
NIC " + nic.getId() + " attached to VM " + vm.getId() + " in network " +
network.getId());
- if ((null != answer) && (null != answer.getDetails())) {
- s_logger.error(answer.getDetails());
+ boolean defaultHasDns = getDefaultHasDns(networkHasDnsCache,
nicFromDb);
+ VspDhcpVMOption dhcpOption =
_nuageVspEntityBuilder.buildVmDhcpOption(nicFromDb, defaultHasDns,
networkHasDns);
+ ReserveVmInterfaceVspCommand cmd = new
ReserveVmInterfaceVspCommand(vspNetwork, vspVm, vspNic, vspStaticNat,
dhcpOption);
+ Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
+
+ if (answer == null || !answer.getResult()) {
Review comment:
The null check is on answer, not on answer.getResult().
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services