DaanHoogland commented on code in PR #6404:
URL: https://github.com/apache/cloudstack/pull/6404#discussion_r879146913


##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java:
##########
@@ -149,7 +149,11 @@ Use VIR_DOMAIN_XML_SECURE (value = 1) prior to v1.0.0.
 
             final String target = command.getDestinationIp();
             xmlDesc = dm.getXMLDesc(xmlFlag);
-            xmlDesc = replaceIpForVNCInDescFile(xmlDesc, target);
+
+            // Limit the VNC password in case the length is greater than 8 
characters
+            // Since libvirt version 8 VNC passwords are limited to 8 
characters
+            String vncPassword = 
org.apache.commons.lang3.StringUtils.truncate(to.getVncPassword(), 8);
+            xmlDesc = replaceIpForVNCInDescFileAndNormalizePassword(xmlDesc, 
target, vncPassword);

Review Comment:
   separate methos?
   ```suggestion
               /**
                * Limit the VNC password in case the length is greater than 8 
characters
                * Since libvirt version 8 VNC passwords are limited to 8 
characters
                */
               private XmlDescOrSuchAThing getXmlDesc(....) {
                   String vncPassword = 
org.apache.commons.lang3.StringUtils.truncate(to.getVncPassword(), 8);
                   return 
replaceIpForVNCInDescFileAndNormalizePassword(xmlDesc, target, vncPassword);
               }
   ```



-- 
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