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

Eric Blake eblake at redhat.com
Thu Jun 19 20:01:58 UTC 2014


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.

ACK. This one can be reshuffled to go in earlier, if desired.

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

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


More information about the libvir-list mailing list