From nobody Sun Apr 28 19:43:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1508773416006819.140442388038; Mon, 23 Oct 2017 08:43:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 748AEC01F265; Mon, 23 Oct 2017 15:43:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C2BE7C011; Mon, 23 Oct 2017 15:43:34 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 155CB1804484; Mon, 23 Oct 2017 15:43:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9NFhVR3021778 for ; Mon, 23 Oct 2017 11:43:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id D80A1795B0; Mon, 23 Oct 2017 15:43:31 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-30.brq.redhat.com [10.40.204.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B63B6031E; Mon, 23 Oct 2017 15:43:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 748AEC01F265 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 23 Oct 2017 17:43:14 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: zack.cornelius@kove.net Subject: [libvirt] [PATCH v1 1/5] conf: s/virDomainObjGetShortName/virDomainDefGetShortName/ X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 23 Oct 2017 15:43:35 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This function works over domain definition and not domain object. Its name is thus misleading. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 4 ++-- src/conf/domain_conf.h | 2 +- src/libvirt_private.syms | 2 +- src/qemu/qemu_conf.c | 2 +- src/qemu/qemu_domain.c | 4 ++-- src/qemu/qemu_driver.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 77c20c697..58b75c672 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -27871,14 +27871,14 @@ virDomainDefHasMemballoon(const virDomainDef *def) #define VIR_DOMAIN_SHORT_NAME_MAX 20 =20 /** - * virDomainObjGetShortName: + * virDomainDefGetShortName: * @vm: Machine for which to get a name * @unique: Make sure the name is unique (use id as well) * * Shorten domain name to avoid possible path length limitations. */ char * -virDomainObjGetShortName(const virDomainDef *def) +virDomainDefGetShortName(const virDomainDef *def) { wchar_t wshortname[VIR_DOMAIN_SHORT_NAME_MAX + 1] =3D {0}; size_t len =3D 0; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 38de70b15..bd541a9c5 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3366,7 +3366,7 @@ int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr = def, =20 bool virDomainDefHasMemballoon(const virDomainDef *def) ATTRIBUTE_NONNULL(= 1); =20 -char *virDomainObjGetShortName(const virDomainDef *def) ATTRIBUTE_NONNULL(= 1); +char *virDomainDefGetShortName(const virDomainDef *def) ATTRIBUTE_NONNULL(= 1); =20 int virDomainGetBlkioParametersAssignFromDef(virDomainDefPtr def, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 448d962b2..3ebff18aa 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -262,6 +262,7 @@ virDomainDefGetMemoryInitial; virDomainDefGetMemoryTotal; virDomainDefGetOnlineVcpumap; virDomainDefGetSecurityLabelDef; +virDomainDefGetShortName; virDomainDefGetVcpu; virDomainDefGetVcpuPinInfoHelper; virDomainDefGetVcpus; @@ -457,7 +458,6 @@ virDomainObjGetMetadata; virDomainObjGetOneDef; virDomainObjGetOneDefState; virDomainObjGetPersistentDef; -virDomainObjGetShortName; virDomainObjGetState; virDomainObjNew; virDomainObjParseNode; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index ec61c9c52..bf6b334f4 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1659,7 +1659,7 @@ qemuGetDomainHugepagePath(const virDomainDef *def, virHugeTLBFSPtr hugepage) { char *base =3D qemuGetBaseHugepagePath(hugepage); - char *domPath =3D virDomainObjGetShortName(def); + char *domPath =3D virDomainDefGetShortName(def); char *ret =3D NULL; =20 if (base && domPath) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c7c9e94da..e828fa2f6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1705,7 +1705,7 @@ qemuDomainSetPrivatePaths(virQEMUDriverPtr driver, { virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); qemuDomainObjPrivatePtr priv =3D vm->privateData; - char *domname =3D virDomainObjGetShortName(vm->def); + char *domname =3D virDomainDefGetShortName(vm->def); int ret =3D -1; =20 if (!domname) @@ -8203,7 +8203,7 @@ qemuDomainGetPreservedMountPath(virQEMUDriverConfigPt= r cfg, char *path =3D NULL; char *tmp; const char *suffix =3D mountpoint + strlen(DEVPREFIX); - char *domname =3D virDomainObjGetShortName(vm->def); + char *domname =3D virDomainDefGetShortName(vm->def); size_t off; =20 if (!domname) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 32a416f9e..dacfca9a9 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4079,7 +4079,7 @@ getAutoDumpPath(virQEMUDriverPtr driver, virDomainObjPtr vm) { char *dumpfile =3D NULL; - char *domname =3D virDomainObjGetShortName(vm->def); + char *domname =3D virDomainDefGetShortName(vm->def); char timestr[100]; struct tm time_info; time_t curtime =3D time(NULL); --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 19:43:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1508773419031641.5623670916333; Mon, 23 Oct 2017 08:43:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5828E2CE92F; Mon, 23 Oct 2017 15:43:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 32B2A7C01D; Mon, 23 Oct 2017 15:43:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E8E8C5EC64; Mon, 23 Oct 2017 15:43:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9NFhXRX021788 for ; Mon, 23 Oct 2017 11:43:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 04F3C795B0; Mon, 23 Oct 2017 15:43:33 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-30.brq.redhat.com [10.40.204.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E6366031E; Mon, 23 Oct 2017 15:43:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5828E2CE92F Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 23 Oct 2017 17:43:15 +0200 Message-Id: <379df595d4c0f54ec950f3dcd9c07a47a3ec29bc.1508773227.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: zack.cornelius@kove.net Subject: [libvirt] [PATCH v1 2/5] qemu: Move memPath generation from memoryBackingDir to a separate function X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 23 Oct 2017 15:43:37 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In near future we will need more than just a plain VIR_STRDUP(). Better implement that in a separate function and in qemuBuildMemoryBackendStr() which is complicated enough already. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_conf.c | 18 ++++++++++++++++++ src/qemu/qemu_conf.h | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b1cfafa79..82d2fb2a3 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3439,7 +3439,7 @@ qemuBuildMemoryBackendStr(virJSONValuePtr *backendPro= ps, } else { /* We can have both pagesize and mem source. If that's the cas= e, * prefer hugepages as those are more specific. */ - if (VIR_STRDUP(memPath, cfg->memoryBackingDir) < 0) + if (qemuGetMemoryBackingPath(cfg, &memPath) < 0) goto cleanup; } =20 diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index bf6b334f4..23dcc25e1 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1748,3 +1748,21 @@ qemuGetDomainHupageMemPath(const virDomainDef *def, =20 return 0; } + + +/** + * qemuGetMemoryBackingPath: + * @cfg: the driver config + * @memPath: constructed path + * + * Constructs path to memory backing dir and stores it at @memPath. + * + * Returns: 0 on success, + * -1 otherwise (with error reported). + */ +int +qemuGetMemoryBackingPath(virQEMUDriverConfigPtr cfg, + char **memPath) +{ + return VIR_STRDUP(*memPath, cfg->memoryBackingDir); +} diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 13b6f818a..9d6866816 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -363,4 +363,7 @@ int qemuGetDomainHupageMemPath(const virDomainDef *def, virQEMUDriverConfigPtr cfg, unsigned long long pagesize, char **memPath); + +int qemuGetMemoryBackingPath(virQEMUDriverConfigPtr cfg, + char **memPath); #endif /* __QEMUD_CONF_H */ --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 19:43:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1508773417720848.8179502179753; Mon, 23 Oct 2017 08:43:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2F154BDE3; Mon, 23 Oct 2017 15:43:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 01D837DF45; Mon, 23 Oct 2017 15:43:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BBC0E1804485; Mon, 23 Oct 2017 15:43:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9NFhYpS021796 for ; Mon, 23 Oct 2017 11:43:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 57A567A200; Mon, 23 Oct 2017 15:43:34 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-30.brq.redhat.com [10.40.204.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60040795B5; Mon, 23 Oct 2017 15:43:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2F154BDE3 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 23 Oct 2017 17:43:16 +0200 Message-Id: <86a6f5b416296cf971e95ad09217da67fc5a7753.1508773227.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: zack.cornelius@kove.net Subject: [libvirt] [PATCH v1 3/5] qemu.conf: Introduce memory_predictable_file_names X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 23 Oct 2017 15:43:36 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In some cases management application needs to allocate memory for qemu upfront and then just let qemu use that. Since we don't want to expose path for memory-backend-file anywhere in the domain XML, we can have a configuration knob that when enabled generated predictable paths. In this case: $memoryBackingDir/libvirt/qemu/$shortName/$alias where $shortName is result of virDomainObjGetShortName(). Signed-off-by: Michal Privoznik --- src/qemu/libvirtd_qemu.aug | 1 + src/qemu/qemu.conf | 5 ++ src/qemu/qemu_command.c | 9 +-- src/qemu/qemu_conf.c | 76 +++++++++++++++++++- src/qemu/qemu_conf.h | 10 ++- src/qemu/qemu_driver.c | 19 +++++ src/qemu/qemu_hotplug.c | 2 +- src/qemu/qemu_process.c | 141 ++++++++++++++++++++++++++-------= ---- src/qemu/qemu_process.h | 8 +-- src/qemu/test_libvirtd_qemu.aug.in | 1 + 10 files changed, 220 insertions(+), 52 deletions(-) diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug index c19bf3a43..77d466b14 100644 --- a/src/qemu/libvirtd_qemu.aug +++ b/src/qemu/libvirtd_qemu.aug @@ -114,6 +114,7 @@ module Libvirtd_qemu =3D let gluster_debug_level_entry =3D int_entry "gluster_debug_level" =20 let memory_entry =3D str_entry "memory_backing_dir" + | bool_entry "memory_predictable_file_names" =20 let vxhs_entry =3D bool_entry "vxhs_tls" | str_entry "vxhs_tls_x509_cert_dir" diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index 2e8370a5a..dc3098148 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -769,3 +769,8 @@ # This directory is used for memoryBacking source if configured as file. # NOTE: big files will be stored here #memory_backing_dir =3D "/var/lib/libvirt/qemu/ram" + +# Use predictable file names. If this is enabled, Libvirt constructs +# full paths for memory-backing-file objects. This is experimental +# feature and generated paths can change across releases. Don't use it. +#memory_predictable_file_names =3D 1 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 82d2fb2a3..d6d2654cd 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3439,7 +3439,7 @@ qemuBuildMemoryBackendStr(virJSONValuePtr *backendPro= ps, } else { /* We can have both pagesize and mem source. If that's the cas= e, * prefer hugepages as those are more specific. */ - if (qemuGetMemoryBackingPath(cfg, &memPath) < 0) + if (qemuGetMemoryBackingPath(def, cfg, mem->info.alias, &memPa= th) < 0) goto cleanup; } =20 @@ -3542,12 +3542,13 @@ qemuBuildMemoryCellBackendStr(virDomainDefPtr def, unsigned long long memsize =3D virDomainNumaGetNodeMemorySize(def->num= a, cell); =20 + if (virAsprintf(&alias, "ram-node%zu", cell) < 0) + goto cleanup; + *backendStr =3D NULL; mem.size =3D memsize; mem.targetNode =3D cell; - - if (virAsprintf(&alias, "ram-node%zu", cell) < 0) - goto cleanup; + mem.info.alias =3D alias; =20 if ((rc =3D qemuBuildMemoryBackendStr(&props, &backendType, cfg, priv-= >qemuCaps, def, &mem, priv->autoNodeset, fals= e)) < 0) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 23dcc25e1..34f411137 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -912,6 +912,10 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, if (virConfGetValueString(conf, "memory_backing_dir", &cfg->memoryBack= ingDir) < 0) goto cleanup; =20 + if (virConfGetValueBool(conf, "memory_predictable_file_names", + &cfg->memoryPredictableFileNames) < 0) + goto cleanup; + ret =3D 0; =20 cleanup: @@ -1750,9 +1754,53 @@ qemuGetDomainHupageMemPath(const virDomainDef *def, } =20 =20 +int +qemuGetMemoryBackingBasePath(virQEMUDriverConfigPtr cfg, + char **path) +{ + if (!cfg->memoryPredictableFileNames) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("predictable file names are disabled")); + return -1; + } + + return virAsprintf(path, "%s/libvirt/qemu", cfg->memoryBackingDir); +} + + +int +qemuGetMemoryBackingDomainPath(const virDomainDef *def, + virQEMUDriverConfigPtr cfg, + char **path) +{ + char *shortName =3D NULL; + char *base =3D NULL; + int ret =3D -1; + + if (!cfg->memoryPredictableFileNames) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("predictable file names are disabled")); + return -1; + } + + if (!(shortName =3D virDomainDefGetShortName(def)) || + qemuGetMemoryBackingBasePath(cfg, &base) < 0 || + virAsprintf(path, "%s/%s", base, shortName) < 0) + goto cleanup; + + ret =3D 0; + cleanup: + VIR_FREE(base); + VIR_FREE(shortName); + return ret; +} + + /** * qemuGetMemoryBackingPath: + * @def: domain definition * @cfg: the driver config + * @alias: memory object alias * @memPath: constructed path * * Constructs path to memory backing dir and stores it at @memPath. @@ -1761,8 +1809,32 @@ qemuGetDomainHupageMemPath(const virDomainDef *def, * -1 otherwise (with error reported). */ int -qemuGetMemoryBackingPath(virQEMUDriverConfigPtr cfg, +qemuGetMemoryBackingPath(const virDomainDef *def, + virQEMUDriverConfigPtr cfg, + const char *alias, char **memPath) { - return VIR_STRDUP(*memPath, cfg->memoryBackingDir); + char *domainPath =3D NULL; + int ret =3D -1; + + if (cfg->memoryPredictableFileNames) { + if (!alias) { + /* This should never happen (TM) */ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("memory device alias is not assigned")); + goto cleanup; + } + + if (qemuGetMemoryBackingDomainPath(def, cfg, &domainPath) < 0 || + virAsprintf(memPath, "%s/%s", domainPath, alias) < 0) + goto cleanup; + } else { + if (VIR_STRDUP(*memPath, cfg->memoryBackingDir) < 0) + goto cleanup; + } + + ret =3D 0; + cleanup: + VIR_FREE(domainPath); + return ret; } diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 9d6866816..5b72788c9 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -203,6 +203,7 @@ struct _virQEMUDriverConfig { unsigned int glusterDebugLevel; =20 char *memoryBackingDir; + bool memoryPredictableFileNames; =20 bool vxhsTLS; char *vxhsTLSx509certdir; @@ -364,6 +365,13 @@ int qemuGetDomainHupageMemPath(const virDomainDef *def, unsigned long long pagesize, char **memPath); =20 -int qemuGetMemoryBackingPath(virQEMUDriverConfigPtr cfg, +int qemuGetMemoryBackingBasePath(virQEMUDriverConfigPtr cfg, + char **path); +int qemuGetMemoryBackingDomainPath(const virDomainDef *def, + virQEMUDriverConfigPtr cfg, + char **path); +int qemuGetMemoryBackingPath(const virDomainDef *def, + virQEMUDriverConfigPtr cfg, + const char *alias, char **memPath); #endif /* __QEMUD_CONF_H */ diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index dacfca9a9..7bdefd7e8 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -630,6 +630,7 @@ qemuStateInitialize(bool privileged, uid_t run_uid =3D -1; gid_t run_gid =3D -1; char *hugepagePath =3D NULL; + char *memoryBackingPath =3D NULL; size_t i; =20 if (VIR_ALLOC(qemu_driver) < 0) @@ -888,6 +889,23 @@ qemuStateInitialize(bool privileged, VIR_FREE(hugepagePath); } =20 + if (cfg->memoryPredictableFileNames) { + if (qemuGetMemoryBackingBasePath(cfg, &memoryBackingPath) < 0) + goto error; + + if (virFileMakePath(memoryBackingPath) < 0) { + virReportSystemError(errno, + _("unable to create memory backing path %= s"), + memoryBackingPath); + goto error; + } + if (privileged && + virFileUpdatePerm(memoryBackingPath, + 0, S_IXGRP | S_IXOTH) < 0) + goto error; + VIR_FREE(memoryBackingPath); + } + if (!(qemu_driver->closeCallbacks =3D virCloseCallbacksNew())) goto error; =20 @@ -945,6 +963,7 @@ qemuStateInitialize(bool privileged, virObjectUnref(conn); VIR_FREE(driverConf); VIR_FREE(hugepagePath); + VIR_FREE(memoryBackingPath); qemuStateCleanup(); return -1; } diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 91f7f9ed6..5701c033b 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2077,7 +2077,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, priv->qemuCaps, vm->def, mem, NULL, true= ) < 0) goto cleanup; =20 - if (qemuProcessBuildDestroyHugepagesPath(driver, vm, mem, true) < 0) + if (qemuProcessBuildDestroyMemoryPaths(driver, vm, mem, true) < 0) goto cleanup; =20 if (qemuDomainNamespaceSetupMemory(driver, vm, mem) < 0) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index fdc868912..5dea02718 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3324,60 +3324,121 @@ qemuProcessNeedHugepagesPath(virDomainDefPtr def, } =20 =20 +static bool +qemuProcessNeedMemoryBackingPath(virDomainDefPtr def, + virQEMUDriverConfigPtr cfg, + virDomainMemoryDefPtr mem) +{ + size_t i; + size_t numaNodes; + + if (!cfg->memoryPredictableFileNames) + return false; + + if (def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_FILE || + def->mem.access !=3D VIR_DOMAIN_MEMORY_ACCESS_DEFAULT) + return true; + + numaNodes =3D virDomainNumaGetNodeCount(def->numa); + for (i =3D 0; i < numaNodes; i++) { + if (virDomainNumaGetNodeMemoryAccessMode(def->numa, i) + !=3D VIR_DOMAIN_MEMORY_ACCESS_DEFAULT) + return true; + } + + if (mem && + mem->model =3D=3D VIR_DOMAIN_MEMORY_MODEL_DIMM && + (mem->access !=3D VIR_DOMAIN_MEMORY_ACCESS_DEFAULT || + (mem->targetNode >=3D 0 && + virDomainNumaGetNodeMemoryAccessMode(def->numa, mem->targetNode) + !=3D VIR_DOMAIN_MEMORY_ACCESS_DEFAULT))) + return true; + + return false; +} + + +static int +qemuProcessBuildDestroyMemoryPathsImpl(virQEMUDriverPtr driver, + virDomainDefPtr def, + const char *path, + bool build) +{ + if (build) { + if (virFileExists(path)) + return 0; + + if (virFileMakePathWithMode(path, 0700) < 0) { + virReportSystemError(errno, + _("Unable to create %s"), + path); + return -1; + } + + if (qemuSecurityDomainSetPathLabel(driver->securityManager, + def, path) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to label %s"), path); + return -1; + } + } else { + if (rmdir(path) < 0 && + errno !=3D ENOENT) + VIR_WARN("Unable to remove hugepage path: %s (errno=3D%d)", + path, errno); + } + + return 0; +} + + int -qemuProcessBuildDestroyHugepagesPath(virQEMUDriverPtr driver, - virDomainObjPtr vm, - virDomainMemoryDefPtr mem, - bool build) +qemuProcessBuildDestroyMemoryPaths(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainMemoryDefPtr mem, + bool build) { virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); - char *hugepagePath =3D NULL; + char *path =3D NULL; size_t i; - bool shouldBuild =3D false; + bool shouldBuildHP =3D false; + bool shouldBuildMB =3D false; int ret =3D -1; =20 - if (build) - shouldBuild =3D qemuProcessNeedHugepagesPath(vm->def, mem); + if (build) { + shouldBuildHP =3D qemuProcessNeedHugepagesPath(vm->def, mem); + shouldBuildMB =3D qemuProcessNeedMemoryBackingPath(vm->def, cfg, m= em); + } =20 - if (!build || shouldBuild) { + if (!build || shouldBuildHP) { for (i =3D 0; i < cfg->nhugetlbfs; i++) { - VIR_FREE(hugepagePath); - hugepagePath =3D qemuGetDomainHugepagePath(vm->def, &cfg->huge= tlbfs[i]); + path =3D qemuGetDomainHugepagePath(vm->def, &cfg->hugetlbfs[i]= ); =20 - if (!hugepagePath) + if (!path) goto cleanup; =20 - if (build) { - if (virFileExists(hugepagePath)) { - ret =3D 0; - goto cleanup; - } - - if (virFileMakePathWithMode(hugepagePath, 0700) < 0) { - virReportSystemError(errno, - _("Unable to create %s"), - hugepagePath); - goto cleanup; - } + if (qemuProcessBuildDestroyMemoryPathsImpl(driver, vm->def, + path, build) < 0) + goto cleanup; =20 - if (qemuSecurityDomainSetPathLabel(driver->securityManager, - vm->def, hugepagePath) = < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Unable to set huge path in sec= urity driver")); - goto cleanup; - } - } else { - if (rmdir(hugepagePath) < 0 && - errno !=3D ENOENT) - VIR_WARN("Unable to remove hugepage path: %s (errno=3D= %d)", - hugepagePath, errno); - } + VIR_FREE(path); } } =20 + if (!build || shouldBuildMB) { + if (qemuGetMemoryBackingDomainPath(vm->def, cfg, &path) < 0) + goto cleanup; + + if (qemuProcessBuildDestroyMemoryPathsImpl(driver, vm->def, + path, build) < 0) + goto cleanup; + + VIR_FREE(path); + } + ret =3D 0; cleanup: - VIR_FREE(hugepagePath); + VIR_FREE(path); virObjectUnref(cfg); return ret; } @@ -5550,7 +5611,7 @@ qemuProcessPrepareHost(virQEMUDriverPtr driver, NULL) < 0) goto cleanup; =20 - if (qemuProcessBuildDestroyHugepagesPath(driver, vm, NULL, true) < 0) + if (qemuProcessBuildDestroyMemoryPaths(driver, vm, NULL, true) < 0) goto cleanup; =20 /* Ensure no historical cgroup for this VM is lying around bogus @@ -6254,7 +6315,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, goto endjob; } =20 - qemuProcessBuildDestroyHugepagesPath(driver, vm, NULL, false); + qemuProcessBuildDestroyMemoryPaths(driver, vm, NULL, false); =20 vm->def->id =3D -1; =20 @@ -7112,7 +7173,7 @@ qemuProcessReconnect(void *opaque) goto cleanup; } =20 - if (qemuProcessBuildDestroyHugepagesPath(driver, obj, NULL, true) < 0) + if (qemuProcessBuildDestroyMemoryPaths(driver, obj, NULL, true) < 0) goto error; =20 if ((qemuDomainAssignAddresses(obj->def, priv->qemuCaps, diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index 814b86d8a..cd9a72031 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -38,10 +38,10 @@ int qemuProcessStopCPUs(virQEMUDriverPtr driver, virDomainPausedReason reason, qemuDomainAsyncJob asyncJob); =20 -int qemuProcessBuildDestroyHugepagesPath(virQEMUDriverPtr driver, - virDomainObjPtr vm, - virDomainMemoryDefPtr mem, - bool build); +int qemuProcessBuildDestroyMemoryPaths(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainMemoryDefPtr mem, + bool build); =20 void qemuProcessAutostartAll(virQEMUDriverPtr driver); void qemuProcessReconnectAll(virConnectPtr conn, virQEMUDriverPtr driver); diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qe= mu.aug.in index 688e5b9fd..2f0a1277d 100644 --- a/src/qemu/test_libvirtd_qemu.aug.in +++ b/src/qemu/test_libvirtd_qemu.aug.in @@ -100,3 +100,4 @@ module Test_libvirtd_qemu =3D { "1" =3D "mount" } } { "memory_backing_dir" =3D "/var/lib/libvirt/qemu/ram" } +{ "memory_predictable_file_names" =3D "1" } --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 19:43:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15087734206701016.3878805597985; Mon, 23 Oct 2017 08:43:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 19E7D96A0; Mon, 23 Oct 2017 15:43:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E842D5DA75; Mon, 23 Oct 2017 15:43:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B283A65D27; Mon, 23 Oct 2017 15:43:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9NFhZXE021808 for ; Mon, 23 Oct 2017 11:43:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 96A8F6031E; Mon, 23 Oct 2017 15:43:35 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-30.brq.redhat.com [10.40.204.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE5C57A1E2; Mon, 23 Oct 2017 15:43:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 19E7D96A0 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 23 Oct 2017 17:43:17 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: zack.cornelius@kove.net Subject: [libvirt] [PATCH v1 4/5] qemuxml2argvtest: Test memory_predictable_file_names X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 23 Oct 2017 15:43:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik --- tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.args | 6 ++++-- tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology.args | 3 ++- .../qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.args | 6 ++++-- .../qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology3.args | 9 +++++= +--- tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess2.args | 9 +++++= +--- tests/qemuxml2argvtest.c | 1 + 6 files changed, 23 insertions(+), 11 deletions(-) diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.args b/= tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.args index 5700c3413..352819429 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.args @@ -10,10 +10,12 @@ QEMU_AUDIO_DRV=3Dnone \ -M pc \ -m 214 \ -smp 16,sockets=3D2,cores=3D4,threads=3D2 \ --object memory-backend-file,id=3Dram-node0,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +-object memory-backend-file,id=3Dram-node0,\ +mem-path=3D/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-QEMUGuest1/ram-node0,\ share=3Dyes,size=3D112197632 \ -numa node,nodeid=3D0,cpus=3D0-7,memdev=3Dram-node0 \ --object memory-backend-file,id=3Dram-node1,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +-object memory-backend-file,id=3Dram-node1,\ +mem-path=3D/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-QEMUGuest1/ram-node1,\ share=3Dno,size=3D112197632 \ -numa node,nodeid=3D1,cpus=3D8-15,memdev=3Dram-node1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology.ar= gs b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology.args index 12f3d8ab8..fa1353259 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology.args @@ -11,7 +11,8 @@ QEMU_AUDIO_DRV=3Dnone \ -m 14336 \ -mem-prealloc \ -smp 8,sockets=3D1,cores=3D8,threads=3D1 \ --object memory-backend-file,id=3Dram-node0,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +-object memory-backend-file,id=3Dram-node0,\ +mem-path=3D/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-instance-00000092/ram= -node0,\ share=3Dyes,size=3D15032385536 \ -numa node,nodeid=3D0,cpus=3D0-7,memdev=3Dram-node0 \ -uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.a= rgs b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.args index 585e4d506..6f73a1b99 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.args @@ -11,10 +11,12 @@ QEMU_AUDIO_DRV=3Dnone \ -m 28672 \ -mem-prealloc \ -smp 20,sockets=3D1,cores=3D8,threads=3D1 \ --object memory-backend-file,id=3Dram-node0,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +-object memory-backend-file,id=3Dram-node0,\ +mem-path=3D/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-instance-00000092/ram= -node0,\ share=3Dno,size=3D15032385536 \ -numa node,nodeid=3D0,cpus=3D0-7,memdev=3Dram-node0 \ --object memory-backend-file,id=3Dram-node1,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +-object memory-backend-file,id=3Dram-node1,\ +mem-path=3D/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-instance-00000092/ram= -node1,\ share=3Dyes,size=3D15032385536 \ -numa node,nodeid=3D1,cpus=3D8-15,memdev=3Dram-node1 \ -uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology3.a= rgs b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology3.args index e9a57a69e..3c352fe03 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology3.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology3.args @@ -11,13 +11,16 @@ QEMU_AUDIO_DRV=3Dnone \ -m 43008 \ -mem-prealloc \ -smp 32,sockets=3D1,cores=3D24,threads=3D1 \ --object memory-backend-file,id=3Dram-node0,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +-object memory-backend-file,id=3Dram-node0,\ +mem-path=3D/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-instance-00000092/ram= -node0,\ share=3Dyes,size=3D15032385536 \ -numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ --object memory-backend-file,id=3Dram-node1,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +-object memory-backend-file,id=3Dram-node1,\ +mem-path=3D/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-instance-00000092/ram= -node1,\ share=3Dyes,size=3D15032385536 \ -numa node,nodeid=3D1,cpus=3D2-3,memdev=3Dram-node1 \ --object memory-backend-file,id=3Dram-node2,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +-object memory-backend-file,id=3Dram-node2,\ +mem-path=3D/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-instance-00000092/ram= -node2,\ share=3Dno,size=3D15032385536 \ -numa node,nodeid=3D2,cpus=3D4-5,memdev=3Dram-node2 \ -uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess2.args = b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess2.args index 55db49171..d8e506c19 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess2.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess2.args @@ -10,17 +10,20 @@ QEMU_AUDIO_DRV=3Dnone \ -M pc \ -m size=3D4194304k,slots=3D16,maxmem=3D8388608k \ -smp 4,sockets=3D4,cores=3D1,threads=3D1 \ --object memory-backend-file,id=3Dram-node0,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +-object memory-backend-file,id=3Dram-node0,\ +mem-path=3D/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-QEMUGuest1/ram-node0,\ share=3Dno,size=3D1073741824,host-nodes=3D0-3,policy=3Dbind \ -numa node,nodeid=3D0,cpus=3D0,memdev=3Dram-node0 \ -object memory-backend-file,id=3Dram-node1,prealloc=3Dyes,\ mem-path=3D/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,share=3Dyes,size=3D= 1073741824,\ host-nodes=3D0-3,policy=3Dbind \ -numa node,nodeid=3D1,cpus=3D1,memdev=3Dram-node1 \ --object memory-backend-file,id=3Dram-node2,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +-object memory-backend-file,id=3Dram-node2,\ +mem-path=3D/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-QEMUGuest1/ram-node2,\ share=3Dno,size=3D1073741824,host-nodes=3D0-3,policy=3Dbind \ -numa node,nodeid=3D2,cpus=3D2,memdev=3Dram-node2 \ --object memory-backend-file,id=3Dram-node3,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +-object memory-backend-file,id=3Dram-node3,\ +mem-path=3D/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-QEMUGuest1/ram-node3,\ share=3Dno,size=3D1073741824,host-nodes=3D3,policy=3Dbind \ -numa node,nodeid=3D3,cpus=3D3,memdev=3Dram-node3 \ -object memory-backend-file,id=3Dmemdimm0,prealloc=3Dyes,\ diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 03b1bcbcf..86ef89433 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -619,6 +619,7 @@ mymain(void) VIR_FREE(driver.config->memoryBackingDir); if (VIR_STRDUP_QUIET(driver.config->memoryBackingDir, "/var/lib/libvir= t/qemu/ram") < 0) return EXIT_FAILURE; + driver.config->memoryPredictableFileNames =3D true; =20 # define DO_TEST_FULL(name, migrateFrom, migrateFd, flags, \ parseFlags, gic, ...) \ --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 19:43:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1508773423327562.0953731994567; Mon, 23 Oct 2017 08:43:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CC3D1624BE; Mon, 23 Oct 2017 15:43:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C4B983859; Mon, 23 Oct 2017 15:43:41 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4AE761804487; Mon, 23 Oct 2017 15:43:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9NFhaM9021816 for ; Mon, 23 Oct 2017 11:43:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id BAD1B7A1E7; Mon, 23 Oct 2017 15:43:36 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-30.brq.redhat.com [10.40.204.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0062D795B4; Mon, 23 Oct 2017 15:43:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CC3D1624BE Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 23 Oct 2017 17:43:18 +0200 Message-Id: <7a776e3330be72b95b7d0aade6add527d40a8ccf.1508773227.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: zack.cornelius@kove.net Subject: [libvirt] [PATCH v1 5/5] news: Document memory_predictable_file_names X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 23 Oct 2017 15:43:42 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik --- docs/news.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 989b82aa5..bba1f9968 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -49,6 +49,16 @@ easily. + + + Allow generation of predictable paths for qemu memory backends + + + If enabled in qemu.conf libvirt generates predictable paths for + memory-backend-file objects for qemu domains. However, this is + experimental feature and shouldn't be used. + +
--=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list