[libvirt] [PATCH 2/6] storage: fs: Fill in permissions on pool refresh

Cole Robinson crobinso at redhat.com
Wed Apr 29 01:39:43 UTC 2015


On 04/28/2015 08:06 AM, Peter Krempa wrote:
> On Mon, Apr 27, 2015 at 16:48:40 -0400, Cole Robinson wrote:
>> This means pool XML actually reports accurate user/group/mode/label.
>>
>> This uses UpdateVolTargetInfoFD in a bit of a hackish way, but it works
>> ---
>>  src/storage/storage_backend_fs.c | 58 ++++++++++++++++++++++++++++++----------
>>  1 file changed, 44 insertions(+), 14 deletions(-)
>>
>> diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
>> index 51d6bb3..804b7c3 100644
>> --- a/src/storage/storage_backend_fs.c
> 
> ...
> 
>> +    pool->def->target.perms.mode = target->perms->mode;
>> +    pool->def->target.perms.uid = target->perms->uid;
>> +    pool->def->target.perms.gid = target->perms->gid;
>> +    VIR_FREE(pool->def->target.perms.label);
>> +    if (VIR_STRDUP(pool->def->target.perms.label, target->perms->label) < 0)
>> +        goto error;
>>  
>> +    ret = 0;
>>   error:
> 
> Since both success and error paths use this label now, it should be
> called 'cleanup';
> 
>>      if (dir)
>>          closedir(dir);
>> +    VIR_FORCE_CLOSE(fd);
>>      virStorageVolDefFree(vol);
>> -    virStoragePoolObjClearVols(pool);
>> -    return -1;
>> +    virStorageSourceFree(target);
>> +    if (ret < 0)
>> +        virStoragePoolObjClearVols(pool);
>> +    return ret;
>>  }
> 
> ACK with the label renamed.
> 
> Peter
> 

Thanks, applied that change locally. Will push after the release is out

- Cole




More information about the libvir-list mailing list