You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c9575e0
Browse filesBrowse the repository at this point in the historyBrowse files
kvm: remove the partial RBD image when a template copy fails
When qemu-img convert into an RBD pool failed or timed out, the half-written
image was left behind. Every later copy of the same template then failed with
"rbd create: File exists", so deployments from that template broke on the pool
until the image was removed by hand.
- check whether the destination RBD image exists before converting, and refuse
to overwrite it, as it may be a complete image used by clones
- remove the image again if the copy created it and then failed
- do not print the Ceph key in the "Failed to convert" error
if (Arrays.asList(rbd.list()).contains(imageName)) {
1360
+
rbd.remove(imageName);
1361
+
logger.info("Removed the incomplete RBD image {}/{} left by the failed copy", pool.getSourceDir(), imageName);
1362
+
}
1363
+
} finally {
1364
+
r.ioCtxDestroy(io);
1365
+
}
1366
+
} finally {
1367
+
r.shutDown();
1368
+
}
1369
+
} catch (RadosException | RbdExceptione) {
1370
+
logger.warn("Failed to remove the incomplete RBD image {}/{} left by the failed copy, remove it manually: {}", pool.getSourceDir(), imageName, e.getMessage());
1371
+
}
1372
+
}
1373
+
1322
1374
/**
1323
1375
* This function copies a physical disk from Secondary Storage to Primary Storage
1324
1376
* or from Primary to Primary Storage
@@ -1730,12 +1782,21 @@ to support snapshots(backuped) as qcow2 files. */
1730
1782
* To do so it's mandatory that librbd on the system is at least 0.67.7 (Ceph Dumpling)
1731
1783
*/
1732
1784
logger.debug("The source image is not RBD, but the destination is. We will convert into RBD format 2");
0 commit comments