Pearl1594 commented on code in PR #14803:
URL: https://github.com/apache/cloudstack/pull/14803#discussion_r4673274375


##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java:
##########
@@ -695,6 +703,71 @@ protected String replaceDpdkInterfaces(String xmlDesc, 
Map<String, DpdkTO> dpdkP
         return LibvirtXMLParser.getXml(doc);
     }
 
+    // Trunk nics always need it; ordinary nics only when the zone opted in to 
the shared VLAN-aware bridge
+    // A VLAN nic cut off by a failed post-migration is link-down in the 
source XML, which migration carries to the destination. Where the
+    // destination applies no VLAN membership by hand (libvirt does it from 
the XML, or it has dedicated per-VLAN bridges) nothing would ever bring
+    // the link back, so an enabled nic arrives up. Where the post-migration 
command will run it must stay down until that has applied the VLANs,
+    // so the nic is not exposed on VLAN 1 meanwhile. Other nics are left as 
they are.
+    protected String restoreCutOffNicLinks(String xmlDesc, MigrateCommand 
command, String vmName)
+            throws ParserConfigurationException, IOException, SAXException, 
TransformerException {
+        NicTO[] nics = command.getVirtualMachine().getNics();
+        if (!destinationAppliesNoManualVlanMembership(command) || 
!LINK_DOWN_ELEMENT.matcher(xmlDesc).find() || nics == null
+                || Arrays.stream(nics).noneMatch(this::isEnabledVlanNic)) {

Review Comment:
   not required.



##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtPlugNicCommandWrapper.java:
##########
@@ -100,6 +105,10 @@ public Answer execute(final PlugNicCommand command, final 
LibvirtComputingResour
                     throw new InternalErrorException("Failed to locate live 
tap for trunk nic " + nic.getMac() + ": " + e.getMessage());
                 }
             }
+            if (linkDownUntilVlansApplied) {
+                interfaceDef.setLinkStateUp(nic.isEnabled());
+                vm.updateDeviceFlags(interfaceDef.toString(), 
Domain.DeviceModifyFlags.LIVE);

Review Comment:
   not required.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to