[PATCHv2 0/2] Add a type attribute on the mac address element
by Bastien Orivel
Changed:
- Split the commit in two to separate the documentation from the
code changes.
- Change the attribute name from check (tri state bool) to type
(static/generated).
Bastien Orivel (2):
Add a type attribute on the mac address element
Document the `type` attribute for mac addresses
NEWS.rst | 6 ++++
docs/drvesx.html.in | 7 +++++
docs/schemas/domaincommon.rng | 8 +++++
src/conf/domain_conf.c | 26 ++++++++++++++++-
src/conf/domain_conf.h | 11 +++++++
src/vmx/vmx.c | 8 +++--
.../network-interface-mac-type.xml | 29 +++++++++++++++++++
tests/genericxml2xmltest.c | 2 ++
8 files changed, 93 insertions(+), 4 deletions(-)
create mode 100644 tests/genericxml2xmlindata/network-interface-mac-type.xml
--
2.20.1
4 years, 4 months
[PATCH] Add a check attribute on the mac address element
by Bastien Orivel
This is only used in the ESX driver where, when set to "no", it will
ignore all the checks libvirt does about the origin of the MAC address
(whether or not it's in a VMWare OUI) and forward the original one to
the ESX server telling it not to check it either.
This allows keeping a deterministic MAC address which can be useful for
licensed software which might dislike changes.
Signed-off-by: Bastien Orivel <bastien.orivel(a)diateam.net>
---
NEWS.rst | 6 ++++
docs/drvesx.html.in | 5 ++++
docs/schemas/domaincommon.rng | 3 ++
src/conf/domain_conf.c | 18 +++++++++++-
src/conf/domain_conf.h | 1 +
src/vmx/vmx.c | 9 +++++-
.../network-interface-mac-check.xml | 29 +++++++++++++++++++
tests/genericxml2xmltest.c | 2 ++
8 files changed, 71 insertions(+), 2 deletions(-)
create mode 100644 tests/genericxml2xmlindata/network-interface-mac-check.xml
diff --git a/NEWS.rst b/NEWS.rst
index 1928220854..ac4de4360d 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -18,6 +18,12 @@ v6.6.0 (unreleased)
Libvirt allows configuring ACPI Heterogeneous Memory Attribute Table to
hint software running inside the guest on optimization.
+ * esx: Add a ``check`` attribute for mac addresses.
+
+ This attribute allows (when set to ``no``) ignoring VMWare checks of the
+ MAC addresses that would generate a new one if they were in its OUI
+ (00:0c:29).
+
* **Improvements**
* esx: Change the NIC limit for recent virtualHW versions
diff --git a/docs/drvesx.html.in b/docs/drvesx.html.in
index ac7bc645d1..90f368e4f5 100644
--- a/docs/drvesx.html.in
+++ b/docs/drvesx.html.in
@@ -427,6 +427,11 @@ error: invalid argument in libvirt was built without the 'esx' driver
<pre>
ethernet0.checkMACAddress = "false"
</pre>
+ <p>
+ <span class="since">Since 6.6.0</span>, one can force libvirt to keep the
+ provided MAC address when it's in the reserved VMware range by adding a
+ <code>check="no"</code> attribute to the <code><mac/></code> element.
+ </p>
<h3><a id="hardware">Available hardware</a></h3>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 4b4aa60c66..b926b752fe 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3179,6 +3179,9 @@
<attribute name="address">
<ref name="uniMacAddr"/>
</attribute>
+ <optional>
+ <attribute name="check"><ref name="virYesNo"/></attribute>
+ </optional>
<empty/>
</element>
</optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d14485f18d..aa1417c4d8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11904,6 +11904,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
virDomainChrSourceReconnectDef reconnect = {0};
int rv, val;
g_autofree char *macaddr = NULL;
+ g_autofree char *macaddr_check = NULL;
g_autofree char *type = NULL;
g_autofree char *network = NULL;
g_autofree char *portgroup = NULL;
@@ -11984,6 +11985,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
}
if (!macaddr && virXMLNodeNameEqual(cur, "mac")) {
macaddr = virXMLPropString(cur, "address");
+ macaddr_check = virXMLPropString(cur, "check");
} else if (!network &&
def->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
virXMLNodeNameEqual(cur, "source")) {
@@ -12173,6 +12175,17 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
def->mac_generated = true;
}
+ if (macaddr_check) {
+ int tmpCheck;
+ if ((tmpCheck = virTristateBoolTypeFromString(macaddr_check)) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("invalid mac address check value: '%s'"),
+ macaddr_check);
+ goto error;
+ }
+ def->mac_check = tmpCheck;
+ }
+
if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info,
flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT
| VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) < 0) {
@@ -26468,8 +26481,11 @@ virDomainNetDefFormat(virBufferPtr buf,
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
- virBufferAsprintf(buf, "<mac address='%s'/>\n",
+ virBufferAsprintf(buf, "<mac address='%s'",
virMacAddrFormat(&def->mac, macstr));
+ if (def->mac_check != VIR_TRISTATE_BOOL_ABSENT)
+ virBufferAsprintf(buf, " check='%s'", virTristateBoolTypeToString(def->mac_check));
+ virBufferAddLit(buf, "/>\n");
if (publicActual) {
/* when there is a virDomainActualNetDef, and we haven't been
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 6a737591e2..f2bcd62857 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -972,6 +972,7 @@ struct _virDomainNetDef {
virDomainNetType type;
virMacAddr mac;
bool mac_generated; /* true if mac was *just now* auto-generated by libvirt */
+ virTristateBool mac_check;
int model; /* virDomainNetModelType */
char *modelstr;
union {
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index d4d66f6768..82035884a2 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -3829,7 +3829,14 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller,
prefix = (def->mac.addr[0] << 16) | (def->mac.addr[1] << 8) | def->mac.addr[2];
suffix = (def->mac.addr[3] << 16) | (def->mac.addr[4] << 8) | def->mac.addr[5];
- if (prefix == 0x000c29) {
+ if (def->mac_check == VIR_TRISTATE_BOOL_NO) {
+ virBufferAsprintf(buffer, "ethernet%d.addressType = \"static\"\n",
+ controller);
+ virBufferAsprintf(buffer, "ethernet%d.address = \"%s\"\n",
+ controller, mac_string);
+ virBufferAsprintf(buffer, "ethernet%d.checkMACAddress = \"false\"\n",
+ controller);
+ } else if (prefix == 0x000c29) {
virBufferAsprintf(buffer, "ethernet%d.addressType = \"generated\"\n",
controller);
virBufferAsprintf(buffer, "ethernet%d.generatedAddress = \"%s\"\n",
diff --git a/tests/genericxml2xmlindata/network-interface-mac-check.xml b/tests/genericxml2xmlindata/network-interface-mac-check.xml
new file mode 100644
index 0000000000..b21577d7cc
--- /dev/null
+++ b/tests/genericxml2xmlindata/network-interface-mac-check.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <interface type='bridge'>
+ <mac address='aa:bb:cc:dd:ee:ff'/>
+ <source bridge='br0'/>
+ </interface>
+ <interface type='bridge'>
+ <mac address='aa:bb:cc:dd:ee:fe' check='yes'/>
+ <source bridge='br1'/>
+ </interface>
+ <interface type='bridge'>
+ <mac address='aa:bb:cc:dd:ee:fd' check='no'/>
+ <source bridge='br2'/>
+ </interface>
+ </devices>
+</domain>
diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c
index 8b9b0bafb6..102abfdec2 100644
--- a/tests/genericxml2xmltest.c
+++ b/tests/genericxml2xmltest.c
@@ -183,6 +183,8 @@ mymain(void)
DO_TEST("cpu-cache-passthrough");
DO_TEST("cpu-cache-disable");
+ DO_TEST("network-interface-mac-check");
+
DO_TEST_DIFFERENT("chardev-tcp");
DO_TEST_FULL("chardev-tcp-missing-host", 0, false,
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE);
--
2.20.1
4 years, 4 months
[PATCH v6 00/10] Tighten qemu-img rules on missing backing format
by Eric Blake
v5 was here:
https://lists.gnu.org/archive/html/qemu-devel/2020-04/msg00679.html
In v6:
- add a few more patches
- change qcow semantics based on several iterations of mailing list
debates on what behavior is easiest to support
- add iotesting that a probed raw file cannot be committed into
- instead of recording an implicit probed raw file, instead we record
only a non-raw file
- rebase to a few more affected iotests, plus s/5.0/5.1/
Yes, I know this is really short notice to make it in before feature
freeze for 5.1 (removal in 6.0), so it may end up slipping into 5.2
(removal in 6.1); but we'll see how things go.
Also available at
https://repo.or.cz/qemu/ericb.git/shortlog/refs/tags/qemu-img-create-back...
001/10:[down] 'qemu-img: Flush stdout before before potential stderr messages'
002/10:[down] 'block: Finish deprecation of 'qemu-img convert -n -o''
003/10:[----] [--] 'sheepdog: Add trivial backing_fmt support'
004/10:[----] [--] 'vmdk: Add trivial backing_fmt support'
005/10:[0088] [FC] 'qcow: Tolerate backing_fmt='
006/10:[down] 'block: Error if backing file fails during creation without -u'
007/10:[0004] [FC] 'qcow2: Deprecate use of qemu-img amend to change backing file'
008/10:[0059] [FC] 'iotests: Specify explicit backing format where sensible'
009/10:[----] [-C] 'block: Add support to warn on backing file change without format'
010/10:[0027] [FC] 'qemu-img: Deprecate use of -b without -F'
Eric Blake (10):
qemu-img: Flush stdout before before potential stderr messages
block: Finish deprecation of 'qemu-img convert -n -o'
sheepdog: Add trivial backing_fmt support
vmdk: Add trivial backing_fmt support
qcow: Tolerate backing_fmt=
block: Error if backing file fails during creation without -u
qcow2: Deprecate use of qemu-img amend to change backing file
iotests: Specify explicit backing format where sensible
block: Add support to warn on backing file change without format
qemu-img: Deprecate use of -b without -F
docs/system/deprecated.rst | 58 +++++++++++++++++++----
docs/tools/qemu-img.rst | 4 ++
include/block/block.h | 4 +-
block.c | 53 +++++++++++++++------
block/qcow.c | 20 +++++++-
block/qcow2.c | 7 ++-
block/sheepdog.c | 18 ++++++-
block/stream.c | 2 +-
block/vmdk.c | 14 ++++++
blockdev.c | 3 +-
qemu-img.c | 15 ++++--
tests/qemu-iotests/017 | 2 +-
tests/qemu-iotests/017.out | 2 +-
tests/qemu-iotests/018 | 2 +-
tests/qemu-iotests/018.out | 2 +-
tests/qemu-iotests/019 | 5 +-
tests/qemu-iotests/019.out | 2 +-
tests/qemu-iotests/020 | 4 +-
tests/qemu-iotests/020.out | 4 +-
tests/qemu-iotests/024 | 8 ++--
tests/qemu-iotests/024.out | 5 +-
tests/qemu-iotests/028 | 4 +-
tests/qemu-iotests/028.out | 2 +-
tests/qemu-iotests/030 | 26 ++++++++---
tests/qemu-iotests/034 | 2 +-
tests/qemu-iotests/034.out | 2 +-
tests/qemu-iotests/037 | 2 +-
tests/qemu-iotests/037.out | 2 +-
tests/qemu-iotests/038 | 2 +-
tests/qemu-iotests/038.out | 2 +-
tests/qemu-iotests/039 | 3 +-
tests/qemu-iotests/039.out | 2 +-
tests/qemu-iotests/040 | 47 +++++++++++++------
tests/qemu-iotests/041 | 37 ++++++++++-----
tests/qemu-iotests/042 | 4 +-
tests/qemu-iotests/043 | 18 +++----
tests/qemu-iotests/043.out | 16 ++++---
tests/qemu-iotests/046 | 2 +-
tests/qemu-iotests/046.out | 2 +-
tests/qemu-iotests/049.out | 8 ++--
tests/qemu-iotests/050 | 4 +-
tests/qemu-iotests/050.out | 2 +-
tests/qemu-iotests/051 | 2 +-
tests/qemu-iotests/051.out | 2 +-
tests/qemu-iotests/051.pc.out | 2 +-
tests/qemu-iotests/054.out | 2 +-
tests/qemu-iotests/056 | 3 +-
tests/qemu-iotests/060 | 2 +-
tests/qemu-iotests/060.out | 2 +-
tests/qemu-iotests/061 | 10 ++--
tests/qemu-iotests/061.out | 11 +++--
tests/qemu-iotests/069 | 2 +-
tests/qemu-iotests/069.out | 2 +-
tests/qemu-iotests/073 | 2 +-
tests/qemu-iotests/073.out | 2 +-
tests/qemu-iotests/079.out | 2 +-
tests/qemu-iotests/082 | 10 ++--
tests/qemu-iotests/082.out | 14 +++---
tests/qemu-iotests/085 | 4 +-
tests/qemu-iotests/085.out | 6 +--
tests/qemu-iotests/089 | 2 +-
tests/qemu-iotests/089.out | 2 +-
tests/qemu-iotests/095 | 4 +-
tests/qemu-iotests/095.out | 4 +-
tests/qemu-iotests/097 | 4 +-
tests/qemu-iotests/097.out | 16 +++----
tests/qemu-iotests/098 | 2 +-
tests/qemu-iotests/098.out | 8 ++--
tests/qemu-iotests/110 | 4 +-
tests/qemu-iotests/110.out | 4 +-
tests/qemu-iotests/111.out | 2 +-
tests/qemu-iotests/112.out | 4 +-
tests/qemu-iotests/114 | 12 +++++
tests/qemu-iotests/114.out | 9 ++++
tests/qemu-iotests/122 | 34 +++++++++-----
tests/qemu-iotests/122.out | 12 +++--
tests/qemu-iotests/126 | 4 +-
tests/qemu-iotests/126.out | 4 +-
tests/qemu-iotests/127 | 4 +-
tests/qemu-iotests/127.out | 4 +-
tests/qemu-iotests/129 | 3 +-
tests/qemu-iotests/133 | 2 +-
tests/qemu-iotests/133.out | 2 +-
tests/qemu-iotests/139 | 2 +-
tests/qemu-iotests/141 | 4 +-
tests/qemu-iotests/141.out | 4 +-
tests/qemu-iotests/142 | 2 +-
tests/qemu-iotests/142.out | 2 +-
tests/qemu-iotests/153 | 14 +++---
tests/qemu-iotests/153.out | 35 +++++++-------
tests/qemu-iotests/154 | 42 ++++++++---------
tests/qemu-iotests/154.out | 42 ++++++++---------
tests/qemu-iotests/155 | 12 +++--
tests/qemu-iotests/156 | 9 ++--
tests/qemu-iotests/156.out | 6 +--
tests/qemu-iotests/158 | 2 +-
tests/qemu-iotests/158.out | 2 +-
tests/qemu-iotests/161 | 8 ++--
tests/qemu-iotests/161.out | 8 ++--
tests/qemu-iotests/176 | 4 +-
tests/qemu-iotests/176.out | 32 ++++++-------
tests/qemu-iotests/177 | 2 +-
tests/qemu-iotests/177.out | 2 +-
tests/qemu-iotests/179 | 2 +-
tests/qemu-iotests/179.out | 2 +-
tests/qemu-iotests/189 | 2 +-
tests/qemu-iotests/189.out | 2 +-
tests/qemu-iotests/191 | 12 ++---
tests/qemu-iotests/191.out | 12 ++---
tests/qemu-iotests/195 | 6 +--
tests/qemu-iotests/195.out | 6 +--
tests/qemu-iotests/198 | 2 +-
tests/qemu-iotests/198.out | 3 +-
tests/qemu-iotests/204 | 2 +-
tests/qemu-iotests/204.out | 2 +-
tests/qemu-iotests/216 | 2 +-
tests/qemu-iotests/224 | 4 +-
tests/qemu-iotests/225 | 2 +-
tests/qemu-iotests/225.out | 2 +-
tests/qemu-iotests/228 | 5 +-
tests/qemu-iotests/245 | 3 +-
tests/qemu-iotests/249 | 4 +-
tests/qemu-iotests/249.out | 4 +-
tests/qemu-iotests/252 | 2 +-
tests/qemu-iotests/257 | 3 +-
tests/qemu-iotests/259.out | 2 +-
tests/qemu-iotests/267 | 4 +-
tests/qemu-iotests/267.out | 6 +--
tests/qemu-iotests/270 | 2 +-
tests/qemu-iotests/270.out | 2 +-
tests/qemu-iotests/273 | 4 +-
tests/qemu-iotests/273.out | 4 +-
tests/qemu-iotests/274 | 12 ++---
tests/qemu-iotests/274.out | 29 ++++++------
tests/qemu-iotests/279 | 4 +-
tests/qemu-iotests/279.out | 4 +-
tests/qemu-iotests/290 | 2 +-
tests/qemu-iotests/290.out | 4 +-
tests/qemu-iotests/293 | 88 +++++++++++++++++++++++++++++++++++
tests/qemu-iotests/293.out | 59 +++++++++++++++++++++++
tests/qemu-iotests/group | 1 +
141 files changed, 792 insertions(+), 402 deletions(-)
create mode 100755 tests/qemu-iotests/293
create mode 100644 tests/qemu-iotests/293.out
--
2.27.0
4 years, 4 months
[GSoC][PATCH v3 0/4] removal of qemu_domainjob dependencies
by Prathamesh Chavan
The following series of patches work on isolating the qemu_domainjob
from its dependency on other files such as `qemu_migration_params`,
`qemu_monitor`, etc. This is done by the introduction of a
`privateData` structure, which is further handled by a structure
of callback functions.
Previous version of this patch can be found here[1].
As the previous patch was a bulky one, this series of patches
are the result of splitting the previous one.
[1]: https://www.redhat.com/archives/libvir-list/2020-July/msg00423.html
Prathamesh Chavan (4):
qemu_domain: moved qemuDomainNamespace to `qemu_domain`
qemu_domainjob: job funcitons moved out of `qemu_domain`
qemu_domainjob: introduce `privateData` for `qemuDomainJob`
qemu_domainjob: introduce `privateData` for `qemuDomainJobInfo`
src/qemu/qemu_backup.c | 15 +-
src/qemu/qemu_domain.c | 250 +------------------
src/qemu/qemu_domain.h | 28 +++
src/qemu/qemu_domainjob.c | 406 +++++++++++++++++++++++++++----
src/qemu/qemu_domainjob.h | 54 ++--
src/qemu/qemu_driver.c | 21 +-
src/qemu/qemu_migration.c | 42 ++--
src/qemu/qemu_migration_cookie.c | 7 +-
src/qemu/qemu_migration_params.c | 9 +-
src/qemu/qemu_process.c | 26 +-
10 files changed, 510 insertions(+), 348 deletions(-)
--
2.17.1
4 years, 4 months
[PATCH v2 0/2] Fix resctrl locking
by Martin Kletzander
Le Blurb: Re-sending even when reviewed because I don't feel that confident,
even after reading the commit messages after myself. Let's be honest, I'm
resending it only because of the commit messages.
Martin Kletzander (2):
util: Rework virFileFlock() to be unambiguous
resctrl: Use exclusive lock for /sys/fs/resctrl
src/util/virfile.c | 27 ++++++++++++++++++---------
src/util/virfile.h | 9 ++++++++-
src/util/virresctrl.c | 4 ++--
3 files changed, 28 insertions(+), 12 deletions(-)
--
2.27.0
4 years, 4 months
[PATCH] util: Rework virFileFlock() to be unambiguous
by Martin Kletzander
The boolean parameters for lock/unlock and read/write (shared/exclusive) caused
a lot of confusion when reading the callers. The new approach is explicit and
unambiguous.
While at it, also change the only caller so that it acquires an exclusive lock
as it should've been all the time. This was caused because the function was
ambiguous since it was created in commit 5a0a5f7fb5f5, and due to that it was
misused in commit 657ddeff2313 and since then the lock being taken was shared
rather than exclusive.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/util/virfile.c | 27 ++++++++++++++++++---------
src/util/virfile.h | 9 ++++++++-
src/util/virresctrl.c | 4 ++--
3 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 213acdbcaa2b..554011eecb25 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -465,23 +465,33 @@ int virFileUnlock(int fd, off_t start, off_t len)
/**
* virFileFlock:
* @fd: file descriptor to call flock on
- * @lock: true for lock, false for unlock
- * @shared: true if shared, false for exclusive, ignored if `@lock == false`
+ * @op: operation to perform
*
* This is just a simple wrapper around flock(2) that errors out on unsupported
* platforms.
*
* The lock will be released when @fd is closed or this function is called with
- * `@lock == false`.
+ * `@op == VIR_FILE_FLOCK_UNLOCK`.
*
* Returns 0 on success, -1 otherwise (with errno set)
*/
-int virFileFlock(int fd, bool lock, bool shared)
+int virFileFlock(int fd, virFileFlockOperation op)
{
- if (lock)
- return flock(fd, shared ? LOCK_SH : LOCK_EX);
+ int flock_op = -1;
- return flock(fd, LOCK_UN);
+ switch (op) {
+ case VIR_FILE_FLOCK_SHARED:
+ flock_op = LOCK_SH;
+ break;
+ case VIR_FILE_FLOCK_EXCLUSIVE:
+ flock_op = LOCK_EX;
+ break;
+ case VIR_FILE_FLOCK_UNLOCK:
+ flock_op = LOCK_UN;
+ break;
+ }
+
+ return flock(fd, flock_op);
}
#else /* WIN32 */
@@ -505,8 +515,7 @@ int virFileUnlock(int fd G_GNUC_UNUSED,
int virFileFlock(int fd G_GNUC_UNUSED,
- bool lock G_GNUC_UNUSED,
- bool shared G_GNUC_UNUSED)
+ virFileFlockOperation op G_GNUC_UNUSED)
{
errno = ENOSYS;
return -1;
diff --git a/src/util/virfile.h b/src/util/virfile.h
index 7a92364a5c9f..04428727fd3b 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -118,7 +118,14 @@ int virFileLock(int fd, bool shared, off_t start, off_t len, bool waitForLock)
int virFileUnlock(int fd, off_t start, off_t len)
G_GNUC_NO_INLINE;
-int virFileFlock(int fd, bool lock, bool shared);
+
+typedef enum {
+ VIR_FILE_FLOCK_EXCLUSIVE,
+ VIR_FILE_FLOCK_SHARED,
+ VIR_FILE_FLOCK_UNLOCK,
+} virFileFlockOperation;
+
+int virFileFlock(int fd, virFileFlockOperation op);
typedef int (*virFileRewriteFunc)(int fd, const void *opaque);
int virFileRewrite(const char *path,
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index 3563fc560db5..784a8d43bb2f 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -463,7 +463,7 @@ virResctrlLockWrite(void)
return -1;
}
- if (virFileFlock(fd, true, true) < 0) {
+ if (virFileFlock(fd, VIR_FILE_FLOCK_EXCLUSIVE) < 0) {
virReportSystemError(errno, "%s", _("Cannot lock resctrl"));
VIR_FORCE_CLOSE(fd);
return -1;
@@ -485,7 +485,7 @@ virResctrlUnlock(int fd)
virReportSystemError(errno, "%s", _("Cannot close resctrl"));
/* Trying to save the already broken */
- if (virFileFlock(fd, false, false) < 0)
+ if (virFileFlock(fd, VIR_FILE_FLOCK_UNLOCK) < 0)
virReportSystemError(errno, "%s", _("Cannot unlock resctrl"));
return -1;
--
2.27.0
4 years, 4 months
[PATCH] resctrl: Do not open directory for writing
by Martin Kletzander
When preparing for the removal of GNULIB commit 18dca21a32e9 removed the
unneeded O_DIRECTORY, but unfortunately started opening the directory for
writing which fails every time for a directory. There is also no need for that
as flock() works on O_RDONLY file descriptor as well, even for LOCK_EX.
https://bugzilla.redhat.com/1852741
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/util/virresctrl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index 33044da3a1ef..f6da13645ae3 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -456,7 +456,7 @@ VIR_ONCE_GLOBAL_INIT(virResctrl);
static int
virResctrlLockWrite(void)
{
- int fd = open(SYSFS_RESCTRL_PATH, O_RDWR | O_CLOEXEC);
+ int fd = open(SYSFS_RESCTRL_PATH, O_RDONLY | O_CLOEXEC);
if (fd < 0) {
virReportSystemError(errno, "%s", _("Cannot open resctrl"));
--
2.27.0
4 years, 4 months
Re: [PATCH 2/2] x86/cpu: Handle GUEST_MAXPHYADDR < HOST_MAXPHYADDR for hosts that don't support it
by Eduardo Habkost
(CCing libvir-list, and people who were included in the OVMF
thread[1])
[1] https://lore.kernel.org/qemu-devel/99779e9c-f05f-501b-b4be-ff719f140a88@c...
On Fri, Jun 19, 2020 at 05:53:44PM +0200, Mohammed Gamal wrote:
> If the CPU doesn't support GUEST_MAXPHYADDR < HOST_MAXPHYADDR we
> let QEMU choose to use the host MAXPHYADDR and print a warning to the
> user.
>
> Signed-off-by: Mohammed Gamal <mgamal(a)redhat.com>
> ---
> target/i386/cpu.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index b1b311baa2..91c57117ce 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -6589,6 +6589,17 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
> uint32_t host_phys_bits = x86_host_phys_bits();
> static bool warned;
>
> + /*
> + * If host doesn't support setting physical bits on the guest,
> + * report it and return
> + */
> + if (cpu->phys_bits < host_phys_bits &&
> + !kvm_has_smaller_maxphyaddr()) {
> + warn_report("Host doesn't support setting smaller phys-bits."
> + " Using host phys-bits\n");
> + cpu->phys_bits = host_phys_bits;
> + }
> +
This looks like a regression from existing behavior. Today,
using smaller phys-bits doesn't crash most guests, and still
allows live migration to smaller hosts. I agree using the host
phys-bits is probably a better default, but we shouldn't override
options set explicitly in the command line.
Also, it's important that we work with libvirt and management
software to ensure they have appropriate APIs to choose what to
do when a cluster has hosts with different MAXPHYADDR.
> /* Print a warning if the user set it to a value that's not the
> * host value.
> */
> --
> 2.26.2
>
--
Eduardo
4 years, 4 months
[libvirt PATCH v2 0/5] fixes and cleanups for current build system
by Pavel Hrdina
While working on rewrite to Meson I discovered some parts of our
current build system that could be improved to help with the
transition to Meson. It will make the review of the Meson patches
a bit easier.
Changes in v2:
- dropped patches:
src: unify virFileActivateDirOverride()
tools: virsh-secret: fix compilation error
- fixed pointed out issues
- added a patch to covert FIG files into SVG files
Pavel Hrdina (5):
docs: drop %.png: %.fig rule
docs: convert FIG files into SVG format
m4: virt-secdriver-selinux: drop obsolete function checks
m4: virt-xdr: rewrite XDR check
wireshark: fix compilation errors
docs/Makefile.am | 3 -
docs/architecture.fig | 87 ----------
docs/architecture.svg | 239 +++++++++++++++++++++++++++
docs/libvirt-daemon-arch.fig | 114 -------------
docs/libvirt-daemon-arch.svg | 185 +++++++++++++++++++++
docs/libvirt-driver-arch.fig | 62 -------
docs/libvirt-driver-arch.svg | 94 +++++++++++
docs/libvirt-object-model.fig | 61 -------
docs/libvirt-object-model.svg | 138 ++++++++++++++++
docs/libvirt-virConnect-example.fig | 58 -------
docs/libvirt-virConnect-example.svg | 138 ++++++++++++++++
docs/migration-managed-direct.fig | 58 -------
docs/migration-managed-direct.svg | 107 ++++++++++++
docs/migration-managed-p2p.fig | 58 -------
docs/migration-managed-p2p.svg | 107 ++++++++++++
docs/migration-native.fig | 43 -----
docs/migration-native.svg | 68 ++++++++
docs/migration-tunnel.fig | 49 ------
docs/migration-tunnel.svg | 92 +++++++++++
docs/migration-unmanaged-direct.fig | 58 -------
docs/migration-unmanaged-direct.svg | 107 ++++++++++++
docs/node.fig | 30 ----
docs/node.svg | 36 ++++
docs/structures.fig | 72 --------
docs/structures.svg | 187 +++++++++++++++++++++
libvirt.spec.in | 4 +
m4/virt-secdriver-selinux.m4 | 24 +--
m4/virt-xdr.m4 | 39 ++---
src/Makefile.am | 4 +-
src/admin/Makefile.inc.am | 1 +
src/internal.h | 4 +
src/locking/Makefile.inc.am | 2 +
src/logging/Makefile.inc.am | 1 +
src/remote/Makefile.inc.am | 1 +
src/security/security_selinux.c | 18 +-
tests/securityselinuxhelper.c | 6 -
tools/Makefile.am | 2 +-
tools/wireshark/src/packet-libvirt.c | 17 +-
38 files changed, 1545 insertions(+), 829 deletions(-)
delete mode 100644 docs/architecture.fig
create mode 100644 docs/architecture.svg
delete mode 100644 docs/libvirt-daemon-arch.fig
create mode 100644 docs/libvirt-daemon-arch.svg
delete mode 100644 docs/libvirt-driver-arch.fig
create mode 100644 docs/libvirt-driver-arch.svg
delete mode 100644 docs/libvirt-object-model.fig
create mode 100644 docs/libvirt-object-model.svg
delete mode 100644 docs/libvirt-virConnect-example.fig
create mode 100644 docs/libvirt-virConnect-example.svg
delete mode 100644 docs/migration-managed-direct.fig
create mode 100644 docs/migration-managed-direct.svg
delete mode 100644 docs/migration-managed-p2p.fig
create mode 100644 docs/migration-managed-p2p.svg
delete mode 100644 docs/migration-native.fig
create mode 100644 docs/migration-native.svg
delete mode 100644 docs/migration-tunnel.fig
create mode 100644 docs/migration-tunnel.svg
delete mode 100644 docs/migration-unmanaged-direct.fig
create mode 100644 docs/migration-unmanaged-direct.svg
delete mode 100644 docs/node.fig
create mode 100644 docs/node.svg
delete mode 100644 docs/structures.fig
create mode 100644 docs/structures.svg
--
2.26.2
4 years, 4 months
[libvirt PATCH] docs: rename fig to svg in Makefile.am
by Pavel Hrdina
Commit <9ad637c9651ff29955dd6aa8fe31f639b42b7315> converted all fig
files into svg files but did not change the Makefile.am.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
Pushed under build-breaker rule.
docs/Makefile.am | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 3fd8256e668..a480123e33f 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -343,15 +343,15 @@ api_DATA = \
libvirt-lxc-api.xml \
libvirt-admin-api.xml
-fig = \
- libvirt-daemon-arch.fig \
- libvirt-driver-arch.fig \
- libvirt-object-model.fig \
- migration-managed-direct.fig \
- migration-managed-p2p.fig \
- migration-native.fig \
- migration-tunnel.fig \
- migration-unmanaged-direct.fig
+svg = \
+ libvirt-daemon-arch.svg \
+ libvirt-driver-arch.svg \
+ libvirt-object-model.svg \
+ migration-managed-direct.svg \
+ migration-managed-p2p.svg \
+ migration-native.svg \
+ migration-tunnel.svg \
+ migration-unmanaged-direct.svg
schemadir = $(pkgdatadir)/schemas
schema_DATA = $(wildcard $(srcdir)/schemas/*.rng)
@@ -359,7 +359,7 @@ schema_DATA = $(wildcard $(srcdir)/schemas/*.rng)
EXTRA_DIST= \
site.xsl subsite.xsl newapi.xsl page.xsl \
$(dot_html_in) $(dot_rst) $(apipng) \
- $(fig) $(assets) \
+ $(svg) $(assets) \
$(javascript) $(logofiles) \
$(internals_html_in) $(internals_rst) $(fonts) \
$(kbase_html_in) $(kbase_rst) \
--
2.26.2
4 years, 4 months