[PATCH] network: add modify-or-add feature to net-update
by Abhiram Tilak
The current way of updating a network configuration uses `virsh
net-update` to add, delete or modify entries. But with such a mechansim
one should know if an entry with current info already exists. Adding
modify-or-add option automatically performs either modify or add
depending on the current state.
Fixes: https://gitlab.com/libvirt/libvirt/-/issues/363
Signed-off-by: Abhiram Tilak <atp.exp(a)gmail.com>
---
docs/manpages/virsh.rst | 5 +-
include/libvirt/libvirt-network.h | 2 +
src/conf/network_conf.c | 148 ++++++++++++++++++++++++------
tools/virsh-network.c | 4 +-
4 files changed, 126 insertions(+), 33 deletions(-)
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 115b802c45..dc91ba895c 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -5908,7 +5908,10 @@ changes optionally taking effect immediately, without needing to
destroy and re-start the network.
*command* is one of "add-first", "add-last", "add" (a synonym for
-add-last), "delete", or "modify".
+add-last), "delete", "modify", "modify-or-add" (modify + add-last),
+"modify-or-add-first". The 'modify-or-add' commands perform modify or
+add operation depending on the given state, and can be useful for
+scripting.
*section* is one of "bridge", "domain", "ip", "ip-dhcp-host",
"ip-dhcp-range", "forward", "forward-interface", "forward-pf",
diff --git a/include/libvirt/libvirt-network.h b/include/libvirt/libvirt-network.h
index 58591be7ac..a6e132f407 100644
--- a/include/libvirt/libvirt-network.h
+++ b/include/libvirt/libvirt-network.h
@@ -181,6 +181,8 @@ typedef enum {
VIR_NETWORK_UPDATE_COMMAND_DELETE = 2, /* delete an existing element (Since: 0.10.2) */
VIR_NETWORK_UPDATE_COMMAND_ADD_LAST = 3, /* add an element at end of list (Since: 0.10.2) */
VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST = 4, /* add an element at start of list (Since: 0.10.2) */
+ VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST = 5, /* if exists modify or add an element at end of list (Since: 0.10.2) */
+ VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST = 6, /* if exists modify or add an element at start of list (Since: 0.10.2) */
# ifdef VIR_ENUM_SENTINELS
VIR_NETWORK_UPDATE_COMMAND_LAST /* (Since: 0.10.2) */
# endif
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index cc92ed0b03..2835395385 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2721,6 +2721,9 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDef *def,
virNetworkDHCPHostDef host = { 0 };
bool partialOkay = (command == VIR_NETWORK_UPDATE_COMMAND_DELETE);
+ /* added for modify-or-add feature */
+ bool modified = false;
+
if (virNetworkDefUpdateCheckElementName(def, ctxt->node, "host") < 0)
goto cleanup;
@@ -2826,7 +2829,34 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDef *def,
virNetworkDHCPHostDefClear(&ipdef->hosts[i]);
VIR_DELETE_ELEMENT(ipdef->hosts, i, ipdef->nhosts);
- } else {
+ } else if ((command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)) {
+
+ /* find entries with matching name/address/ip */
+ for (i = 0; i < ipdef->nhosts; i++) {
+ if ((host.mac && ipdef->hosts[i].mac &&
+ !virMacAddrCompare(host.mac, ipdef->hosts[i].mac)) ||
+ (host.name &&
+ STREQ_NULLABLE(host.name, ipdef->hosts[i].name)) ||
+ (VIR_SOCKET_ADDR_VALID(&host.ip) &&
+ virSocketAddrEqual(&host.ip, &ipdef->hosts[i].ip))) {
+
+ modified = true;
+ break;
+ }
+ }
+
+ /* if element is found then modify, or else add to beginning/end of list */
+ if (modified) {
+ virNetworkDHCPHostDefClear(&ipdef->hosts[i]);
+ ipdef->hosts[i] = host;
+ memset(&host, 0, sizeof(host));
+ } else if (VIR_INSERT_ELEMENT(ipdef->hosts,
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST
+ ? 0 : ipdef->nhosts,
+ ipdef->nhosts, host) < 0)
+ goto cleanup;
+ } else {
virNetworkDefUpdateUnknownCommand(command);
goto cleanup;
}
@@ -2885,7 +2915,9 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDef *def,
}
if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
- (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)) {
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)) {
if (virNetworkDefUpdateCheckMultiDHCP(def, ipdef) < 0)
return -1;
@@ -2894,17 +2926,24 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDef *def,
g_autofree char *startip = virSocketAddrFormat(&range.addr.start);
g_autofree char *endip = virSocketAddrFormat(&range.addr.end);
- virReportError(VIR_ERR_OPERATION_INVALID,
- _("there is an existing dhcp range entry in network '%1$s' that matches \"<range start='%2$s' end='%3$s'/>\""),
- def->name,
- startip ? startip : "unknown",
- endip ? endip : "unknown");
+
+ if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST))
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("there is an existing dhcp range entry in network '%1$s' that matches \"<range start='%2$s' end='%3$s'/>\""),
+ def->name,
+ startip ? startip : "unknown",
+ endip ? endip : "unknown");
+ else
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("dhcp ranges cannot be modified, only added or deleted"));
return -1;
}
/* add to beginning/end of list */
if (VIR_INSERT_ELEMENT(ipdef->ranges,
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)
? 0 : ipdef->nranges,
ipdef->nranges, range) < 0)
return -1;
@@ -2981,18 +3020,26 @@ virNetworkDefUpdateForwardInterface(virNetworkDef *def,
}
if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
- (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)) {
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)) {
if (i < def->forward.nifs) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- _("there is an existing interface entry in network '%1$s' that matches \"<interface dev='%2$s'>\""),
- def->name, iface.device.dev);
+ if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST) ||
+ command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST)
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("there is an existing interface entry in network '%1$s' that matches \"<interface dev='%2$s'>\""),
+ def->name, iface.device.dev);
+ else
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("forward interface entries cannot be modified, only added or deleted"));
goto cleanup;
}
/* add to beginning/end of list */
if (VIR_INSERT_ELEMENT(def->forward.ifs,
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)
? 0 : def->forward.nifs,
def->forward.nifs, iface) < 0)
goto cleanup;
@@ -3056,6 +3103,9 @@ virNetworkDefUpdatePortGroup(virNetworkDef *def,
int ret = -1;
virPortGroupDef portgroup = { 0 };
+ /* added for modify-or-add feature */
+ bool modified = false;
+
if (virNetworkDefUpdateCheckElementName(def, ctxt->node, "portgroup") < 0)
goto cleanup;
@@ -3097,6 +3147,17 @@ virNetworkDefUpdatePortGroup(virNetworkDef *def,
goto cleanup;
}
+ /* modify found entries for modify-or-add command */
+ if (foundName >= 0 && (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)) {
+
+ /* replace existing entry */
+ virPortGroupDefClear(&def->portGroups[foundName]);
+ def->portGroups[foundName] = portgroup;
+ memset(&portgroup, 0, sizeof(portgroup));
+ modified = true;
+ }
+
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
/* replace existing entry */
@@ -3105,11 +3166,14 @@ virNetworkDefUpdatePortGroup(virNetworkDef *def,
memset(&portgroup, 0, sizeof(portgroup));
} else if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
- (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)) {
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST) ||
+ (!modified && command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST) ||
+ (!modified && command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)) {
/* add to beginning/end of list */
if (VIR_INSERT_ELEMENT(def->portGroups,
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)
? 0 : def->nPortGroups,
def->nPortGroups, portgroup) < 0)
goto cleanup;
@@ -3144,7 +3208,9 @@ virNetworkDefUpdateDNSHost(virNetworkDef *def,
virNetworkDNSDef *dns = &def->dns;
virNetworkDNSHostDef host = { 0 };
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
+ command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST);
int foundCt = 0;
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
@@ -3185,15 +3251,21 @@ virNetworkDefUpdateDNSHost(virNetworkDef *def,
if (isAdd) {
if (foundCt > 0) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- _("there is already at least one DNS HOST record with a matching field in network %1$s"),
- def->name);
+ if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
+ command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("there is already at least one DNS HOST record with a matching field in network %1$s"),
+ def->name);
+ else
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("DNS HOST records cannot be modified, only added or deleted"));
goto cleanup;
}
/* add to beginning/end of list */
if (VIR_INSERT_ELEMENT(dns->hosts,
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)
? 0 : dns->nhosts, dns->nhosts, host) < 0)
goto cleanup;
} else if (command == VIR_NETWORK_UPDATE_COMMAND_DELETE) {
@@ -3240,7 +3312,9 @@ virNetworkDefUpdateDNSSrv(virNetworkDef *def,
virNetworkDNSDef *dns = &def->dns;
virNetworkDNSSrvDef srv = { 0 };
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
+ command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST);
int foundCt = 0;
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
@@ -3268,15 +3342,21 @@ virNetworkDefUpdateDNSSrv(virNetworkDef *def,
if (isAdd) {
if (foundCt > 0) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- _("there is already at least one DNS SRV record matching all specified fields in network %1$s"),
- def->name);
+ if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST))
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("there is already at least one DNS SRV record matching all specified fields in network %1$s"),
+ def->name);
+ else
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("DNS SRV records cannot be modified, only added or deleted"));
goto cleanup;
}
/* add to beginning/end of list */
if (VIR_INSERT_ELEMENT(dns->srvs,
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)
? 0 : dns->nsrvs, dns->nsrvs, srv) < 0)
goto cleanup;
} else if (command == VIR_NETWORK_UPDATE_COMMAND_DELETE) {
@@ -3322,7 +3402,9 @@ virNetworkDefUpdateDNSTxt(virNetworkDef *def,
virNetworkDNSDef *dns = &def->dns;
virNetworkDNSTxtDef txt = { 0 };
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
+ command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST);
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
@@ -3344,15 +3426,21 @@ virNetworkDefUpdateDNSTxt(virNetworkDef *def,
if (isAdd) {
if (foundIdx < dns->ntxts) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- _("there is already a DNS TXT record with name '%1$s' in network %2$s"),
- txt.name, def->name);
+ if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST))
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("there is already a DNS TXT record with name '%1$s' in network %2$s"),
+ txt.name, def->name);
+ else
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("DNS TXT records cannot be modified, only added or deleted"));
goto cleanup;
}
/* add to beginning/end of list */
if (VIR_INSERT_ELEMENT(dns->txts,
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)
? 0 : dns->ntxts, dns->ntxts, txt) < 0)
goto cleanup;
} else if (command == VIR_NETWORK_UPDATE_COMMAND_DELETE) {
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index 597e3d4530..c30305ac50 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -1231,7 +1231,7 @@ static const vshCmdOptDef opts_network_update[] = {
.positional = true,
.required = true,
.completer = virshNetworkUpdateCommandCompleter,
- .help = N_("type of update (add-first, add-last (add), delete, or modify)")
+ .help = N_("type of update (add-first, add-last (add), delete, modify, modify-or-add, or modify-or-add-first)")
},
{.name = "section",
.type = VSH_OT_STRING,
@@ -1260,7 +1260,7 @@ static const vshCmdOptDef opts_network_update[] = {
VIR_ENUM_IMPL(virshNetworkUpdateCommand,
VIR_NETWORK_UPDATE_COMMAND_LAST,
- "none", "modify", "delete", "add-last", "add-first");
+ "none", "modify", "delete", "add-last", "add-first", "modify-or-add", "modify-or-add-first");
VIR_ENUM_IMPL(virshNetworkSection,
VIR_NETWORK_SECTION_LAST,
--
2.44.0
10 months
[PATCH 00/35] vsh: Fix handling of commands and help - part 3 (virsh testing overhaul)
by Peter Krempa
Part 3 was supposed to be the refactor of the command parser but since
I wanted to add few tests I've noticed that there's a lot of old cruft
and many tests are skipped.
This series refactors virshtest and optimizes it to run multiple
commands with one virsh instance. Doing this allows us to do more
testing in the same run time allowing us to reduce the amount of
"expensive" tests.
Further down this removes all of the 'shell' test infra which was used
for virsh.
Peter Krempa (35):
virshtest: Prepare for testing against output files
virshtest: Allow to test failure of commands
virshtest: Filter multiple occurences of string to drop in
testFilterLine
virshtest: Add support for testing commands read from input file and
adapt alias tests
virshtest: Adapt 'echo --split' tests to DO_TEST_SCRIPT
virshtest: Drop some redundant 'echo' cases
virshtest: Adapt some 'escaping' tests via DO_TEST_SCRIPT
vrishtest: Prepare for simpler testing - echo tests
virshtest: Test against output files ("echo" tests)
virshtest: Drop string form of expected output data of "echo" tests
virshtest: Replace list and nodeinfo tests by equivalent
VIR_TEST_SCRIPT variant
virshtest: Adapt tests for domain id lookup and state query to
DO_TEST_SCRIPT
virshtest: Adapt 'blkiotune' tests to DO_TEST_SCRIPT
virshtest: Adapt 'iothread' tests to DO_TEST_SCRIPT
virshtest: Drop support for testing against hardcoded strings
virshtest: Adapt argument parsing tests from 'virsh-optparse'
virshtest: Adapt 'snapshot-create-as' arg handling tests from
'virsh-optparse'
virshtest: Adapt numeric option arg handling tests from
'virsh-optparse'
virshtest: Adapt 'event' option arg handling tests from
'virsh-optparse'
virshtest: Reimplement 'virsh-output' test
qemuxmlconftest: Adapt XMLs from 'virsh-cpuset' and
'virsh-define-dev-segfault' cases
virshtest: Adapt 'virsh-vcpupin' test
virshtest: Adapt 'virsh-int-overflow'
virshtest: Adapt 'virsh-schedinfo'
virshtest: Adapt 'virsh-start' and 'virsh-undefine' tests as
'lifecycle' case
virsh: Fix '--name' and '--parent' used together in
'(snapshot|checkpoint)-list' command
vsh: Allow non-interactive use of 'cd' command
virshtest: Adapt 'virsh-snapshot' test
virshtest: Adapt 'virsh-checkpoint' test
virshtest: Adapt 'virsh-read-bufsiz' and 'virsh-read-non-seekable'
virshtest: Adapt 'libvirtd-pool'
tests: Re-implement '(virsh|virt-admin)-self-test' directly in meson
tests: Reimplement 'libvirtd-fail' case directly in meson
virshtest: Adapt virsh-uriprecedence test case
tests: Drop 'test-lib.sh'
build-aux/syntax-check.mk | 6 +-
docs/manpages/virsh.rst | 17 +-
src/meson.build | 5 +
tests/libvirtd-fail | 16 -
tests/libvirtd-pool | 38 -
tests/meson.build | 39 +-
.../console-compat-crash.x86_64-latest.args | 46 +
.../console-compat-crash.x86_64-latest.xml | 65 ++
.../console-compat-crash.xml} | 36 +-
.../cpuset-invalid.x86_64-latest.err | 1 +
tests/qemuxmlconfdata/cpuset-invalid.xml | 12 +
tests/qemuxmlconftest.c | 2 +
tests/test-lib.sh | 280 ------
tests/virsh-checkpoint | 178 ----
tests/virsh-cpuset | 46 -
tests/virsh-int-overflow | 18 -
tests/virsh-optparse | 292 ------
tests/virsh-output | 29 -
tests/virsh-output-commands | 94 --
tests/virsh-output.out | 496 ----------
tests/virsh-read-bufsiz | 49 -
tests/virsh-read-non-seekable | 51 -
tests/virsh-schedinfo | 40 -
tests/virsh-self-test | 48 -
tests/virsh-snapshot | 233 -----
tests/virsh-start | 41 -
tests/virsh-undefine | 76 --
tests/virsh-uriprecedence | 97 --
tests/virsh-vcpupin | 100 --
tests/virshtest.c | 878 +++++++-----------
tests/virshtestdata/argument-assignment.in | 15 +
tests/virshtestdata/argument-assignment.out | 91 ++
tests/virshtestdata/attach-disk.in | 79 ++
tests/virshtestdata/attach-disk.out | 343 +++++++
tests/virshtestdata/blkiotune.in | 3 +
tests/virshtestdata/blkiotune.out | 15 +
tests/virshtestdata/checkpoint-c2.xml | 41 +
tests/virshtestdata/checkpoint-c3.xml | 38 +
tests/virshtestdata/checkpoint-redefine.out | 13 +
tests/virshtestdata/checkpoint.in | 35 +
tests/virshtestdata/checkpoint.out | 133 +++
tests/virshtestdata/dash-dash-argument-1.out | 1 +
tests/virshtestdata/dash-dash-argument-2.out | 1 +
tests/virshtestdata/dash-dash-argument-3.out | 1 +
tests/virshtestdata/dash-dash-argument-4.out | 1 +
tests/virshtestdata/dash-dash-argument-5.out | 1 +
tests/virshtestdata/dash-dash-argument-6.out | 1 +
tests/virshtestdata/domain-id-overflow.out | 3 +
tests/virshtestdata/domain-id.in | 18 +
tests/virshtestdata/domain-id.out | 73 ++
tests/virshtestdata/echo-alias-argv.out | 1 +
tests/virshtestdata/echo-alias.in | 3 +
tests/virshtestdata/echo-alias.out | 3 +
tests/virshtestdata/echo-escaping-1.out | 2 +
tests/virshtestdata/echo-escaping-2.out | 2 +
tests/virshtestdata/echo-escaping-3.out | 2 +
tests/virshtestdata/echo-escaping.in | 11 +
tests/virshtestdata/echo-escaping.out | 11 +
tests/virshtestdata/echo-quote-removal-1.out | 1 +
tests/virshtestdata/echo-quote-removal-2.out | 1 +
tests/virshtestdata/echo-quote-removal-3.out | 1 +
tests/virshtestdata/echo-quote-removal-4.out | 1 +
tests/virshtestdata/echo-quote-removal-5.out | 1 +
tests/virshtestdata/echo-quote-removal-6.out | 1 +
tests/virshtestdata/echo-quote-removal-7.out | 2 +
tests/virshtestdata/echo-quote-removal-8.out | 1 +
tests/virshtestdata/echo-split.in | 5 +
tests/virshtestdata/echo-split.out | 24 +
tests/virshtestdata/info-custom.in | 2 +
tests/virshtestdata/info-custom.out | 15 +
tests/virshtestdata/info-default.in | 2 +
tests/virshtestdata/info-default.out | 13 +
tests/virshtestdata/iothreads.in | 14 +
tests/virshtestdata/iothreads.out | 51 +
tests/virshtestdata/lifecycle.in | 23 +
tests/virshtestdata/lifecycle.out | 106 +++
tests/virshtestdata/multiple-commands-1.out | 2 +
tests/virshtestdata/multiple-commands-10.out | 1 +
tests/virshtestdata/multiple-commands-11.out | 1 +
tests/virshtestdata/multiple-commands-12.out | 1 +
tests/virshtestdata/multiple-commands-2.out | 2 +
tests/virshtestdata/multiple-commands-3.out | 2 +
tests/virshtestdata/multiple-commands-4.out | 2 +
tests/virshtestdata/multiple-commands-5.out | 3 +
tests/virshtestdata/multiple-commands-6.out | 1 +
tests/virshtestdata/multiple-commands-7.out | 2 +
tests/virshtestdata/multiple-commands-8.out | 2 +
tests/virshtestdata/multiple-commands-9.out | 1 +
tests/virshtestdata/numeric-parsing-event.in | 26 +
tests/virshtestdata/numeric-parsing-event.out | 10 +
tests/virshtestdata/numeric-parsing.in | 43 +
tests/virshtestdata/numeric-parsing.out | 12 +
tests/virshtestdata/pool-define-as.out | 12 +
tests/virshtestdata/read-big-pipe.out | 7 +
.../schedinfo-invalid-argument.out | 5 +
tests/virshtestdata/snapshot-create-args.in | 9 +
tests/virshtestdata/snapshot-create-args.out | 82 ++
tests/virshtestdata/snapshot-redefine.out | 17 +
tests/virshtestdata/snapshot-s2.xml | 43 +
tests/virshtestdata/snapshot-s3.xml | 40 +
tests/virshtestdata/snapshot.in | 54 ++
tests/virshtestdata/snapshot.out | 173 ++++
.../uriprecedence-LIBVIRT_DEFAULT_URI.out | 5 +
...riprecedence-VIRSH_DEFAULT_CONNECT_URI.out | 5 +
tests/virshtestdata/uriprecedence-param.out | 5 +
.../uriprecedence-xdg-config.out | 5 +
.../bad/libvirt/libvirt.conf | 1 +
.../good/libvirt/libvirt.conf | 1 +
tests/virshtestdata/vcpupin.in | 23 +
tests/virshtestdata/vcpupin.out | 26 +
tests/virt-admin-self-test | 1 -
tools/meson.build | 4 +-
tools/virsh-checkpoint.c | 18 +-
tools/virsh-snapshot.c | 18 +-
tools/vsh.c | 5 -
115 files changed, 2352 insertions(+), 2852 deletions(-)
delete mode 100755 tests/libvirtd-fail
delete mode 100755 tests/libvirtd-pool
create mode 100644 tests/qemuxmlconfdata/console-compat-crash.x86_64-latest.args
create mode 100644 tests/qemuxmlconfdata/console-compat-crash.x86_64-latest.xml
rename tests/{virsh-define-dev-segfault => qemuxmlconfdata/console-compat-crash.xml} (59%)
mode change 100755 => 100644
create mode 100644 tests/qemuxmlconfdata/cpuset-invalid.x86_64-latest.err
create mode 100644 tests/qemuxmlconfdata/cpuset-invalid.xml
delete mode 100644 tests/test-lib.sh
delete mode 100755 tests/virsh-checkpoint
delete mode 100755 tests/virsh-cpuset
delete mode 100755 tests/virsh-int-overflow
delete mode 100755 tests/virsh-optparse
delete mode 100755 tests/virsh-output
delete mode 100755 tests/virsh-output-commands
delete mode 100644 tests/virsh-output.out
delete mode 100755 tests/virsh-read-bufsiz
delete mode 100755 tests/virsh-read-non-seekable
delete mode 100755 tests/virsh-schedinfo
delete mode 100755 tests/virsh-self-test
delete mode 100755 tests/virsh-snapshot
delete mode 100755 tests/virsh-start
delete mode 100755 tests/virsh-undefine
delete mode 100755 tests/virsh-uriprecedence
delete mode 100755 tests/virsh-vcpupin
create mode 100644 tests/virshtestdata/argument-assignment.in
create mode 100644 tests/virshtestdata/argument-assignment.out
create mode 100755 tests/virshtestdata/attach-disk.in
create mode 100644 tests/virshtestdata/attach-disk.out
create mode 100644 tests/virshtestdata/blkiotune.in
create mode 100644 tests/virshtestdata/blkiotune.out
create mode 100644 tests/virshtestdata/checkpoint-c2.xml
create mode 100644 tests/virshtestdata/checkpoint-c3.xml
create mode 100644 tests/virshtestdata/checkpoint-redefine.out
create mode 100755 tests/virshtestdata/checkpoint.in
create mode 100644 tests/virshtestdata/checkpoint.out
create mode 100644 tests/virshtestdata/dash-dash-argument-1.out
create mode 100644 tests/virshtestdata/dash-dash-argument-2.out
create mode 100644 tests/virshtestdata/dash-dash-argument-3.out
create mode 100644 tests/virshtestdata/dash-dash-argument-4.out
create mode 100644 tests/virshtestdata/dash-dash-argument-5.out
create mode 100644 tests/virshtestdata/dash-dash-argument-6.out
create mode 100644 tests/virshtestdata/domain-id-overflow.out
create mode 100644 tests/virshtestdata/domain-id.in
create mode 100644 tests/virshtestdata/domain-id.out
create mode 100644 tests/virshtestdata/echo-alias-argv.out
create mode 100644 tests/virshtestdata/echo-alias.in
create mode 100644 tests/virshtestdata/echo-alias.out
create mode 100644 tests/virshtestdata/echo-escaping-1.out
create mode 100644 tests/virshtestdata/echo-escaping-2.out
create mode 100644 tests/virshtestdata/echo-escaping-3.out
create mode 100644 tests/virshtestdata/echo-escaping.in
create mode 100644 tests/virshtestdata/echo-escaping.out
create mode 100644 tests/virshtestdata/echo-quote-removal-1.out
create mode 100644 tests/virshtestdata/echo-quote-removal-2.out
create mode 100644 tests/virshtestdata/echo-quote-removal-3.out
create mode 100644 tests/virshtestdata/echo-quote-removal-4.out
create mode 100644 tests/virshtestdata/echo-quote-removal-5.out
create mode 100644 tests/virshtestdata/echo-quote-removal-6.out
create mode 100644 tests/virshtestdata/echo-quote-removal-7.out
create mode 100644 tests/virshtestdata/echo-quote-removal-8.out
create mode 100644 tests/virshtestdata/echo-split.in
create mode 100644 tests/virshtestdata/echo-split.out
create mode 100644 tests/virshtestdata/info-custom.in
create mode 100644 tests/virshtestdata/info-custom.out
create mode 100644 tests/virshtestdata/info-default.in
create mode 100644 tests/virshtestdata/info-default.out
create mode 100644 tests/virshtestdata/iothreads.in
create mode 100644 tests/virshtestdata/iothreads.out
create mode 100644 tests/virshtestdata/lifecycle.in
create mode 100644 tests/virshtestdata/lifecycle.out
create mode 100644 tests/virshtestdata/multiple-commands-1.out
create mode 100644 tests/virshtestdata/multiple-commands-10.out
create mode 100644 tests/virshtestdata/multiple-commands-11.out
create mode 100644 tests/virshtestdata/multiple-commands-12.out
create mode 100644 tests/virshtestdata/multiple-commands-2.out
create mode 100644 tests/virshtestdata/multiple-commands-3.out
create mode 100644 tests/virshtestdata/multiple-commands-4.out
create mode 100644 tests/virshtestdata/multiple-commands-5.out
create mode 100644 tests/virshtestdata/multiple-commands-6.out
create mode 100644 tests/virshtestdata/multiple-commands-7.out
create mode 100644 tests/virshtestdata/multiple-commands-8.out
create mode 100644 tests/virshtestdata/multiple-commands-9.out
create mode 100644 tests/virshtestdata/numeric-parsing-event.in
create mode 100644 tests/virshtestdata/numeric-parsing-event.out
create mode 100644 tests/virshtestdata/numeric-parsing.in
create mode 100644 tests/virshtestdata/numeric-parsing.out
create mode 100644 tests/virshtestdata/pool-define-as.out
create mode 100644 tests/virshtestdata/read-big-pipe.out
create mode 100644 tests/virshtestdata/schedinfo-invalid-argument.out
create mode 100644 tests/virshtestdata/snapshot-create-args.in
create mode 100644 tests/virshtestdata/snapshot-create-args.out
create mode 100644 tests/virshtestdata/snapshot-redefine.out
create mode 100644 tests/virshtestdata/snapshot-s2.xml
create mode 100644 tests/virshtestdata/snapshot-s3.xml
create mode 100755 tests/virshtestdata/snapshot.in
create mode 100644 tests/virshtestdata/snapshot.out
create mode 100644 tests/virshtestdata/uriprecedence-LIBVIRT_DEFAULT_URI.out
create mode 100644 tests/virshtestdata/uriprecedence-VIRSH_DEFAULT_CONNECT_URI.out
create mode 100644 tests/virshtestdata/uriprecedence-param.out
create mode 100644 tests/virshtestdata/uriprecedence-xdg-config.out
create mode 100644 tests/virshtestdata/uriprecedence-xdg/bad/libvirt/libvirt.conf
create mode 100644 tests/virshtestdata/uriprecedence-xdg/good/libvirt/libvirt.conf
create mode 100755 tests/virshtestdata/vcpupin.in
create mode 100644 tests/virshtestdata/vcpupin.out
delete mode 120000 tests/virt-admin-self-test
--
2.44.0
10 months, 1 week
[PATCH 0/4] Introduce SSH proxy
by Michal Privoznik
*** BLURB HERE ***
Michal Prívozník (4):
datatypes: Declare g_autoptr cleanup functions for more public objects
tools: Introduce SSH proxy
docs: Document SSH proxy
NEWS: Document SSH proxy feature
NEWS.rst | 5 +
docs/docs.rst | 3 +
docs/meson.build | 1 +
docs/nss.rst | 7 +
docs/ssh-proxy.rst | 60 +++++
libvirt.spec.in | 27 +++
meson.build | 16 +-
meson_options.txt | 2 +
po/POTFILES | 1 +
src/datatypes.h | 16 ++
tools/meson.build | 2 +
tools/ssh-proxy/30-libvirt-ssh-proxy.conf.in | 10 +
tools/ssh-proxy/meson.build | 25 ++
tools/ssh-proxy/ssh-proxy.c | 233 +++++++++++++++++++
14 files changed, 407 insertions(+), 1 deletion(-)
create mode 100644 docs/ssh-proxy.rst
create mode 100644 tools/ssh-proxy/30-libvirt-ssh-proxy.conf.in
create mode 100644 tools/ssh-proxy/meson.build
create mode 100644 tools/ssh-proxy/ssh-proxy.c
--
2.43.2
10 months, 1 week
[PATCH] qemu_saveimage: add zstd to supported compression formats
by Adam Julis
Extend the list of supported formats, update and clarify comment
in qemu.conf.in (removed misleading sentence about the order of
compression format types).
Signed-off-by: Adam Julis <ajulis(a)redhat.com>
---
libvirt.spec.in | 1 +
src/qemu/qemu.conf.in | 7 +++----
src/qemu/qemu_saveimage.c | 2 ++
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 64018192b6..88c62f6d92 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -815,6 +815,7 @@ Requires: gzip
Requires: bzip2
Requires: lzop
Requires: xz
+Requires: zstd
Requires: systemd-container
Requires: swtpm-tools
%if %{with_numad}
diff --git a/src/qemu/qemu.conf.in b/src/qemu/qemu.conf.in
index f406df8749..6bc2140dcb 100644
--- a/src/qemu/qemu.conf.in
+++ b/src/qemu/qemu.conf.in
@@ -582,10 +582,9 @@
# memory from the domain is dumped out directly to a file. If you have
# guests with a large amount of memory, however, this can take up quite
# a bit of space. If you would like to compress the images while they
-# are being saved to disk, you can also set "lzop", "gzip", "bzip2", or "xz"
-# for save_image_format. Note that this means you slow down the process of
-# saving a domain in order to save disk space; the list above is in descending
-# order by performance and ascending order by compression ratio.
+# are being saved to disk, you can also set "zstd", "lzop", "gzip", "bzip2",
+# or "xz" for save_image_format. Note that this means you slow down the process
+# of saving a domain in order to save disk space.
#
# save_image_format is used when you use 'virsh save' or 'virsh managedsave'
# at scheduled saving, and it is an error if the specified save_image_format
diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c
index 89112e3e44..018ab5a222 100644
--- a/src/qemu/qemu_saveimage.c
+++ b/src/qemu/qemu_saveimage.c
@@ -47,6 +47,7 @@ typedef enum {
*/
QEMU_SAVE_FORMAT_XZ = 3,
QEMU_SAVE_FORMAT_LZOP = 4,
+ QEMU_SAVE_FORMAT_ZSTD = 5,
/* Note: add new members only at the end.
These values are used in the on-disk format.
Do not change or re-use numbers. */
@@ -62,6 +63,7 @@ VIR_ENUM_IMPL(qemuSaveCompression,
"bzip2",
"xz",
"lzop",
+ "zstd",
);
static inline void
--
2.44.0
10 months, 1 week
[PATCH v2 0/4] qemu: Substract isolcpus from all online affinity
by Michal Privoznik
v2 of:
https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/4V...
diff to v1:
- Don't error out on systems where /sys/devices/system/cpu/isolated is
unavailable.
- Don't error out on systems where /sys/devices/system/cpu/isolated is
empty.
Both of these resulted in new patches.
Michal Prívozník (4):
virbitmap: Introduce virBitmapParseUnlimitedAllowEmpty()
virfile: Introduce virFileReadValueBitmapAllowEmpty()
virhostcpu: Introduce virHostCPUGetIsolated()
qemu: Substract isolcpus from all online affinity
src/libvirt_private.syms | 3 ++
src/qemu/qemu_process.c | 9 +++++
src/util/virbitmap.c | 40 +++++++++++++++++---
src/util/virbitmap.h | 3 ++
src/util/virfile.c | 81 ++++++++++++++++++++++++++++++----------
src/util/virfile.h | 2 +
src/util/virhostcpu.c | 31 +++++++++++++++
src/util/virhostcpu.h | 1 +
tests/virbitmaptest.c | 40 ++++++++++++++++++++
9 files changed, 186 insertions(+), 24 deletions(-)
--
2.43.2
10 months, 1 week
[PATCH] libxl: Fix domxml-to-native conversion
by Jim Fehlig
Similar to commit 57d084febe, another case of the libxl driver not
adapting to modular daemons. When converting configuration that
contains a type='network' interface, the converter calls
virNetworkLookupByName, passing the hypervisor connection object
instead of a connection to virtnetworkd. E.g.
> cat dom.xml
...
<interface type='network'>
<source network='default'/>
</interface>
...
> virsh net-info default
Name: default
UUID: 25a5b089-1e71-4956-99aa-df2213bbb407
Active: yes
Persistent: no
Autostart: no
Bridge: virbr0
> virsh domxml-to-native xen-xl dom.xml
error: Network not found: default
Acquire a connection to virtnetworkd and use it when calling
virNetwork* APIs.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_driver.c | 4 ++--
src/libxl/xen_common.c | 25 +++++++++++++++----------
src/libxl/xen_common.h | 1 -
src/libxl/xen_xl.c | 4 ++--
src/libxl/xen_xl.h | 2 +-
src/libxl/xen_xm.c | 5 ++---
src/libxl/xen_xm.h | 2 +-
tests/xlconfigtest.c | 7 +------
tests/xmconfigtest.c | 7 +------
9 files changed, 25 insertions(+), 32 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index e42a3dc0a9..4d5eb920bf 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -2709,10 +2709,10 @@ libxlConnectDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
goto cleanup;
if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XL)) {
- if (!(conf = xenFormatXL(def, conn)))
+ if (!(conf = xenFormatXL(def)))
goto cleanup;
} else if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XM)) {
- if (!(conf = xenFormatXM(conn, def)))
+ if (!(conf = xenFormatXM(def)))
goto cleanup;
} else {
diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index 79eb593432..0b2346d8b5 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -24,6 +24,7 @@
#include <config.h>
+#include "driver.h"
#include "internal.h"
#include "virerror.h"
#include "virconf.h"
@@ -1586,8 +1587,7 @@ xenMakeIPList(virNetDevIPInfo *guestIP)
}
static int
-xenFormatNet(virConnectPtr conn,
- virConfValue *list,
+xenFormatNet(virConfValue *list,
virDomainNetDef *net,
int hvm,
const char *vif_typename)
@@ -1649,13 +1649,21 @@ xenFormatNet(virConnectPtr conn,
case VIR_DOMAIN_NET_TYPE_NETWORK:
{
- virNetworkPtr network = virNetworkLookupByName(conn, net->data.network.name);
+ virConnectPtr conn = NULL;
+ virNetworkPtr network;
char *bridge;
- if (!network) {
+
+ if (!(conn = virGetConnectNetwork()))
+ return -1;
+
+ if (!(network = virNetworkLookupByName(conn, net->data.network.name))) {
virReportError(VIR_ERR_NO_NETWORK, "%s",
net->data.network.name);
+ virObjectUnref(conn);
return -1;
}
+ virObjectUnref(conn);
+
bridge = virNetworkGetBridgeName(network);
virObjectUnref(network);
if (!bridge) {
@@ -2304,7 +2312,6 @@ xenFormatSound(virConf *conf, virDomainDef *def)
static int
xenFormatVif(virConf *conf,
- virConnectPtr conn,
virDomainDef *def,
const char *vif_typename)
{
@@ -2317,8 +2324,7 @@ xenFormatVif(virConf *conf,
netVal->list = NULL;
for (i = 0; i < def->nnets; i++) {
- if (xenFormatNet(conn, netVal, def->nets[i],
- hvm, vif_typename) < 0)
+ if (xenFormatNet(netVal, def->nets[i], hvm, vif_typename) < 0)
return -1;
}
@@ -2336,7 +2342,6 @@ xenFormatVif(virConf *conf,
int
xenFormatConfigCommon(virConf *conf,
virDomainDef *def,
- virConnectPtr conn,
const char *nativeFormat)
{
if (xenFormatGeneralMeta(conf, def) < 0)
@@ -2364,10 +2369,10 @@ xenFormatConfigCommon(virConf *conf,
return -1;
if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XL)) {
- if (xenFormatVif(conf, conn, def, "vif") < 0)
+ if (xenFormatVif(conf, def, "vif") < 0)
return -1;
} else if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XM)) {
- if (xenFormatVif(conf, conn, def, "netfront") < 0)
+ if (xenFormatVif(conf, def, "netfront") < 0)
return -1;
} else {
virReportError(VIR_ERR_INVALID_ARG,
diff --git a/src/libxl/xen_common.h b/src/libxl/xen_common.h
index b21046e959..95408fa896 100644
--- a/src/libxl/xen_common.h
+++ b/src/libxl/xen_common.h
@@ -61,7 +61,6 @@ int xenParseConfigCommon(virConf *conf,
int xenFormatConfigCommon(virConf *conf,
virDomainDef *def,
- virConnectPtr conn,
const char *nativeFormat);
char *xenMakeIPList(virNetDevIPInfo *guestIP);
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index f175359307..53f6871efc 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -2041,14 +2041,14 @@ xenFormatXLDomainNamespaceData(virConf *conf, virDomainDef *def)
}
virConf *
-xenFormatXL(virDomainDef *def, virConnectPtr conn)
+xenFormatXL(virDomainDef *def)
{
g_autoptr(virConf) conf = NULL;
if (!(conf = virConfNew()))
return NULL;
- if (xenFormatConfigCommon(conf, def, conn, XEN_CONFIG_FORMAT_XL) < 0)
+ if (xenFormatConfigCommon(conf, def, XEN_CONFIG_FORMAT_XL) < 0)
return NULL;
if (xenFormatXLOS(conf, def) < 0)
diff --git a/src/libxl/xen_xl.h b/src/libxl/xen_xl.h
index f8b1ebfde9..028b359b76 100644
--- a/src/libxl/xen_xl.h
+++ b/src/libxl/xen_xl.h
@@ -29,6 +29,6 @@ virDomainDef *xenParseXL(virConf *conn,
virCaps *caps,
virDomainXMLOption *xmlopt);
-virConf *xenFormatXL(virDomainDef *def, virConnectPtr);
+virConf *xenFormatXL(virDomainDef *def);
const char *xenTranslateCPUFeature(const char *feature_name, bool from_libxl);
diff --git a/src/libxl/xen_xm.c b/src/libxl/xen_xm.c
index 5705a5ec0c..274b35153b 100644
--- a/src/libxl/xen_xm.c
+++ b/src/libxl/xen_xm.c
@@ -543,15 +543,14 @@ G_STATIC_ASSERT(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
* Convert a virDomainDef object into an XM config record.
*/
virConf *
-xenFormatXM(virConnectPtr conn,
- virDomainDef *def)
+xenFormatXM(virDomainDef *def)
{
g_autoptr(virConf) conf = NULL;
if (!(conf = virConfNew()))
return NULL;
- if (xenFormatConfigCommon(conf, def, conn, XEN_CONFIG_FORMAT_XM) < 0)
+ if (xenFormatConfigCommon(conf, def, XEN_CONFIG_FORMAT_XM) < 0)
return NULL;
if (xenFormatXMOS(conf, def) < 0)
diff --git a/src/libxl/xen_xm.h b/src/libxl/xen_xm.h
index afb4f51ff7..db2ae52581 100644
--- a/src/libxl/xen_xm.h
+++ b/src/libxl/xen_xm.h
@@ -26,7 +26,7 @@
#include "virconf.h"
#include "domain_conf.h"
-virConf *xenFormatXM(virConnectPtr conn, virDomainDef *def);
+virConf *xenFormatXM(virDomainDef *def);
virDomainDef *xenParseXM(virConf *conf,
virCaps *caps, virDomainXMLOption *xmlopt);
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 962a1f2c4b..00b6a355eb 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -65,17 +65,12 @@ testCompareParseXML(const char *xlcfg, const char *xml, bool replaceVars)
{
g_autofree char *gotxlcfgData = NULL;
g_autoptr(virConf) conf = NULL;
- g_autoptr(virConnect) conn = NULL;
int wrote = 4096;
g_autoptr(virDomainDef) def = NULL;
g_autofree char *replacedXML = NULL;
gotxlcfgData = g_new0(char, wrote);
- conn = virGetConnect();
- if (!conn)
- return -1;
-
if (replaceVars) {
if (!(replacedXML = testReplaceVarsXML(xml)))
return -1;
@@ -93,7 +88,7 @@ testCompareParseXML(const char *xlcfg, const char *xml, bool replaceVars)
return -1;
}
- if (!(conf = xenFormatXL(def, conn)))
+ if (!(conf = xenFormatXL(def)))
return -1;
if (virConfWriteMem(gotxlcfgData, &wrote, conf) < 0)
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index dbf9f7a4c7..30ad49f8b1 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -39,16 +39,11 @@ testCompareParseXML(const char *xmcfg, const char *xml)
{
g_autofree char *gotxmcfgData = NULL;
g_autoptr(virConf) conf = NULL;
- g_autoptr(virConnect) conn = NULL;
int wrote = 4096;
g_autoptr(virDomainDef) def = NULL;
gotxmcfgData = g_new0(char, wrote);
- conn = virGetConnect();
- if (!conn)
- return -1;
-
if (!(def = virDomainDefParseFile(xml, driver->xmlopt, NULL,
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
return -1;
@@ -58,7 +53,7 @@ testCompareParseXML(const char *xmcfg, const char *xml)
return -1;
}
- if (!(conf = xenFormatXM(conn, def)))
+ if (!(conf = xenFormatXM(def)))
return -1;
if (virConfWriteMem(gotxmcfgData, &wrote, conf) < 0)
--
2.44.0
10 months, 1 week
[PATCH v2 0/5] qemu: Introduce shared_filesystems configuration option
by Andrea Bolognani
The need to have something like this in the first place is driven by
KubeVirt (see [1] and [2]). A draft version of this series has been
integrated into KubeVirt and it has been confirmed that it was
effective in removing the need to use LD_PRELOAD hacks in the storage
provider.
Changes from [v1]:
* documented more explicitly that the newly introduced option is
intended for very specific scenarios and not general usage; as
part of this, the NEWS update has been dropped too;
* made a few tweaks and addressed a few oversight based on review
feedback;
* several preparatory cleanup patches have been pushed.
Changes from [v0]:
* reworked approach.
CC'ing Stefan so he can have a look at the TPM part and shout if I've
gotten anything wrong :)
[v1] https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/XE...
[v0] https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/MM...
[1] https://issues.redhat.com/browse/CNV-34322
[2] https://issues.redhat.com/browse/CNV-39370
Andrea Bolognani (5):
security: Fix alignment
qemu: Introduce shared_filesystems configuration option
qemu: Propagate shared_filesystems
utils: Use overrides in virFileIsSharedFS()
qemu: Always set labels for TPM state
src/lxc/lxc_controller.c | 3 +-
src/lxc/lxc_driver.c | 2 +-
src/lxc/lxc_process.c | 4 +-
src/qemu/libvirtd_qemu.aug | 3 ++
src/qemu/qemu.conf.in | 23 ++++++++
src/qemu/qemu_conf.c | 17 ++++++
src/qemu/qemu_conf.h | 2 +
src/qemu/qemu_domain.c | 7 ++-
src/qemu/qemu_extdevice.c | 2 +-
src/qemu/qemu_migration.c | 23 ++++----
src/qemu/qemu_security.c | 85 +++++++++++++++++++++++-------
src/qemu/qemu_tpm.c | 38 +++++++------
src/qemu/qemu_tpm.h | 10 ++--
src/qemu/test_libvirtd_qemu.aug.in | 5 ++
src/security/security_apparmor.c | 2 +
src/security/security_dac.c | 47 +++++++++++++----
src/security/security_driver.h | 8 ++-
src/security/security_manager.c | 33 +++++++++---
src/security/security_manager.h | 9 +++-
src/security/security_nop.c | 5 ++
src/security/security_selinux.c | 56 +++++++++++++++-----
src/security/security_stack.c | 32 ++++++++---
src/util/virfile.c | 53 +++++++++++++++++--
src/util/virfile.h | 3 +-
tests/securityselinuxlabeltest.c | 2 +-
tests/virfiletest.c | 2 +-
26 files changed, 370 insertions(+), 106 deletions(-)
--
2.44.0
10 months, 1 week
[PATCH v4 00/30] [PATCH v3 00/27] native support for nftables in virtual network driver
by Laine Stump
V3: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/HO...
V2: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/5R...
This patch series enables libvirt to use nftables rules rather than
iptables *when setting up virtual networks* (it does *not* add
nftables support to the nwfilter driver).
Changes from V3:
* Fixed a bug (newly added in V3) that resulted in the firewall name
attribute not being added to the XML.
* renamed the table to "libvirt_network" (new patch 28)
* renamed the chains to be more descriptive, and lower case rather
than all caps. (new patch 29)
* eliminated all the guest->host and host->guest rules since they are
redundant in nftables. (new patch 30)
Laine Stump (30):
util/network: move viriptables.[ch] from util to network directory
network: move all functions manipulating iptables rules into
network_iptables.c
network: make all iptables functions used only in network_iptables.c
static
util: #define the names used for private packet filter chains
util: change name of virFirewallRule to virFirewallCmd
util: rename virNetFilterAction to iptablesAction, and add
VIR_ENUM_DECL/IMPL
util: check for 0 args when applying iptables rule
util: add -w/--concurrent when applying a FirewallCmd rather than when
building it
util: determine ignoreErrors value when creating virFirewallCmd, not
when applying
util/network: new virFirewallBackend enum
network: add (empty) network.conf file to distribution files
network: support setting firewallBackend from network.conf
network: framework to call backend-specific function to init private
filter chains
util: new functions to support adding individual firewall rollback
commands
util: implement rollback rule autocreation for iptables commands
network: turn on auto-rollback for the rules added for virtual
networks
util: add name attribute to virFirewall
util: new function virFirewallNewFromRollback()
util: new functions virFirewallParseXML() and virFirewallFormat()
conf: add a virFirewall object to virNetworkObj
network: use previously saved list of firewall removal commands
network: save network status when firewall rules are reloaded
meson: stop looking for iptables/ip6tables/ebtables at build time
network: add an nftables backend for network driver's firewall
construction
tests: test cases for nftables backend
network: prefer the nftables backend over iptables
spec: require either iptables or nftables if network driver is
installed
network: name the nftables table "libvirt_network" rather than
"libvirt"
network: rename chains used by network driver nftables backend
network: eliminate pointless host input/output rules from nftables
backend
libvirt.spec.in | 7 +-
meson.build | 10 +-
meson_options.txt | 1 +
po/POTFILES | 3 +-
src/conf/virnetworkobj.c | 41 +
src/conf/virnetworkobj.h | 8 +
src/libvirt_private.syms | 58 +-
src/network/bridge_driver.c | 39 +-
src/network/bridge_driver_conf.c | 64 +
src/network/bridge_driver_conf.h | 3 +
src/network/bridge_driver_linux.c | 630 +------
src/network/bridge_driver_nop.c | 6 +-
src/network/bridge_driver_platform.h | 6 +-
src/network/libvirtd_network.aug | 39 +
src/network/meson.build | 36 +
src/network/network.conf.in | 28 +
src/network/network_iptables.c | 1677 +++++++++++++++++
src/network/network_iptables.h | 30 +
src/network/network_nftables.c | 968 ++++++++++
src/network/network_nftables.h | 28 +
src/network/test_libvirtd_network.aug.in | 5 +
src/nwfilter/nwfilter_ebiptables_driver.c | 1004 +++++-----
src/util/meson.build | 1 -
src/util/virebtables.c | 36 +-
src/util/virfirewall.c | 820 ++++++--
src/util/virfirewall.h | 87 +-
src/util/viriptables.c | 1072 -----------
src/util/viriptables.h | 155 --
.../{base.args => base.iptables} | 0
tests/networkxml2firewalldata/base.nftables | 256 +++
...-linux.args => nat-default-linux.iptables} | 0
.../nat-default-linux.nftables | 144 ++
...pv6-linux.args => nat-ipv6-linux.iptables} | 0
.../nat-ipv6-linux.nftables | 202 ++
...rgs => nat-ipv6-masquerade-linux.iptables} | 0
.../nat-ipv6-masquerade-linux.nftables | 274 +++
...linux.args => nat-many-ips-linux.iptables} | 0
.../nat-many-ips-linux.nftables | 368 ++++
...-linux.args => nat-no-dhcp-linux.iptables} | 0
.../nat-no-dhcp-linux.nftables | 202 ++
...ftp-linux.args => nat-tftp-linux.iptables} | 0
.../nat-tftp-linux.nftables | 144 ++
...inux.args => route-default-linux.iptables} | 0
.../route-default-linux.nftables | 58 +
tests/networkxml2firewalltest.c | 56 +-
tests/virfirewalltest.c | 424 ++---
46 files changed, 6239 insertions(+), 2751 deletions(-)
create mode 100644 src/network/libvirtd_network.aug
create mode 100644 src/network/network.conf.in
create mode 100644 src/network/network_iptables.c
create mode 100644 src/network/network_iptables.h
create mode 100644 src/network/network_nftables.c
create mode 100644 src/network/network_nftables.h
create mode 100644 src/network/test_libvirtd_network.aug.in
delete mode 100644 src/util/viriptables.c
delete mode 100644 src/util/viriptables.h
rename tests/networkxml2firewalldata/{base.args => base.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/base.nftables
rename tests/networkxml2firewalldata/{nat-default-linux.args => nat-default-linux.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/nat-default-linux.nftables
rename tests/networkxml2firewalldata/{nat-ipv6-linux.args => nat-ipv6-linux.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/nat-ipv6-linux.nftables
rename tests/networkxml2firewalldata/{nat-ipv6-masquerade-linux.args => nat-ipv6-masquerade-linux.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/nat-ipv6-masquerade-linux.nftables
rename tests/networkxml2firewalldata/{nat-many-ips-linux.args => nat-many-ips-linux.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/nat-many-ips-linux.nftables
rename tests/networkxml2firewalldata/{nat-no-dhcp-linux.args => nat-no-dhcp-linux.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/nat-no-dhcp-linux.nftables
rename tests/networkxml2firewalldata/{nat-tftp-linux.args => nat-tftp-linux.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/nat-tftp-linux.nftables
rename tests/networkxml2firewalldata/{route-default-linux.args => route-default-linux.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/route-default-linux.nftables
--
2.44.0
10 months, 1 week
[PATCH v3 0/6] migration removals & deprecations
by Fabiano Rosas
since v2:
- removed some more stuff which I missed:
blk/inc options from hmp-commands.hx
the entire ram-compress.h
unused declarations from options.h
unused compression functions from qemu-file.c
- removed must_remove_block_options earlier in the 'blk' patch
- added a deprecation warning to outgoing/incoming fd
CI run: https://gitlab.com/farosas/qemu/-/pipelines/1272385260
v2:
https://lore.kernel.org/r/20240426131408.25410-1-farosas@suse.de
v1:
https://lore.kernel.org/r/20240425150939.19268-1-farosas@suse.de
Hi everyone,
Here's some cleaning up of deprecated code. It removes the old block
migration and compression code. Both have suitable replacements in the
form of the blockdev-mirror driver and multifd compression,
respectively.
There's also a deprecation for fd: + file to cope with the fact that
the new MigrationAddress API defines transports instead of protocols
(loose terms) like the old string API did. So we cannot map 1:1 from
fd: to any transport because fd: allows *both* file migration and
socket migration.
Fabiano Rosas (6):
migration: Remove 'skipped' field from MigrationStats
migration: Remove 'inc' option from migrate command
migration: Remove 'blk/-b' option from migrate commands
migration: Remove block migration
migration: Remove non-multifd compression
migration: Deprecate fd: for file migration
.gitlab-ci.d/buildtest.yml | 2 +-
MAINTAINERS | 1 -
docs/about/deprecated.rst | 51 +-
docs/about/removed-features.rst | 103 +++
docs/devel/migration/main.rst | 2 +-
hmp-commands.hx | 17 +-
hw/core/machine.c | 1 -
include/migration/misc.h | 6 -
meson.build | 2 -
meson_options.txt | 2 -
migration/block.c | 1019 ------------------------------
migration/block.h | 52 --
migration/colo.c | 1 -
migration/fd.c | 12 +
migration/meson.build | 4 -
migration/migration-hmp-cmds.c | 97 +--
migration/migration.c | 70 +-
migration/migration.h | 11 -
migration/options.c | 229 -------
migration/options.h | 13 -
migration/qemu-file.c | 78 ---
migration/qemu-file.h | 4 -
migration/ram-compress.c | 564 -----------------
migration/ram-compress.h | 77 ---
migration/ram.c | 169 +----
migration/savevm.c | 5 -
qapi/migration.json | 205 +-----
scripts/meson-buildoptions.sh | 4 -
tests/qemu-iotests/183 | 147 -----
tests/qemu-iotests/183.out | 66 --
tests/qemu-iotests/common.filter | 7 -
tests/qtest/migration-test.c | 139 ----
32 files changed, 147 insertions(+), 3013 deletions(-)
delete mode 100644 migration/block.c
delete mode 100644 migration/block.h
delete mode 100644 migration/ram-compress.c
delete mode 100644 migration/ram-compress.h
delete mode 100755 tests/qemu-iotests/183
delete mode 100644 tests/qemu-iotests/183.out
base-commit: fd87be1dada5672f877e03c2ca8504458292c479
--
2.35.3
10 months, 1 week
[PATCH v2 0/3] qemu: Add support for virtio sound model
by Rayhan Faizel
virtio-sound-pci and virtio-sound-device were recently introduced
in QEMU 8.2.0.
The full documentation of the virtio sound implementation in QEMU
can be found here:
https://www.qemu.org/docs/master/system/devices/virtio-snd.html
Example:
<sound model='virtio' streams='2'/>
[Changes in v2]
- Added missing break statement that went overlooked.
Rayhan Faizel (3):
qemu_capabilities: Add QEMU_CAPS_DEVICE_VIRTIO_SOUND capability
conf: Introduce support for virtio-sound devices
qemu: Generate command line for sound devices with model 'virtio'
docs/formatdomain.rst | 11 ++++-
src/conf/domain_conf.c | 25 +++++++++++
src/conf/domain_conf.h | 4 ++
src/conf/domain_postparse.c | 13 +++++-
src/conf/schemas/domaincommon.rng | 11 +++++
src/libxl/libxl_domain.c | 1 +
src/qemu/qemu_capabilities.c | 3 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 25 ++++++++++-
src/qemu/qemu_domain_address.c | 9 ++++
src/qemu/qemu_validate.c | 8 ++++
.../caps_8.2.0_aarch64.xml | 1 +
.../caps_8.2.0_armv7l.xml | 1 +
.../caps_8.2.0_loongarch64.xml | 1 +
.../qemucapabilitiesdata/caps_8.2.0_s390x.xml | 1 +
.../caps_8.2.0_x86_64.xml | 1 +
.../caps_9.0.0_x86_64.xml | 1 +
.../arm-vexpressa9-virtio.aarch64-latest.args | 1 +
.../arm-vexpressa9-virtio.aarch64-latest.xml | 3 ++
.../qemuxmlconfdata/arm-vexpressa9-virtio.xml | 3 +-
.../sound-device-virtio.x86_64-latest.args | 36 +++++++++++++++
.../sound-device-virtio.x86_64-latest.xml | 44 +++++++++++++++++++
tests/qemuxmlconfdata/sound-device-virtio.xml | 28 ++++++++++++
tests/qemuxmlconftest.c | 1 +
24 files changed, 227 insertions(+), 6 deletions(-)
create mode 100644 tests/qemuxmlconfdata/sound-device-virtio.x86_64-latest.args
create mode 100644 tests/qemuxmlconfdata/sound-device-virtio.x86_64-latest.xml
create mode 100644 tests/qemuxmlconfdata/sound-device-virtio.xml
--
2.34.1
10 months, 1 week