sureshanaparti commented on a change in pull request #4525:
URL: https://github.com/apache/cloudstack/pull/4525#discussion_r539240588



##########
File path: 
plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
##########
@@ -1489,24 +1502,33 @@ protected String deleteSnapshotBackup(final Connection 
conn, final Long dcId, fi
         return result;
     }
 
-    public void destroyPatchVbd(final Connection conn, final String vmName) 
throws XmlRpcException, XenAPIException {
-        try {
-            if (!vmName.startsWith("r-") && !vmName.startsWith("s-") && 
!vmName.startsWith("v-")) {
-                return;
-            }
-            final Set<VM> vms = VM.getByNameLabel(conn, vmName);
-            for (final VM vm : vms) {
+    public void destroyPatchVbd(final Connection conn, final Set<VM> vms) 
throws XmlRpcException, XenAPIException {
+        final SR sr = findPatchIsoSR(conn);
+        final VDI patchVDI = findPatchIsoVDI(conn, sr);
+        for (final VM vm : vms) {
+            final String vmName = vm.getNameLabel(conn);
+            try {
+                if (!vmName.startsWith("r-") && !vmName.startsWith("s-") && 
!vmName.startsWith("v-")) {
+                    return;
+                }
                 final Set<VBD> vbds = vm.getVBDs(conn);
                 for (final VBD vbd : vbds) {
-                    if (vbd.getType(conn) == Types.VbdType.CD) {
-                        vbd.eject(conn);
+                    if (Types.VbdType.CD.equals(vbd.getType(conn))) {
+                        if (!vbd.getEmpty(conn)) {
+                            vbd.eject(conn);
+                        }
+                        // Workaround for any file descriptor caching issue
+                        if (patchVDI != null) {
+                            vbd.insert(conn, patchVDI);
+                            vbd.eject(conn);

Review comment:
       > @sureshanaparti @DaanHoogland @vladimirpetrov this confirms that this 
is a XS issue, the fix was to eject and then insert the new systemvm.iso and 
then eject is again 🤦
   
   any specific version of XS?




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

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


Reply via email to