[libvirt] [PATCH 07/10] util: Don't require full disk definition when getting imagelabels

Peter Krempa pkrempa at redhat.com
Fri Jun 20 07:52:51 UTC 2014


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.
>> ---
>>  src/conf/domain_conf.c          | 14 --------------
>>  src/conf/domain_conf.h          |  3 ---
>>  src/libvirt_private.syms        |  2 +-
>>  src/qemu/qemu_domain.c          |  2 +-
>>  src/security/security_dac.c     |  4 ++--
>>  src/security/security_selinux.c |  4 ++--
>>  src/util/virstoragefile.c       | 15 +++++++++++++++
>>  src/util/virstoragefile.h       |  4 ++++
>>  8 files changed, 25 insertions(+), 23 deletions(-)
>>
> 
>> +++ 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?

Peter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140620/6f060f0d/attachment-0001.sig>


More information about the libvir-list mailing list