[libvirt] [PATCH 4/4] virt-aa-helper: generate rules for nvdimm memory
Jamie Strandboge
jamie at canonical.com
Tue Mar 20 21:02:12 UTC 2018
On Tue, 2018-03-20 at 13:08 +0100, Christian Ehrhardt wrote:
> nvdimm memory is backed by a path on the host. This currently works
> only via
> hotplug where the AppArmor label is created via the domain label
> callbacks.
>
> This adds the virt-aa-helper support for nvdimm memory devices to
> generate
> rules for the needed paths from the initial guest definition as well.
>
> Example in domain xml:
> <memory model='nvdimm'>
> <source>
> <path>/tmp/nvdimm-base</path>
> </source>
> <target>
> <size unit='KiB'>524288</size>
> <node>0</node>
> </target>
> </memory>
> Works to start now and creates:
> "/tmp/nvdimm-base" rw,
>
> Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1757085
>
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt at canonical.com>
> ---
> src/security/virt-aa-helper.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-
> helper.c
> index 1fc482d..0d0db0b 100644
> --- a/src/security/virt-aa-helper.c
> +++ b/src/security/virt-aa-helper.c
> @@ -1176,6 +1176,13 @@ get_files(vahControl * ctl)
> }
> }
>
> + for (i = 0; i < ctl->def->nmems; i++) {
> + if (ctl->def->mems[i]->model ==
> VIR_DOMAIN_MEMORY_MODEL_NVDIMM) {
'if (ctl->def->mems[i] && ctl->def->mems[i]->model ==
VIR_DOMAIN_MEMORY_MODEL_NVDIMM)', no?
> + if (vah_add_file(&buf, ctl->def->mems[i]->nvdimmPath,
> "rw") != 0)
> + goto cleanup;
> + }
> + }
> +
> if (ctl->def->virtType == VIR_DOMAIN_VIRT_KVM) {
> for (i = 0; i < ctl->def->nnets; i++) {
> virDomainNetDefPtr net = ctl->def->nets[i];
Adding a test case for this would be good.
--
Jamie Strandboge | http://www.canonical.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180320/b4e644a6/attachment-0001.sig>
More information about the libvir-list
mailing list