cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] GabrielBrascher commented on a change in pull request #2259: CLOUDSTACK-10024: Network migration support
Date Thu, 01 Jan 1970 00:00:00 GMT
GabrielBrascher commented on a change in pull request #2259: CLOUDSTACK-10024: Network migration
support
URL: https://github.com/apache/cloudstack/pull/2259#discussion_r146401454
 
 

 ##########
 File path: engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
 ##########
 @@ -3636,6 +3639,36 @@ private void orchestrateMigrateForScale(final String vmUuid, final
long srcHostI
         }
     }
 
+    @Override
+    public boolean replugNic(final Network network, final NicTO nic, final VirtualMachineTO
vm, final ReservationContext context, final DeployDestination dest) throws ConcurrentOperationException,
+            ResourceUnavailableException, InsufficientCapacityException {
+        boolean result = true;
+
+        final VMInstanceVO router = _vmDao.findById(vm.getId());
+        if (router.getState() == State.Running) {
+            try {
+                final ReplugNicCommand replugNicCmd = new ReplugNicCommand(nic, vm.getName(),
vm.getType(), vm.getDetails());
+                final Commands cmds = new Commands(Command.OnError.Stop);
+                cmds.addCommand("replugnic", replugNicCmd);
+                _agentMgr.send(dest.getHost().getId(), cmds);
+                final ReplugNicAnswer replugNicAnswer = cmds.getAnswer(ReplugNicAnswer.class);
+                if (!(replugNicAnswer != null && replugNicAnswer.getResult())) {
 
 Review comment:
   What do you think about changing `(!(replugNicAnswer != null && replugNicAnswer.getResult()))`
to `(replugNicAnswer == null && replugNicAnswer.getResult() == false)`? It is simpler
IMHO. Additionally, I am wondering why `result` will not be false when `replugNicAnswer.getResult()
= false`; `replugNicAnswer != null` is sufficient to let `result = true`?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message