[libvirt] [PATCH 2/3] storage: remove support for /usr/bin/kvm-img

Cole Robinson crobinso at redhat.com
Fri Apr 15 21:21:27 UTC 2016


This an ubuntu/debian packaging convention. At one point it may have
been an actually different binary, but at least as of ubuntu precise
(the oldest supported ubuntu distro, released april 2012) kvm-img is
just a symlink to qemu-img for back compat.

I think it's safe to drop support for it
---
 src/qemu/qemu_domain.c           |  2 +-
 src/qemu/qemu_driver.c           |  4 +---
 src/storage/storage_backend.c    | 15 +++------------
 src/storage/storage_backend_fs.c |  8 ++------
 src/util/virfile.c               |  2 +-
 tests/virstoragetest.c           |  4 +---
 6 files changed, 9 insertions(+), 26 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ed1e0e5..73187ce 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3072,7 +3072,7 @@ qemuFindQemuImgBinary(virQEMUDriverPtr driver)
 {
     if (!driver->qemuImgBinary)
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("unable to find kvm-img or qemu-img"));
+                       "%s", _("unable to find qemu-img"));
 
     return driver->qemuImgBinary;
 }
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 95612cf..bf05ace 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -718,9 +718,7 @@ qemuStateInitialize(bool privileged,
         goto error;
     }
 
-    qemu_driver->qemuImgBinary = virFindFileInPath("kvm-img");
-    if (!qemu_driver->qemuImgBinary)
-        qemu_driver->qemuImgBinary = virFindFileInPath("qemu-img");
+    qemu_driver->qemuImgBinary = virFindFileInPath("qemu-img");
 
     if (!(qemu_driver->lockManager =
           virLockManagerPluginNew(cfg->lockManagerName ?
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 7cc23d5..e4b9b39 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -153,7 +153,6 @@ static virStorageFileBackendPtr fileBackends[] = {
 
 enum {
     TOOL_QEMU_IMG,
-    TOOL_KVM_IMG,
 };
 
 #define READ_BLOCK_SIZE_DEFAULT  (1024 * 1024)
@@ -1234,14 +1233,10 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
 
     virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, -1);
 
-    /* KVM is usually ahead of qemu on features, so try that first */
-    create_tool = virFindFileInPath("kvm-img");
-    if (!create_tool)
-        create_tool = virFindFileInPath("qemu-img");
-
+    create_tool = virFindFileInPath("qemu-img");
     if (!create_tool) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("unable to find kvm-img or qemu-img"));
+                       "%s", _("unable to find qemu-img"));
         return -1;
     }
 
@@ -1266,7 +1261,6 @@ virStorageBackendBuildVolFrom
 virStorageBackendFSImageToolTypeToFunc(int tool_type)
 {
     switch (tool_type) {
-    case TOOL_KVM_IMG:
     case TOOL_QEMU_IMG:
         return virStorageBackendCreateQemuImg;
     default:
@@ -1284,11 +1278,8 @@ virStorageBackendFindFSImageTool(char **tool)
     int tool_type = -1;
     char *tmp = NULL;
 
-    if ((tmp = virFindFileInPath("kvm-img")) != NULL) {
-        tool_type = TOOL_KVM_IMG;
-    } else if ((tmp = virFindFileInPath("qemu-img")) != NULL) {
+    if ((tmp = virFindFileInPath("qemu-img")) != NULL)
         tool_type = TOOL_QEMU_IMG;
-    }
 
     if (tool)
         *tool = tmp;
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index f55f5e2..47d0f54 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -1343,14 +1343,10 @@ virStorageBackendFilesystemResizeQemuImg(const char *path,
     char *img_tool;
     virCommandPtr cmd = NULL;
 
-    /* KVM is usually ahead of qemu on features, so try that first */
-    img_tool = virFindFileInPath("kvm-img");
-    if (!img_tool)
-        img_tool = virFindFileInPath("qemu-img");
-
+    img_tool = virFindFileInPath("qemu-img");
     if (!img_tool) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("unable to find kvm-img or qemu-img"));
+                       "%s", _("unable to find qemu-img"));
         return -1;
     }
 
diff --git a/src/util/virfile.c b/src/util/virfile.c
index f0412c6..730c08d 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -1580,7 +1580,7 @@ virFileIsLink(const char *linkpath)
 
 /*
  * Finds a requested executable file in the PATH env. e.g.:
- * "kvm-img" will return "/usr/bin/kvm-img"
+ * "qemu-img" will return "/usr/bin/qemu-img"
  *
  * You must free the result
  */
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 38ce09e..698f472 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -137,9 +137,7 @@ testPrepImages(void)
     char *buf = NULL;
     bool compat = false;
 
-    qemuimg = virFindFileInPath("kvm-img");
-    if (!qemuimg)
-        qemuimg = virFindFileInPath("qemu-img");
+    qemuimg = virFindFileInPath("qemu-img");
     if (!qemuimg)
         goto skip;
 
-- 
2.7.3




More information about the libvir-list mailing list