]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: domain: Replace qemuDomainFilePathIsHostCDROM with virFileIsCDROM
authorPeter Krempa <pkrempa@redhat.com>
Mon, 7 May 2018 15:19:27 +0000 (17:19 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 9 May 2018 11:04:33 +0000 (13:04 +0200)
Use the new helper when checking that the VM needs to be tainted as a
host-cdrom passthrough.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
src/qemu/qemu_domain.c

index b13e6d8ca4f5449c169a132da3434c36bf15e8fc..9bb6d8a5be98c0cf08eb23a4486cd823f1e3d911 100644 (file)
@@ -6483,35 +6483,6 @@ qemuDomainDefFormatLive(virQEMUDriverPtr driver,
 }
 
 
-/* qemuDomainFilePathIsHostCDROM
- * @path: Supplied path.
- *
- * Determine if the path is a host CD-ROM path. Typically this is
- * either /dev/cdrom[n] or /dev/srN, so those are easy checks, but
- * it's also possible that @path resolves to /dev/srN, so check for
- * those conditions on @path in order to emit the tainted message.
- *
- * Returns true if the path is a CDROM, false otherwise or on error.
- */
-static bool
-qemuDomainFilePathIsHostCDROM(const char *path)
-{
-    bool ret = false;
-    char *linkpath = NULL;
-
-    if (virFileResolveLink(path, &linkpath) < 0)
-        goto cleanup;
-
-    if (STRPREFIX(path, "/dev/cdrom") || STRPREFIX(path, "/dev/sr") ||
-        STRPREFIX(linkpath, "/dev/sr"))
-        ret = true;
-
- cleanup:
-    VIR_FREE(linkpath);
-    return ret;
-}
-
-
 void qemuDomainObjTaint(virQEMUDriverPtr driver,
                         virDomainObjPtr obj,
                         virDomainTaintFlags taint,
@@ -6630,7 +6601,7 @@ void qemuDomainObjCheckDiskTaint(virQEMUDriverPtr driver,
 
     if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM &&
         virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_BLOCK &&
-        disk->src->path && qemuDomainFilePathIsHostCDROM(disk->src->path))
+        disk->src->path && virFileIsCDROM(disk->src->path) == 1)
         qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_CDROM_PASSTHROUGH,
                            logCtxt);