[PATCH] docs: use real examples for QEMU cli passthrough
by Daniel P. Berrangé
User feedback has shown that the examples are not clear enough
to illustrate the cli passthrough concept in action.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
docs/drvqemu.rst | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/docs/drvqemu.rst b/docs/drvqemu.rst
index 1ee4b1e366..e52d9ffd47 100644
--- a/docs/drvqemu.rst
+++ b/docs/drvqemu.rst
@@ -595,8 +595,11 @@ Example:
<emulator>/usr/bin/qemu-system-x86_64</emulator>
</devices>
<qemu:commandline>
- <qemu:arg value='-newarg'/>
- <qemu:env name='QEMU_ENV' value='VAL'/>
+ <qemu:arg value='-device'/>
+ <qemu:arg value='ipmi-bmc-sim,id=bmc0'/>
+ <qemu:arg value='-device'/>
+ <qemu:arg value='smbus-impi,bmc=bmc0'/>
+ <qemu:env name='QEMU_MODULE_DIR' value='/usr/lib64/qemu'/>
</qemu:commandline>
</domain>
--
2.45.1
4 months, 1 week
[PATCH v3 00/17] hw/sd/sdcard: Accumulation of cleanups and fixes
by Philippe Mathieu-Daudé
Since v2:
- Tested-by from Cédric recorded
- more patches added :S
Since v1:
- various patches merged, few more added
Various SD card cleanups and fixes accumulated over
the years. Various have been useful to help integrating
eMMC support (which will come later).
Full series for testing:
https://gitlab.com/philmd/qemu/-/tags/emmc-v4
Cédric Le Goater (1):
hw/sd/sdcard: Introduce definitions for EXT_CSD register
Philippe Mathieu-Daudé (16):
hw/sd/sdcard: Deprecate support for spec v1.10
hw/sd/sdcard: Use spec v3.01 by default
hw/sd/sdcard: Track last command used to help logging
hw/sd/sdcard: Trace block offset in READ/WRITE data accesses
hw/sd/sdcard: Trace requested address computed by sd_req_get_address()
hw/sd/sdcard: Do not store vendor data on block drive (CMD56)
hw/sd/sdcard: Send WRITE_PROT bits MSB first (CMD30)
hw/sd/sdcard: Send NUM_WR_BLOCKS bits MSB first (ACMD22)
hw/sd/sdcard: Use READY_FOR_DATA definition instead of magic value
hw/sd/sdcard: Assign SDCardStates enum values
hw/sd/sdcard: Simplify sd_inactive_state handling
hw/sd/sdcard: Restrict SWITCH_FUNCTION to sd_transfer_state (CMD6)
hw/sd/sdcard: Add direct reference to SDProto in SDState
hw/sd/sdcard: Extract sd_blk_len() helper
tests/qtest: Disable npcm7xx_sdhci tests using hardcoded RCA
hw/sd/sdcard: Generate random RCA value
docs/about/deprecated.rst | 6 ++
hw/sd/sdmmc-internal.h | 97 +++++++++++++++++++++
hw/sd/sd.c | 145 ++++++++++++++++++-------------
tests/qtest/npcm7xx_sdhci-test.c | 7 ++
hw/sd/trace-events | 6 +-
5 files changed, 199 insertions(+), 62 deletions(-)
--
2.41.0
4 months, 2 weeks
[PATCH] qemu: Don't leave beingDestroyed=true on inactive domain
by Jiri Denemark
Recent commit v10.4.0-87-gd9935a5c4f made a reasonable change to only
reset beingDestroyed back to false when vm->def->id is reset to make
sure other code can detect a domain is (about to become) inactive. It
even added a comment saying any caller of qemuProcessBeginStopJob is
supposed to call qemuProcessStop to clear beingDestroyed. But not every
caller really does so because they first call qemuProcessBeginStopJob
and then check whether a domain is still running. If not the
qemuProcessStop call is skipped leaving beingDestroyed=true. In case of
a persistent domain this may block incoming migrations of such domain as
the migration code would think the domain died unexpectedly (even though
it's still running).
The qemuProcessBeginStopJob function is a wrapper around
virDomainObjBeginJob, but virDomainObjEndJob was used directly for
cleanup. This patch introduces a new qemuProcessEndStopJob wrapper
around virDomainObjEndJob to properly undo everything
qemuProcessBeginStopJob did.
https://issues.redhat.com/browse/RHEL-43309
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_driver.c | 4 ++--
src/qemu/qemu_process.c | 20 ++++++++++++++++----
src/qemu/qemu_process.h | 1 +
3 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f898d85667..9f3013e231 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2102,7 +2102,7 @@ qemuDomainDestroyFlags(virDomainPtr dom,
endjob:
if (ret == 0)
qemuDomainRemoveInactive(driver, vm, 0, false);
- virDomainObjEndJob(vm);
+ qemuProcessEndStopJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -3888,7 +3888,7 @@ processMonitorEOFEvent(virQEMUDriver *driver,
endjob:
qemuDomainRemoveInactive(driver, vm, 0, false);
- virDomainObjEndJob(vm);
+ qemuProcessEndStopJob(vm);
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 7cbe521a6e..25dfd04272 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8421,7 +8421,8 @@ qemuProcessKill(virDomainObj *vm, unsigned int flags)
* qemuProcessBeginStopJob:
*
* Stop all current jobs by killing the domain and start a new one for
- * qemuProcessStop.
+ * qemuProcessStop. The caller has to make sure qemuProcessEndStopJob is
+ * called to properly cleanup the job.
*/
int
qemuProcessBeginStopJob(virDomainObj *vm,
@@ -8448,8 +8449,9 @@ qemuProcessBeginStopJob(virDomainObj *vm,
goto error;
/* priv->beingDestroyed is deliberately left set to 'true' here. Caller
- * is supposed to call qemuProcessStop, which will reset it after
- * 'vm->def->id' is set to -1 */
+ * is supposed to call qemuProcessStop (which will reset it after
+ * 'vm->def->id' is set to -1) and/or qemuProcessEndStopJob to do proper
+ * cleanup. */
return 0;
error:
@@ -8458,6 +8460,16 @@ qemuProcessBeginStopJob(virDomainObj *vm,
}
+void
+qemuProcessEndStopJob(virDomainObj *vm)
+{
+ if (!virDomainObjIsActive(vm))
+ QEMU_DOMAIN_PRIVATE(vm)->beingDestroyed = false;
+
+ virDomainObjEndJob(vm);
+}
+
+
void qemuProcessStop(virQEMUDriver *driver,
virDomainObj *vm,
virDomainShutoffReason reason,
@@ -8800,7 +8812,7 @@ qemuProcessAutoDestroy(virDomainObj *dom,
qemuDomainRemoveInactive(driver, dom, 0, false);
- virDomainObjEndJob(dom);
+ qemuProcessEndStopJob(dom);
virObjectEventStateQueue(driver->domainEventState, event);
}
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index c1ea949215..cb67bfcd2d 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -169,6 +169,7 @@ typedef enum {
int qemuProcessBeginStopJob(virDomainObj *vm,
virDomainJob job,
bool forceKill);
+void qemuProcessEndStopJob(virDomainObj *vm);
void qemuProcessStop(virQEMUDriver *driver,
virDomainObj *vm,
virDomainShutoffReason reason,
--
2.45.2
4 months, 2 weeks
[PATCH] virt-host-validate: Rework calling of driver validation
by Michal Privoznik
It all started with me looking at the --help output which also
printed "bhyve" as supported hypervisor type. Well, it's not on
my Linux machine. To resolve this, I'm just creating a static
array of { "$driver", callback() } pairs and iterating over it.
The array is then initialized at compile time with supported
drivers.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/virt-host-validate.c | 80 +++++++++++++++++++++-----------------
1 file changed, 45 insertions(+), 35 deletions(-)
diff --git a/tools/virt-host-validate.c b/tools/virt-host-validate.c
index 426648a5d3..365b8acd92 100644
--- a/tools/virt-host-validate.c
+++ b/tools/virt-host-validate.c
@@ -29,6 +29,7 @@
#include "internal.h"
#include "virerror.h"
#include "virgettext.h"
+#include "virglibutil.h"
#include "virt-host-validate-common.h"
#if WITH_QEMU
@@ -44,26 +45,58 @@
# include "virt-host-validate-ch.h"
#endif
+typedef struct _virValidateCallbacks virValidateCallbacks;
+struct _virValidateCallbacks {
+ const char *name;
+ int (*callback)(void);
+};
+
+static virValidateCallbacks validateCallbacks[] = {
+#if WITH_QEMU
+ { "qemu", virHostValidateQEMU },
+#endif
+#if WITH_LXC
+ { "lxc", virHostValidateLXC },
+#endif
+#if WITH_BHYVE
+ { "bhyve", virHostValidateBhyve },
+#endif
+#if WITH_CH
+ { "ch", virHostValidateCh },
+#endif
+};
+
static void
show_help(FILE *out, const char *argv0)
{
+ g_autofree char *hvs = NULL;
+ char *hvs_list[G_N_ELEMENTS(validateCallbacks) + 1] = { };
+ size_t i;
+
+ for (i = 0; i < G_N_ELEMENTS(validateCallbacks); i++) {
+ hvs_list[i] = g_strdup_printf(" - %1$s", validateCallbacks[i].name);
+ }
+
+ hvs = g_strjoinv("\n", hvs_list);
+
+ for (i = 0; i < G_N_ELEMENTS(validateCallbacks); i++) {
+ g_free(hvs_list[i]);
+ }
+
fprintf(out,
_("\n"
"syntax: %1$s [OPTIONS] [HVTYPE]\n"
"\n"
" Hypervisor types:\n"
"\n"
- " - qemu\n"
- " - lxc\n"
- " - bhyve\n"
- " - ch\n"
+ "%2$s\n"
"\n"
" Options:\n"
" -h, --help Display command line help\n"
" -v, --version Display command version\n"
" -q, --quiet Don't display progress information\n"
"\n"),
- argv0);
+ argv0, hvs);
}
static void
@@ -87,6 +120,7 @@ main(int argc, char **argv)
int ret = EXIT_SUCCESS;
bool quiet = false;
bool usedHvname = false;
+ size_t i;
if (virGettextInitialize() < 0 ||
virErrorInitialize() < 0) {
@@ -126,37 +160,13 @@ main(int argc, char **argv)
virValidateSetQuiet(quiet);
-#if WITH_QEMU
- if (!hvname || STREQ(hvname, "qemu")) {
- usedHvname = true;
- if (virHostValidateQEMU() < 0)
- ret = EXIT_FAILURE;
+ for (i = 0; i < G_N_ELEMENTS(validateCallbacks); i++) {
+ if (!hvname || STREQ(hvname, validateCallbacks[i].name)) {
+ usedHvname = true;
+ if (validateCallbacks[i].callback() < 0)
+ ret = EXIT_FAILURE;
+ }
}
-#endif
-
-#if WITH_LXC
- if (!hvname || STREQ(hvname, "lxc")) {
- usedHvname = true;
- if (virHostValidateLXC() < 0)
- ret = EXIT_FAILURE;
- }
-#endif
-
-#if WITH_BHYVE
- if (!hvname || STREQ(hvname, "bhyve")) {
- usedHvname = true;
- if (virHostValidateBhyve() < 0)
- ret = EXIT_FAILURE;
- }
-#endif
-
-#if WITH_CH
- if (!hvname || STREQ(hvname, "ch")) {
- usedHvname = true;
- if (virHostValidateCh() < 0)
- ret = EXIT_FAILURE;
- }
-#endif
if (hvname && !usedHvname) {
fprintf(stderr, _("%1$s: unsupported hypervisor name %2$s\n"),
--
2.44.2
4 months, 2 weeks
[PATCH] virt-host-validate: Drop extra "PASS"
by Michal Privoznik
If virt-host-validate is ran on a SEV-SNP capable machine, an
extra "PASS" is printed out. This is because
virHostValidateAMDSev() prints "PASS" and then returns 1
(indicating success) which in turn makes the caller
(virHostValidateSecureGuests()) print "PASS" again. Just drop the
extra printing in the caller and let virHostValidateAMDSev() do
all the printing.
Fixes: 1a8f646f291775d2423ce4e4df62ad69f06ab827
Resolves: https://issues.redhat.com/browse/RHEL-46868
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/virt-host-validate-common.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index a29a5b6d5f..86db4815c3 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -488,11 +488,7 @@ int virHostValidateSecureGuests(const char *hvname,
return VIR_VALIDATE_FAILURE(level);
}
} else if (hasAMDSev) {
- int rc = virHostValidateAMDSev(hvname, level);
-
- if (rc > 0)
- virValidatePass();
- return rc;
+ return virHostValidateAMDSev(hvname, level);
}
virValidateFail(level,
--
2.44.2
4 months, 2 weeks
[PATCH v1 0/1] Add support for Vfio Stats in Libvirt
by Kshitij Jha
Hi,
This is a solution to add support for data transferred by Vfio devices
during the Live Migration in Libvirt.
Currently libvirt only supports a few essential stats like memory
transferred, dirty rate and number of iteration etc. returned as
part of virDomainGetJobStats for each iteration. However it does
not return stats for Vfio devices like data transferred by the
device during the migration
With this change virDomainGetJobStats will be able to support
Vfio stats.
Regards
Kshitij Jha
Kshitij Jha (1):
Include support for Vfio stats during Migration
include/libvirt/libvirt-domain.h | 9 +++++++++
src/qemu/qemu_domainjob.c | 6 ++++++
src/qemu/qemu_monitor.h | 1 +
src/qemu/qemu_monitor_json.c | 12 ++++++++++++
4 files changed, 28 insertions(+)
--
2.22.3
4 months, 2 weeks
[PATCH] network: allow "modify" option for DNS-Txt records
by Adam Julis
The "modify" command allows to replace an existing record (its
text value). The primary key is the name of the record. If
duplicity or missing record detected, throw error.
Tests in networkxml2xmlupdatetest.c contain replacements of an
existing DNS-text record and failure due to non-existing record.
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/639
Signed-off-by: Adam Julis <ajulis(a)redhat.com>
---
src/conf/network_conf.c | 18 ++++++++-----
.../dns-txt-record-modify-fail.xml | 1 +
.../dns-txt-record-modify-success.xml | 1 +
.../nat-network-dns-txt-modify-ok.xml | 26 +++++++++++++++++++
tests/networkxml2xmlupdatetest.c | 9 +++++++
5 files changed, 49 insertions(+), 6 deletions(-)
create mode 100644 tests/networkxml2xmlupdatein/dns-txt-record-modify-fail.xml
create mode 100644 tests/networkxml2xmlupdatein/dns-txt-record-modify-success.xml
create mode 100644 tests/networkxml2xmlupdateout/nat-network-dns-txt-modify-ok.xml
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index fc387f9566..dd362b6ab2 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -3351,12 +3351,6 @@ virNetworkDefUpdateDNSTxt(virNetworkDef *def,
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
- if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
- _("DNS TXT records cannot be modified, only added or deleted"));
- goto cleanup;
- }
-
if (virNetworkDefUpdateCheckElementName(def, ctxt->node, "txt") < 0)
goto cleanup;
@@ -3395,6 +3389,18 @@ virNetworkDefUpdateDNSTxt(virNetworkDef *def,
virNetworkDNSTxtDefClear(&dns->txts[foundIdx]);
VIR_DELETE_ELEMENT(dns->txts, foundIdx, dns->ntxts);
+ } else if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
+
+ if (foundIdx == dns->ntxts) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("couldn't locate a matching DNS TXT record in network %1$s"),
+ def->name);
+ goto cleanup;
+ }
+
+ VIR_FREE(dns->txts[foundIdx].value);
+ dns->txts[foundIdx].value = g_strdup(txt.value);
+
} else {
virNetworkDefUpdateUnknownCommand(command);
goto cleanup;
diff --git a/tests/networkxml2xmlupdatein/dns-txt-record-modify-fail.xml b/tests/networkxml2xmlupdatein/dns-txt-record-modify-fail.xml
new file mode 100644
index 0000000000..75ed475fe1
--- /dev/null
+++ b/tests/networkxml2xmlupdatein/dns-txt-record-modify-fail.xml
@@ -0,0 +1 @@
+<txt name='notexisted' value='modified example'/>
diff --git a/tests/networkxml2xmlupdatein/dns-txt-record-modify-success.xml b/tests/networkxml2xmlupdatein/dns-txt-record-modify-success.xml
new file mode 100644
index 0000000000..e16c352253
--- /dev/null
+++ b/tests/networkxml2xmlupdatein/dns-txt-record-modify-success.xml
@@ -0,0 +1 @@
+<txt name='example' value='modified example'/>
diff --git a/tests/networkxml2xmlupdateout/nat-network-dns-txt-modify-ok.xml b/tests/networkxml2xmlupdateout/nat-network-dns-txt-modify-ok.xml
new file mode 100644
index 0000000000..4b4dda094a
--- /dev/null
+++ b/tests/networkxml2xmlupdateout/nat-network-dns-txt-modify-ok.xml
@@ -0,0 +1,26 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'>
+ <interface dev='eth1'/>
+ </forward>
+ <bridge name='virbr0' stp='on' delay='0'/>
+ <dns>
+ <txt name='example' value='modified example'/>
+ </dns>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <range start='192.168.122.2' end='192.168.122.254'/>
+ <host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
+ <host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
+ </dhcp>
+ </ip>
+ <ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
+ </ip>
+ <ip family='ipv4' address='10.24.10.1'>
+ </ip>
+</network>
diff --git a/tests/networkxml2xmlupdatetest.c b/tests/networkxml2xmlupdatetest.c
index 59e6ce98e5..875cede035 100644
--- a/tests/networkxml2xmlupdatetest.c
+++ b/tests/networkxml2xmlupdatetest.c
@@ -306,6 +306,15 @@ mymain(void)
"dns-txt-record-snowman",
"nat-network-dns-txt-record",
VIR_NETWORK_UPDATE_COMMAND_DELETE);
+ DO_TEST("modify-dns-txt-record",
+ "dns-txt-record-modify-success",
+ "nat-network-dns-txt-record",
+ "nat-network-dns-txt-modify-ok",
+ VIR_NETWORK_UPDATE_COMMAND_MODIFY);
+ DO_TEST_FAIL("modify-missing-dns-txt-record",
+ "dns-txt-record-modify-fail",
+ "nat-network-dns-txt-record",
+ VIR_NETWORK_UPDATE_COMMAND_MODIFY);
section = VIR_NETWORK_SECTION_DNS_SRV;
--
2.45.2
4 months, 2 weeks
[PATCH] network: allow "modify" option for DNS hostname
by Adam Julis
The "modify" command allows you to replace an existing record
(its hostname, sub-elements). IP address acts as the primary key.
If it is not found, the attempt ends with an error message. If
the XML contains a duplicate address, it will select the last
one.
Tests in networkxml2xmlupdatetest.c contain replacements of an
existing DNS-Host record and failure due to non-existing record.
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/639
Signed-off-by: Adam Julis <ajulis(a)redhat.com>
---
src/conf/network_conf.c | 28 ++++++++++++++-----
.../dns-host-modify-not-existing.xml | 4 +++
.../dns-host-modify.xml | 5 ++++
.../nat-network-dns-hosts-modified.xml | 28 +++++++++++++++++++
tests/networkxml2xmlupdatetest.c | 9 ++++++
5 files changed, 67 insertions(+), 7 deletions(-)
create mode 100644 tests/networkxml2xmlupdatein/dns-host-modify-not-existing.xml
create mode 100644 tests/networkxml2xmlupdatein/dns-host-modify.xml
create mode 100644 tests/networkxml2xmlupdateout/nat-network-dns-hosts-modified.xml
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index f5ccf4bd12..2a541cd5b0 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -3138,19 +3138,13 @@ virNetworkDefUpdateDNSHost(virNetworkDef *def,
unsigned int fflags G_GNUC_UNUSED)
{
size_t i, j, k;
- int foundIdx = -1, ret = -1;
+ int foundIdx = -1, ret = -1, foundIdxModify = -1;
virNetworkDNSDef *dns = &def->dns;
virNetworkDNSHostDef host = { 0 };
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
int foundCt = 0;
- if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
- _("DNS HOST records cannot be modified, only added or deleted"));
- goto cleanup;
- }
-
if (virNetworkDefUpdateCheckElementName(def, ctxt->node, "host") < 0)
goto cleanup;
@@ -3163,6 +3157,12 @@ virNetworkDefUpdateDNSHost(virNetworkDef *def,
if (virSocketAddrEqual(&host.ip, &dns->hosts[i].ip))
foundThisTime = true;
+ /* modify option required index of matching ip-address, the loop under
+ * this comment could affect results of found index foundThisTime,
+ * so the foundIdxModify is there used instead */
+ if (foundThisTime)
+ foundIdxModify = i;
+
/* when adding we want to only check duplicates of address since having
* multiple addresses with the same hostname is a legitimate configuration */
if (!isAdd) {
@@ -3213,6 +3213,20 @@ virNetworkDefUpdateDNSHost(virNetworkDef *def,
virNetworkDNSHostDefClear(&dns->hosts[foundIdx]);
VIR_DELETE_ELEMENT(dns->hosts, foundIdx, dns->nhosts);
+ } else if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
+
+ if (foundCt == 0) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("couldn't locate a matching DNS HOST record in network %1$s"),
+ def->name);
+ goto cleanup;
+ }
+
+ virNetworkDNSHostDefClear(&dns->hosts[foundIdxModify]);
+
+ memcpy(&dns->hosts[foundIdxModify], &host, sizeof(virNetworkDNSHostDef));
+ memset(&host, 0, sizeof(virNetworkDNSHostDef));
+
} else {
virNetworkDefUpdateUnknownCommand(command);
goto cleanup;
diff --git a/tests/networkxml2xmlupdatein/dns-host-modify-not-existing.xml b/tests/networkxml2xmlupdatein/dns-host-modify-not-existing.xml
new file mode 100644
index 0000000000..357fccd110
--- /dev/null
+++ b/tests/networkxml2xmlupdatein/dns-host-modify-not-existing.xml
@@ -0,0 +1,4 @@
+<host ip='192.168.122.333'>
+ <hostname>shared</hostname>
+ <hostname>names</hostname>
+</host>
diff --git a/tests/networkxml2xmlupdatein/dns-host-modify.xml b/tests/networkxml2xmlupdatein/dns-host-modify.xml
new file mode 100644
index 0000000000..78b9fd88a6
--- /dev/null
+++ b/tests/networkxml2xmlupdatein/dns-host-modify.xml
@@ -0,0 +1,5 @@
+<host ip='192.168.122.2'>
+ <hostname>Another</hostname>
+ <hostname>decent</hostname>
+ <hostname>names</hostname>
+</host>
diff --git a/tests/networkxml2xmlupdateout/nat-network-dns-hosts-modified.xml b/tests/networkxml2xmlupdateout/nat-network-dns-hosts-modified.xml
new file mode 100644
index 0000000000..8fcaad15d1
--- /dev/null
+++ b/tests/networkxml2xmlupdateout/nat-network-dns-hosts-modified.xml
@@ -0,0 +1,28 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid>
+ <forward dev='eth0' mode='nat'>
+ <interface dev='eth0'/>
+ </forward>
+ <bridge name='virbr0' stp='on' delay='0'/>
+ <dns forwardPlainNames='no'>
+ <host ip='192.168.122.122'>
+ <hostname>pudding</hostname>
+ </host>
+ <host ip='192.168.122.1'>
+ <hostname>host</hostname>
+ <hostname>gateway</hostname>
+ </host>
+ <host ip='192.168.122.2'>
+ <hostname>Another</hostname>
+ <hostname>decent</hostname>
+ <hostname>names</hostname>
+ </host>
+ <host ip='fd8f:1391:3a82:150::c0a8:9603'>
+ <hostname>shared</hostname>
+ <hostname>names</hostname>
+ </host>
+ </dns>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ </ip>
+</network>
diff --git a/tests/networkxml2xmlupdatetest.c b/tests/networkxml2xmlupdatetest.c
index afe2b1f574..383cbf85ce 100644
--- a/tests/networkxml2xmlupdatetest.c
+++ b/tests/networkxml2xmlupdatetest.c
@@ -276,6 +276,15 @@ mymain(void)
"nat-network-dns-hosts",
"nat-network-no-hosts",
VIR_NETWORK_UPDATE_COMMAND_DELETE);
+ DO_TEST("modify-dns-host",
+ "dns-host-modify",
+ "nat-network-dns-hosts",
+ "nat-network-dns-hosts-modified",
+ VIR_NETWORK_UPDATE_COMMAND_MODIFY);
+ DO_TEST_FAIL("modify-dns-host-not-existing",
+ "dns-host-modify-not-existing",
+ "nat-network-dns-hosts",
+ VIR_NETWORK_UPDATE_COMMAND_MODIFY);
section = VIR_NETWORK_SECTION_DNS_TXT;
--
2.45.2
4 months, 2 weeks
[PATCH] domain_conf: comment not match the code below
by Adam Julis
The outdated comment refers to a non-existent member in the
virDomainObj structure.
Signed-off-by: Adam Julis <ajulis(a)redhat.com>
---
src/conf/domain_conf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7033b4e9fe..115862bbde 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4449,7 +4449,7 @@ virDomainObjGetDefs(virDomainObj *vm,
* @live: set to true if live config was returned (may be omitted)
*
* Helper function to resolve @flags and return the correct domain pointer
- * object. This function returns one of @vm->def or @vm->persistentDef
+ * object. This function returns one of @vm->def or @vm->newDef
* according to @flags. @live is set to true if the live vm config will be
* returned. This helper should be used only in APIs that guarantee
* that @flags contains exactly one of VIR_DOMAIN_AFFECT_LIVE or
@@ -4489,7 +4489,7 @@ virDomainObjGetOneDefState(virDomainObj *vm,
* @flags: for virDomainModificationImpact
*
* Helper function to resolve @flags and return the correct domain pointer
- * object. This function returns one of @vm->def or @vm->persistentDef
+ * object. This function returns one of @vm->def or @vm->newDef
* according to @flags. This helper should be used only in APIs that guarantee
* that @flags contains exactly one of VIR_DOMAIN_AFFECT_LIVE or
* VIR_DOMAIN_AFFECT_CONFIG and not both.
--
2.45.2
4 months, 2 weeks
[PATCH] virt-aa-helper: Drop needless comments
by Michal Privoznik
When generating paths for a domain specific AppArmor profile each
path undergoes a validation where it's matched against an array
of well known prefixes (among other things). Now, for
OVMF/AAVMF/... images we have a list and some entries have
comments to which type of image the entry belongs to. For
instance:
"/usr/share/OVMF/", /* for OVMF images */
"/usr/share/AAVMF/", /* for AAVMF images */
But these comments are pretty useless. The path itself already
gives away the image type. Drop them.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/security/virt-aa-helper.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index a3f85d26b0..c1e89dc6cf 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -475,15 +475,15 @@ valid_path(const char *path, const bool readonly)
"/initrd",
"/initrd.img",
"/usr/share/edk2/",
- "/usr/share/edk2-ovmf/", /* for OVMF images */
- "/usr/share/OVMF/", /* for OVMF images */
- "/usr/share/ovmf/", /* for OVMF images */
- "/usr/share/AAVMF/", /* for AAVMF images */
+ "/usr/share/edk2-ovmf/",
+ "/usr/share/OVMF/",
+ "/usr/share/ovmf/",
+ "/usr/share/AAVMF/",
"/usr/share/qemu-efi/", /* for AAVMF images */
- "/usr/share/qemu-efi-aarch64/", /* for AAVMF images */
+ "/usr/share/qemu-efi-aarch64/",
"/usr/share/qemu/", /* SUSE path for OVMF and AAVMF images */
- "/usr/lib/u-boot/", /* u-boot loaders for qemu */
- "/usr/lib/riscv64-linux-gnu/opensbi" /* RISC-V SBI implementation */
+ "/usr/lib/u-boot/",
+ "/usr/lib/riscv64-linux-gnu/opensbi",
};
/* override the above with these */
const char * const override[] = {
--
2.44.2
4 months, 2 weeks