[libvirt] [PATCH] util:report diskchain as broken if without enough permission

2013-08-20 Thread Guannan Ren
When backing files of a disk file are stored in NFS shared folder,
qemu process requires at least the read permission.
But in some rare situation, these backing files can not even be read
If so, we should treat the diskchains as broken.
This patch add a checking for this, report negative in such case.
---
 src/util/virstoragefile.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 0b9cec3..3dee7ab 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1127,7 +1127,11 @@ virStorageFileChainGetBroken(virStorageFileMetadataPtr 
chain,
 /* Break if no backing store or backing store is not file */
if (!tmp-backingStoreRaw)
break;
-   if (!tmp-backingStore) {
+
+   if (tmp-backingStoreIsFile) {
+   if (!tmp-backingMeta)
+   goto error;
+   } else if (!tmp-backingStore) {
if (VIR_STRDUP(*brokenFile, tmp-backingStoreRaw)  0)
goto error;
break;
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] util:report diskchain as broken if without enough permission

2013-08-20 Thread Eric Blake
On 08/20/2013 01:54 AM, Guannan Ren wrote:
 When backing files of a disk file are stored in NFS shared folder,
 qemu process requires at least the read permission.
 But in some rare situation, these backing files can not even be read
 If so, we should treat the diskchains as broken.
 This patch add a checking for this, report negative in such case.

We have been historically bitten by changes to this code.  I think we
need to patch tests/virstoragetest.c (and/or add a new test) before
accepting this change, to make sure that we are testing the behavior we
want.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] util:report diskchain as broken if without enough permission

2013-08-20 Thread Guannan Ren

On 08/21/2013 03:57 AM, Eric Blake wrote:

On 08/20/2013 01:54 AM, Guannan Ren wrote:

When backing files of a disk file are stored in NFS shared folder,
qemu process requires at least the read permission.
But in some rare situation, these backing files can not even be read
If so, we should treat the diskchains as broken.
This patch add a checking for this, report negative in such case.

We have been historically bitten by changes to this code.  I think we
need to patch tests/virstoragetest.c (and/or add a new test) before
accepting this change, to make sure that we are testing the behavior we
want.


Okay, will do it soon.
Thanks

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list