You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/02/12 15:52:35 UTC

[GitHub] [cloudstack] weizhouapache commented on a change in pull request #4567: Qemu 2.10 requires `-U` flag to read volume metadata

weizhouapache commented on a change in pull request #4567:
URL: https://github.com/apache/cloudstack/pull/4567#discussion_r575315454



##########
File path: plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/qemu/QemuImg.java
##########
@@ -234,14 +235,19 @@ public void create(final QemuImgFile file, final Map<String, String> options) th
      * @return void
      */
     public void convert(final QemuImgFile srcFile, final QemuImgFile destFile,
-                        final Map<String, String> options, final String snapshotName) throws QemuImgException {
+                        final Map<String, String> options, final String snapshotName) throws QemuImgException, LibvirtException {
         Script script = new Script(_qemuImgPath, timeout);
         if (StringUtils.isNotBlank(snapshotName)) {
             String qemuPath = Script.runSimpleBashScript(getQemuImgPathScript);
             script = new Script(qemuPath, timeout);
         }
 
         script.add("convert");
+        Long version  = LibvirtConnection.getConnection().getVersion();
+        if (version > 2009000) {

Review comment:
       @GutoVeronezi 
   I checked qemu codebase, this is introduced in 2.10.0
   
   so I suggest to use 
   ```
   if (version >= 2010000) {
   ```
   
   qemu 2.9.1 does not support it.

##########
File path: plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/qemu/QemuImg.java
##########
@@ -343,10 +349,15 @@ public void commit(final QemuImgFile file) throws QemuImgException {
      *            A QemuImgFile object containing the file to get the information from
      * @return A HashMap with String key-value information as returned by 'qemu-img info'
      */
-    public Map<String, String> info(final QemuImgFile file) throws QemuImgException {
+    public Map<String, String> info(final QemuImgFile file) throws QemuImgException, LibvirtException {
         final Script s = new Script(_qemuImgPath);
         s.add("info");
+        Long version  = LibvirtConnection.getConnection().getVersion();
+        if (version > 2009000) {

Review comment:
       @GutoVeronezi same here.




----------------------------------------------------------------
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:
users@infra.apache.org