CLOUDSTACK-10377: Fix Network restart for Nuage#2672
Conversation
yadvr
left a comment
There was a problem hiding this comment.
LGTM, we cannot test nuage related code but I'll help kick trillian test.
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2085 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-2710)
|
| ReserveVmInterfaceVspCommand cmd = new ReserveVmInterfaceVspCommand(vspNetwork, vspVm, vspNic, vspStaticNat, dhcpOption); | ||
| Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd); | ||
|
|
||
| if (answer == null || !answer.getResult()) { |
There was a problem hiding this comment.
You can use BooleanUtils here.
There was a problem hiding this comment.
The null check is on answer, not on answer.getResult().
| 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))) { |
There was a problem hiding this comment.
Would you mind extracting these blocks of code to specific methods and unit testing them? Some documentation might help as well.
This is a comment to for this PR only: We really need to change our mind set and start using smaller, concise, well-documented and unit-tested methods. This in turn can greatly improve our productivity.
| 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))) { |
There was a problem hiding this comment.
You can use BooleanUtils to evaluate vm.getParameter(VirtualMachineProfile.Param.RollingRestart))
There was a problem hiding this comment.
Then I would have to cast, as vm.getParameter() returns Object
| super.deallocate(network, nic, vm); | ||
| } | ||
|
|
||
| if (virtualMachine.getType() == VirtualMachine.Type.DomainRouter) { |
There was a problem hiding this comment.
Can you extract this blob to a method?
There was a problem hiding this comment.
Do we really want to go into creating methods for checking enum values?
I'm not in favor of creating that kind of method in this class,
so it should go either in VirtualMachine or in VirtualMachine.Type
There was a problem hiding this comment.
I am pretty sure @rafaelweingartner means the entire if block and not the enum check, @fmaximus
There was a problem hiding this comment.
Spot on. I was referring to the IF body, and not to the IF condition. We really need shorter methods and more unit tests.
|
@fmaximus can you address outstanding review comments? |
Address review comments
|
While one comment around refactoring code to a different method is outstanding, @fmaximus can you comment? I'm okay to merge this in order to unblock for RC2. /cc @PaulAngus @DaanHoogland |
|
Still was running some tests on the refactoring. |
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
ok by me @rhtyd should it be packaged and smoke tested again? I saw you started that |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2088 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
We found some issues with the fix, we're looking into it. |
|
Trillian test result (tid-2719)
|
|
Test LGTM, let us know (soon) @fmaximus when you're good with your PR(s). Also, please use Github to log issues, thanks. |
|
It's good! |
|
@PaulAngus I did a walk through and am fine to merge this one, ok? |
|
LGTM, based on code reviews and results I'm okay to merge this as well |
Description
Changes in PR #2508 have caused network restart to fail in a Nuage setup,
as the new VR takes the same IP as the old one, and the old VR is still running.
Nuage doesn't support multiple VM's having the same IP.
We delay provisioning the interfaces in VSD until the old VR interface is released.
Types of changes
Screenshots (if appropriate):
How Has This Been Tested?
Checklist:
Testing