[libvirt] [PATCH] qemu: Fix starting of VMs with empty CDROM drives

Since 24e5cafba6dbc2722e05f92dc0ae31b0f938f9f0 (thankfully unreleased) when a VM with an empty disk drive would be started the code would call stat() on NULL path as a check was missing from the callback rendering machines unstartable. Report success when the path is empty (denoting an empty drive). --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ca0d77f..704ba39 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -343,6 +343,9 @@ qemuSecurityChownCallback(virStorageSourcePtr src, if (virStorageSourceIsLocalStorage(src)) { /* use direct chmod for local files so that the file doesn't * need to be initialized */ + if (!src->path) + return 0; + if (stat(src->path, &sb) >= 0) { if (sb.st_uid == uid && sb.st_gid == gid) { -- 2.0.0

On 07/25/2014 07:19 AM, Peter Krempa wrote:
Since 24e5cafba6dbc2722e05f92dc0ae31b0f938f9f0 (thankfully unreleased) when a VM with an empty disk drive would be started the code would call stat() on NULL path as a check was missing from the callback rendering machines unstartable.
Report success when the path is empty (denoting an empty drive). --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+)
ACK John
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ca0d77f..704ba39 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -343,6 +343,9 @@ qemuSecurityChownCallback(virStorageSourcePtr src, if (virStorageSourceIsLocalStorage(src)) { /* use direct chmod for local files so that the file doesn't * need to be initialized */ + if (!src->path) + return 0; + if (stat(src->path, &sb) >= 0) { if (sb.st_uid == uid && sb.st_gid == gid) {

On 07/25/14 14:31, John Ferlan wrote:
On 07/25/2014 07:19 AM, Peter Krempa wrote:
Since 24e5cafba6dbc2722e05f92dc0ae31b0f938f9f0 (thankfully unreleased) when a VM with an empty disk drive would be started the code would call stat() on NULL path as a check was missing from the callback rendering machines unstartable.
Report success when the path is empty (denoting an empty drive). --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+)
ACK
Pushed; Thanks. And sorry for the mess :) Peter
participants (2)
-
John Ferlan
-
Peter Krempa