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


##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java:
##########
@@ -702,6 +711,81 @@ private String 
getNewVolumePathIfDatastoreHasChanged(LibvirtComputingResource li
         return newIsoVolumePath;
     }
 
+    private String getOldVolumePathForCdrom(List<DiskDef> disks, String 
vmName) {
+        String oldIsoVolumePath = null;
+        for (DiskDef disk : disks) {
+            if (DiskDef.DeviceType.CDROM.equals(disk.getDeviceType())
+                    && CDROM_LABEL.equals(disk.getDiskLabel())
+                    && disk.getDiskPath() != null) {
+                oldIsoVolumePath = disk.getDiskPath();
+                break;
+            }
+        }
+        return oldIsoVolumePath;
+    }
+
+    private String getNewVolumePathForCdrom(LibvirtComputingResource 
libvirtComputingResource, Connect conn, VirtualMachineTO to) throws 
LibvirtException, URISyntaxException {
+        DiskTO newDisk = null;
+        for (DiskTO disk : to.getDisks()) {
+            DataTO data = disk.getData();
+            if (disk.getDiskSeq() == 3 && data != null && data.getPath() != 
null) {
+                newDisk = disk;
+                break;
+            }
+        }
+
+        String newIsoVolumePath = null;
+        if (newDisk != null) {
+            newIsoVolumePath = libvirtComputingResource.getVolumePath(conn, 
newDisk);
+        }
+        return newIsoVolumePath;
+    }
+
+    protected String replaceCdromIsoPath(String xmlDesc, String vmName, String 
oldIsoVolumePath, String newIsoVolumePath) throws IOException, 
ParserConfigurationException, TransformerException, SAXException {

Review Comment:
   wow, I hope we never have to change this method ever again... the complexity 
of it is a bit much but the code looks good.



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