On 06/20/2014 01:52 AM, Peter Krempa wrote:
On 06/19/14 22:01, Eric Blake wrote:
> On 06/19/2014 07:46 AM, Peter Krempa wrote:
>> The image labels are stored in the virStorageSource struct. Convert the
>> virDomainDiskDefGetSecurityLabelDef helper not to use the full disk def
>> and move it appropriately.
>> ---
>> +++ b/src/qemu/qemu_domain.c
>> @@ -2413,7 +2413,7 @@ qemuDomainGetImageIds(virQEMUDriverConfigPtr cfg,
>> vmlabel->label)
>> virParseOwnershipIds(vmlabel->label, uid, gid);
>>
>> - if ((disklabel = virDomainDiskDefGetSecurityLabelDef(disk, "dac"))
&&
>> + if ((disklabel = virStorageSourceGetSecurityLabelDef(disk->src,
"dac")) &&
>
> Unrelated to your patch, but why is this an open-coded string...
>
>> disklabel->label)
>> virParseOwnershipIds(disklabel->label, uid, gid);
>> }
>> diff --git a/src/security/security_dac.c b/src/security/security_dac.c
>> index 9d5c25b..28f033d 100644
>> --- a/src/security/security_dac.c
>> +++ b/src/security/security_dac.c
>> @@ -302,7 +302,7 @@ virSecurityDACSetSecurityFileLabel(virDomainDiskDefPtr disk,
>> uid_t user;
>> gid_t group;
>>
>> - disk_seclabel = virDomainDiskDefGetSecurityLabelDef(disk,
>> + disk_seclabel = virStorageSourceGetSecurityLabelDef(disk->src,
>> SECURITY_DAC_NAME);
>
> ...while this is SECURITY_DAC_NAME? Might be worth an independent cleanup.
SECURITY_DAC_NAME is defined in src/security/security_dac.c and thus not
available to use in the qemu_domain code.
Should we export it in the header of the security driver?
Yeah, if other code is going to do actions based on driver names, then
it's probably worth putting the macros for the driver names in a common
header rather than buried in a .c file.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org