return AppArmorRestoreSecurityImageLabel(mgr, def, disk->src);
}
+/* Called when hotplugging */
+static int
+AppArmorSetMemoryLabel(virSecurityManagerPtr mgr,
+ virDomainDefPtr def,
+ virDomainMemoryDefPtr mem)
+{
+ if (mem == NULL)
+ return 0;
+
+ switch ((virDomainMemoryModel) mem->model) {
+ case VIR_DOMAIN_MEMORY_MODEL_NVDIMM:
+ if (mem->nvdimmPath == NULL) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: nvdimm without a path"),
+ __func__);
+ return -1;
+ }
+ if (!virFileExists(mem->nvdimmPath)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: \'%s\' does not exist"),
+ __func__, mem->nvdimmPath);
+ return -1;
+ }
+ return reload_profile(mgr, def, mem->nvdimmPath, true);
+ break;
+ case VIR_DOMAIN_MEMORY_MODEL_NONE:
+ case VIR_DOMAIN_MEMORY_MODEL_DIMM:
+ case VIR_DOMAIN_MEMORY_MODEL_LAST:
+ break;
+ }
+
+ return 0;
+}
+
+
+static int
+AppArmorRestoreMemoryLabel(virSecurityManagerPtr mgr,
+ virDomainDefPtr def,
+ virDomainMemoryDefPtr mem ATTRIBUTE_UNUSED)
+{
+ return reload_profile(mgr, def, NULL, false);
+}
+
/* Called when hotplugging */
static int
AppArmorSetSecurityImageLabel(virSecurityManagerPtr mgr,
.domainSetSecurityImageLabel = AppArmorSetSecurityImageLabel,
.domainRestoreSecurityImageLabel = AppArmorRestoreSecurityImageLabel,
+ .domainSetSecurityMemoryLabel = AppArmorSetMemoryLabel,
+ .domainRestoreSecurityMemoryLabel = AppArmorRestoreMemoryLabel,
+
.domainSetSecurityDaemonSocketLabel = AppArmorSetSecurityDaemonSocketLabel,
.domainSetSecuritySocketLabel = AppArmorSetSecuritySocketLabel,
.domainClearSecuritySocketLabel = AppArmorClearSecuritySocketLabel,