Re: [libvirt] [PATCH v3 8/9] tests: Add RISC-V architectures
by Andrea Bolognani
On Wed, 2018-08-22 at 11:15 +0200, Lubomir Rintel wrote:
> Signed-off-by: Lubomir Rintel <lkundrak(a)v3.sk>
> ---
> tests/capabilityschemadata/caps-qemu-kvm.xml | 36 +
> .../caps_3.0.0.riscv32.replies | 14819 ++++++++++++++++
> .../caps_3.0.0.riscv32.xml | 118 +
> .../caps_3.0.0.riscv64.replies | 14819 ++++++++++++++++
> .../caps_3.0.0.riscv64.xml | 118 +
> tests/qemucapabilitiestest.c | 2 +
> tests/qemuxml2argvdata/riscv64-virt.args | 30 +
> tests/qemuxml2argvdata/riscv64-virt.xml | 32 +
> tests/qemuxml2argvtest.c | 3 +
> .../riscv64-virt.xml | 42 +
> tests/qemuxml2xmloutdata/riscv64-virt.xml | 36 +
> tests/qemuxml2xmltest.c | 2 +
> tests/testutilsqemu.c | 72 +
> tests/vircapstest.c | 6 +
> 14 files changed, 30135 insertions(+)
> create mode 100644 tests/qemucapabilitiesdata/caps_3.0.0.riscv32.replies
> create mode 100644 tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml
> create mode 100644 tests/qemucapabilitiesdata/caps_3.0.0.riscv64.replies
> create mode 100644 tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml
> create mode 100644 tests/qemuxml2argvdata/riscv64-virt.args
> create mode 100644 tests/qemuxml2argvdata/riscv64-virt.xml
> create mode 100644 tests/qemuxml2startupxmloutdata/riscv64-virt.xml
> create mode 100644 tests/qemuxml2xmloutdata/riscv64-virt.xml
I think I didn't explain myself clearly enough while reviewing
v2: I expected patches 07-09 and 11 to be squashed together, but
patch 10 to remain standalone. No big deal, I'll take care of
splitting it up again myself.
[...]
> +++ b/tests/qemuxml2argvdata/riscv64-virt.xml
> @@ -0,0 +1,32 @@
> +<domain type='qemu'>
> + <name>riscv64</name>
> + <uuid>fd65fc03-8838-4c4d-9d8d-395802488790</uuid>
> + <memory unit='KiB'>2097152</memory>
> + <currentMemory unit='KiB'>2097152</currentMemory>
> + <vcpu placement='static'>1</vcpu>
> + <os>
> + <type arch='riscv64' machine='virt'>hvm</type>
> + <kernel>/var/lib/libvirt/images/bbl</kernel>
> + <cmdline>console=ttyS0 ro root=/dev/vda</cmdline>
> + <boot dev='hd'/>
> + </os>
> + <clock offset='utc'/>
> + <on_poweroff>destroy</on_poweroff>
> + <on_reboot>restart</on_reboot>
> + <on_crash>destroy</on_crash>
> + <devices>
> + <emulator>/usr/bin/qemu-system-riscv64</emulator>
> + <disk type='file' device='disk'>
> + <driver name='qemu' type='raw'/>
> + <source file='/var/lib/libvirt/images/stage4-disk.img'/>
> + <target dev='vda' bus='virtio'/>
> + <address type='virtio-mmio'/>
> + </disk>
> + <serial type='pty'>
> + <target port='0'/>
> + </serial>
> + <console type='pty'>
> + <target type='serial' port='0'/>
> + </console>
> + </devices>
> +</domain>
You didn't minimize the input file like I requested during
review :( Oh well, I'll take care of it.
Reviewed-by: Andrea Bolognani <abologna(a)redhat.com>
[...]
> +static int testQemuAddRISCV32Guest(virCapsPtr caps)
> +{
> + static const char *names[] = { "spike_v1.10",
> + "spike_v1.9.1",
> + "sifive_e",
> + "virt",
> + "sifive_u" };
> + static const int nmachines = ARRAY_CARDINALITY(names);
> + virCapsGuestMachinePtr *machines = NULL;
> + virCapsGuestPtr guest;
> +
> + machines = virCapabilitiesAllocMachines(names, nmachines);
> + if (!machines)
> + goto error;
> +
> + guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_RISCV32,
> + QEMUBinList[TEST_UTILS_QEMU_BIN_RISCV32],
> + NULL, nmachines, machines);
> + if (!guest)
> + goto error;
> +
> + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL))
> + goto error;
> +
> + return 0;
> +
> + error:
> + virCapabilitiesFreeMachines(machines, nmachines);
> + return -1;
> +}
> +
> +static int testQemuAddRISCV64Guest(virCapsPtr caps)
> +{
> + static const char *names[] = { "spike_v1.10",
> + "spike_v1.9.1",
> + "sifive_e",
> + "virt",
> + "sifive_u" };
> + static const int nmachines = ARRAY_CARDINALITY(names);
> + virCapsGuestMachinePtr *machines = NULL;
> + virCapsGuestPtr guest;
> +
> + machines = virCapabilitiesAllocMachines(names, nmachines);
> + if (!machines)
> + goto error;
> +
> + guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_RISCV64,
> + QEMUBinList[TEST_UTILS_QEMU_BIN_RISCV64],
> + NULL, nmachines, machines);
> + if (!guest)
> + goto error;
> +
> + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL))
> + goto error;
> +
> + return 0;
> +
> + error:
> + virCapabilitiesFreeMachines(machines, nmachines);
> + return -1;
> +}
> +
> static int testQemuAddS390Guest(virCapsPtr caps)
> {
> static const char *s390_machines[] = { "s390-virtio",
> @@ -440,6 +506,12 @@ virCapsPtr testQemuCapsInit(void)
> if (testQemuAddPPCGuest(caps))
> goto cleanup;
>
> + if (testQemuAddRISCV32Guest(caps) < 0)
> + goto cleanup;
> +
> + if (testQemuAddRISCV64Guest(caps) < 0)
> + goto cleanup;
> +
> if (testQemuAddS390Guest(caps))
> goto cleanup;
>
And of course I didn't clean up the surrounding code even though I
said I would... This is a good reminder I guess :)
--
Andrea Bolognani / Red Hat / Virtualization
6 years, 3 months
[libvirt] [PATCH 0/8] qemu: monitor: Clean up error handling for block job APIs
by Peter Krempa
Remove handling of errors which QEMU no longer reports and rename
fields so that it conforms with the new semantics.
Peter Krempa (8):
qemu: monitor: Remove error classes not conforming to QAPI schema
qemu: monitor: Use qemuMonitorJSONCheckError in
qemuMonitorJSONBlockJobError
qemu: monitor: Remove temporary variables
qemu: monitor: Use qemuMonitorJSONCheckError in
qemuMonitorJSONBlockStream
qemu: monitor: Move qemuMonitorJSONDrivePivot together with block-job
APIs
qemu: monitor: Use qemuMonitorJSONBlockJobError in
qemuMonitorJSONDrivePivot
qemu: monitor: Rename 'device' argument for block job control APIs
qemu: monitor: Separate probing for active block commit
src/qemu/qemu_monitor.c | 20 +++---
src/qemu/qemu_monitor.h | 6 +-
src/qemu/qemu_monitor_json.c | 155 +++++++++++++++++++++----------------------
src/qemu/qemu_monitor_json.h | 9 ++-
4 files changed, 94 insertions(+), 96 deletions(-)
--
2.16.2
6 years, 3 months
[libvirt] [PATCH 0/2] Add nodesevinfo in virsh
by Han Han
Add virsh nodesevinfo to get AMD SEV features via virNodeGetSEVInfo.
Han Han (2):
virsh: Implement virNodeGetSEVInfo in virsh
news: Add nodesevinfo command in virsh
docs/news.xml | 9 +++++++
tools/virsh-host.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 5 ++++
3 files changed, 80 insertions(+)
--
2.18.0
6 years, 3 months
[libvirt] [PATCH] storage: Add --shrink to qemu-img command when shrinking vol
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1613746
When shrinking the capacity of a qcow2 or luks volume using
the qemu-img program, the --shrink qualifier must be added.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/storage/storage_util.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 42a9b6abf0..c936120bf0 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -2294,12 +2294,12 @@ storageBackendResizeQemuImg(virStoragePoolObjPtr pool,
* a multiple of 512 */
capacity = VIR_ROUND_UP(capacity, 512);
- cmd = virCommandNew(img_tool);
+ cmd = virCommandNewArgList(img_tool, "resize", NULL);
+ if (capacity < vol->target.capacity)
+ virCommandAddArg(cmd, "--shrink");
if (!vol->target.encryption) {
- virCommandAddArgList(cmd, "resize", vol->target.path, NULL);
+ virCommandAddArg(cmd, vol->target.path);
} else {
- virCommandAddArg(cmd, "resize");
-
if (storageBackendCreateQemuImgSecretObject(cmd, secretPath,
secretAlias) < 0)
goto cleanup;
--
2.17.1
6 years, 3 months
[libvirt] [PATCH] nwfilter: Handle opening for session
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1608275
Commit id 2870419eb (in part) added virGetConnectNWFilter to
allow opening drivers (interface, network, nwfilter, nodedev,
secret, and storage) based on context and commit id f14c37ce4c
started using the API; however, the nwfilterConnectOpen did
not handle session mode resulting in the following message
being logged when virDomainConfVMNWFilterTeardown was called
during the domain shutdown processing:
error : nwfilterConnectOpen:383 : internal error: unexpected
nwfilter URI path '/session', try nwfilter:///system
So similar to the other drivers add code in to check for
/session when not privileged.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/nwfilter/nwfilter_driver.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index ac3a964388..6c25293fd9 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -377,11 +377,20 @@ nwfilterConnectOpen(virConnectPtr conn,
return VIR_DRV_OPEN_ERROR;
}
- if (STRNEQ(conn->uri->path, "/system")) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected nwfilter URI path '%s', try nwfilter:///system"),
- conn->uri->path);
- return VIR_DRV_OPEN_ERROR;
+ if (driver->privileged) {
+ if (STRNEQ(conn->uri->path, "/system")) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected nwfilter URI path '%s', try nwfilter:///system"),
+ conn->uri->path);
+ return VIR_DRV_OPEN_ERROR;
+ }
+ } else {
+ if (STRNEQ(conn->uri->path, "/session")) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected nwfilter URI path '%s', try nwfilter:///session"),
+ conn->uri->path);
+ return VIR_DRV_OPEN_ERROR;
+ }
}
if (virConnectOpenEnsureACL(conn) < 0)
--
2.17.1
6 years, 3 months
[libvirt] [PATCH] nwfilter: Add extra verbiage for binding create/delete
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1609454
Add some cautionary words related to the create and delete
NWFilter Binding use cases and possible issues that may result
to the virsh nwfilter-binding-{create|delete} descriptions
and the virNWFilterBinding{CreateXML|Delete) API descriptions.
Essentially summarizing commit 2d9318b6c without using the
shoot yourself in the foot wording.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Perhaps not the exact "answer" for the bz; however, using the bz as the
excuse to say it was a bit confusing and let's try to clarify the wording
a bit more.
src/libvirt-nwfilter.c | 16 ++++++++++++++--
tools/virsh.pod | 14 ++++++++++++--
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/libvirt-nwfilter.c b/src/libvirt-nwfilter.c
index e572d46c18..3da85adc9e 100644
--- a/src/libvirt-nwfilter.c
+++ b/src/libvirt-nwfilter.c
@@ -678,7 +678,14 @@ virNWFilterBindingGetFilterName(virNWFilterBindingPtr binding)
* @flags: currently unused, pass 0
*
* Define a new network filter, based on an XML description
- * similar to the one returned by virNWFilterGetXMLDesc()
+ * similar to the one returned by virNWFilterGetXMLDesc(). This
+ * API may be used to associate a filter with a currently running
+ * guest that does not have a filter defined for a specific network
+ * port. Since the bindings are generally automatically managed by
+ * the hypervisor, using this command to define a filter for a network
+ * port and then starting the guest afterwards may prevent the guest
+ * from starting if it attempts to use the network port and finds a
+ * filter already defined.
*
* virNWFilterFree should be used to free the resources after the
* binding object is no longer needed.
@@ -717,7 +724,12 @@ virNWFilterBindingCreateXML(virConnectPtr conn, const char *xml, unsigned int fl
* @binding: a binding object
*
* Delete the binding object. This does not free the
- * associated virNWFilterBindingPtr object.
+ * associated virNWFilterBindingPtr object. This API
+ * may be used to remove the network port binding filter
+ * currently in use for the guest while the guest is
+ * running without needing to restart the guest. Restoring
+ * the network port binding filter for the running guest
+ * would be accomplished by using virNWFilterBindingCreateXML.
*
* Returns 0 in case of success and -1 in case of failure.
*/
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 4e118851f8..86c041d575 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -4836,13 +4836,23 @@ of the network filters directly.
=item B<nwfilter-binding-create> I<xmlfile>
Associate a network port with a network filter. The network filter backend
-will immediately attempt to instantiate the filter rules on the port.
+will immediately attempt to instantiate the filter rules on the port. This
+command may be used to associate a filter with a currently running guest
+that does not have a filter defined for a specific network port. Since the
+bindings are generally automatically managed by the hypervisor, using this
+command to define a filter for a network port and then starting the guest
+afterwards may prevent the guest from starting if it attempts to use the
+network port and finds a filter already defined.
=item B<nwfilter-binding-delete> I<port-name>
Disassociate a network port from a network filter. The network filter
backend will immediately tear down the filter rules that exist on the
-port.
+port. This command may be used to remove the network port binding for
+a filter currently in use for the guest while the guest is running
+without needing to restart the guest. Restoring the network port binding
+filter for the running guest would be accomplished by using
+I<nwfilter-binding-create>.
=item B<nwfilter-binding-list>
--
2.17.1
6 years, 3 months
[libvirt] [PATCH] access: Fix nwfilter-binding ACL access API name generation
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1611320
Generation of the ACL API policy is a "automated process"
based on this perl script which "worked" with the changes to
add nwfilter binding API's because they had the "nwfilter"
prefix; however, the generated output name was incorrect
based on the remote protocol algorithm which expected to
generate names such as 'nwfilter-binding.action' instead
of 'nwfilter.binding-action'.
This effectively changes src/access/org.libvirt.api.policy entries:
org.libvirt.api.nwfilter.binding-create ==>
org.libvirt.api.nwfilter-binding.create
org.libvirt.api.nwfilter.binding-delete ==>
org.libvirt.api.nwfilter-binding.delete
org.libvirt.api.nwfilter.binding-getattr ==>
org.libvirt.api.nwfilter-binding.getattr
org.libvirt.api.nwfilter.binding-read ==>
org.libvirt.api.nwfilter-binding.read
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
If someone can explain better exactly what is happening in this
processing, I'd be more than willing to update the commit message.
I'm sure my wording isn't "precise" enough, but I feel like I hit
the lottery finding this needle in the haystack.
src/access/genpolkit.pl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/access/genpolkit.pl b/src/access/genpolkit.pl
index 968cb8c55c..e074c90eb6 100755
--- a/src/access/genpolkit.pl
+++ b/src/access/genpolkit.pl
@@ -22,8 +22,8 @@ use warnings;
my @objects = (
"CONNECT", "DOMAIN", "INTERFACE",
- "NETWORK","NODE_DEVICE", "NWFILTER",
- "SECRET", "STORAGE_POOL", "STORAGE_VOL",
+ "NETWORK","NODE_DEVICE", "NWFILTER_BINDING", "NWFILTER",
+ "SECRET", "STORAGE_POOL", "STORAGE_VOL",
);
my $objects = join ("|", @objects);
--
2.17.1
6 years, 3 months
[libvirt] [PATCH] nwfilter: Handle libvirtd restart if nwfilter binding deleted
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1607202
It's stated that if the admin wants to shoot themselves in
the foot by removing the nwfilter binding while the domain
is running we will certainly allow that. However, in doing
so we also run the risk that a libvirtd restart will cause
the domain to be shutdown, which isn't a good thing.
So add another boolean to virDomainConfNWFilterInstantiate
which allows us to recover somewhat gracefully in the event
the virNWFilterBindingCreateXML fails when we come from
qemuProcessReconnect and we determine that the filter has
been deleted. It was there at some point (it had to be), but
if it's missing, then we don't want to cause the guest to
stop running, so issue a warning and continue on.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/conf/domain_nwfilter.c | 33 ++++++++++++++++++++++++++++-----
src/conf/domain_nwfilter.h | 3 ++-
src/lxc/lxc_process.c | 3 ++-
src/qemu/qemu_hotplug.c | 7 ++++---
src/qemu/qemu_interface.c | 6 ++++--
src/qemu/qemu_process.c | 10 +++++++---
src/uml/uml_conf.c | 3 ++-
7 files changed, 49 insertions(+), 16 deletions(-)
diff --git a/src/conf/domain_nwfilter.c b/src/conf/domain_nwfilter.c
index f39c8a1f9b..3e6e462def 100644
--- a/src/conf/domain_nwfilter.c
+++ b/src/conf/domain_nwfilter.c
@@ -85,16 +85,19 @@ int
virDomainConfNWFilterInstantiate(const char *vmname,
const unsigned char *vmuuid,
virDomainNetDefPtr net,
- bool ignoreExists)
+ bool ignoreExists,
+ bool ignoreDeleted)
{
virConnectPtr conn = virGetConnectNWFilter();
virNWFilterBindingDefPtr def = NULL;
virNWFilterBindingPtr binding = NULL;
+ virNWFilterPtr nwfilter = NULL;
char *xml = NULL;
int ret = -1;
- VIR_DEBUG("vmname=%s portdev=%s filter=%s ignoreExists=%d",
- vmname, NULLSTR(net->ifname), NULLSTR(net->filter), ignoreExists);
+ VIR_DEBUG("vmname=%s portdev=%s filter=%s ignoreExists=%d ignoreDeleted=%d",
+ vmname, NULLSTR(net->ifname), NULLSTR(net->filter),
+ ignoreExists, ignoreDeleted);
if (!conn)
goto cleanup;
@@ -113,14 +116,34 @@ virDomainConfNWFilterInstantiate(const char *vmname,
if (!(xml = virNWFilterBindingDefFormat(def)))
goto cleanup;
- if (!(binding = virNWFilterBindingCreateXML(conn, xml, 0)))
- goto cleanup;
+ if (!(binding = virNWFilterBindingCreateXML(conn, xml, 0))) {
+ virErrorPtr orig_err;
+
+ if (!ignoreDeleted)
+ goto cleanup;
+
+ /* Let's determine if the error was because the filter was deleted.
+ * Save the orig_err just in case it's not a failure to find the
+ * filter by name. */
+ orig_err = virSaveLastError();
+ nwfilter = virNWFilterLookupByName(conn, def->filter);
+ virSetError(orig_err);
+ virFreeError(orig_err);
+ if (nwfilter)
+ goto cleanup;
+
+ VIR_WARN("filter '%s' for binding '%s' has been deleted while the "
+ "guest was running, ignoring for restart processing",
+ def->filter, def->portdevname);
+ virResetLastError();
+ }
ret = 0;
cleanup:
VIR_FREE(xml);
virNWFilterBindingDefFree(def);
+ virObjectUnref(nwfilter);
virObjectUnref(binding);
virObjectUnref(conn);
return ret;
diff --git a/src/conf/domain_nwfilter.h b/src/conf/domain_nwfilter.h
index 6bda228fc8..e3a2f7a7f2 100644
--- a/src/conf/domain_nwfilter.h
+++ b/src/conf/domain_nwfilter.h
@@ -26,7 +26,8 @@
int virDomainConfNWFilterInstantiate(const char *vmname,
const unsigned char *vmuuid,
virDomainNetDefPtr net,
- bool ignoreExists);
+ bool ignoreExists,
+ bool ignoreDeleted);
void virDomainConfNWFilterTeardown(virDomainNetDefPtr net);
void virDomainConfVMNWFilterTeardown(virDomainObjPtr vm);
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 33c806630b..b8b014ca72 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -303,7 +303,8 @@ virLXCProcessSetupInterfaceTap(virDomainDefPtr vm,
}
if (net->filter &&
- virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net, false) < 0)
+ virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net,
+ false, false) < 0)
goto cleanup;
ret = containerVeth;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 0b84a503bb..11b10cbe14 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3434,8 +3434,8 @@ qemuDomainChangeNetFilter(virDomainObjPtr vm,
virDomainConfNWFilterTeardown(olddev);
if (newdev->filter &&
- virDomainConfNWFilterInstantiate(vm->def->name,
- vm->def->uuid, newdev, false) < 0) {
+ virDomainConfNWFilterInstantiate(vm->def->name, vm->def->uuid, newdev,
+ false, false) < 0) {
virErrorPtr errobj;
virReportError(VIR_ERR_OPERATION_FAILED,
@@ -3444,7 +3444,8 @@ qemuDomainChangeNetFilter(virDomainObjPtr vm,
olddev->ifname);
virErrorPreserveLast(&errobj);
ignore_value(virDomainConfNWFilterInstantiate(vm->def->name,
- vm->def->uuid, olddev, false));
+ vm->def->uuid, olddev,
+ false, false));
virErrorRestore(&errobj);
return -1;
}
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index a3f13093f5..fc5f39b76d 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -467,7 +467,8 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def,
goto cleanup;
if (net->filter &&
- virDomainConfNWFilterInstantiate(def->name, def->uuid, net, false) < 0) {
+ virDomainConfNWFilterInstantiate(def->name, def->uuid, net,
+ false, false) < 0) {
goto cleanup;
}
@@ -586,7 +587,8 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def,
goto cleanup;
if (net->filter &&
- virDomainConfNWFilterInstantiate(def->name, def->uuid, net, false) < 0) {
+ virDomainConfNWFilterInstantiate(def->name, def->uuid, net,
+ false, false) < 0) {
goto cleanup;
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ab749389ee..4d8b3017b4 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3161,14 +3161,18 @@ qemuProcessNotifyNets(virDomainDefPtr def)
}
static int
-qemuProcessFiltersInstantiate(virDomainDefPtr def, bool ignoreExists)
+qemuProcessFiltersInstantiate(virDomainDefPtr def,
+ bool ignoreExists,
+ bool ignoreDeleted)
{
size_t i;
for (i = 0; i < def->nnets; i++) {
virDomainNetDefPtr net = def->nets[i];
if ((net->filter) && (net->ifname)) {
- if (virDomainConfNWFilterInstantiate(def->name, def->uuid, net, ignoreExists) < 0)
+ if (virDomainConfNWFilterInstantiate(def->name, def->uuid, net,
+ ignoreExists,
+ ignoreDeleted) < 0)
return 1;
}
}
@@ -7892,7 +7896,7 @@ qemuProcessReconnect(void *opaque)
qemuProcessNotifyNets(obj->def);
- if (qemuProcessFiltersInstantiate(obj->def, true))
+ if (qemuProcessFiltersInstantiate(obj->def, true, true))
goto error;
if (qemuProcessRefreshDisks(driver, obj, QEMU_ASYNC_JOB_NONE) < 0)
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index f116e619ef..29d26848f3 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -137,7 +137,8 @@ umlConnectTapDevice(virDomainDefPtr vm,
}
if (net->filter) {
- if (virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net, false) < 0) {
+ if (virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net,
+ false, false) < 0) {
if (template_ifname)
VIR_FREE(net->ifname);
goto error;
--
2.17.1
6 years, 3 months
[libvirt] [PATCH v2] qemu: qemuDomainChangeNet: validity checks should be done before XML autocompletion
by Katerina Koukiou
This patch ensures that changes in attributes of interfaces will be emit
errors accept if they are missing from the XML.
Previously we were falsely reporting successfull updates, because some
changed attributes got overwritten before the validity checks.
https://bugzilla.redhat.com/show_bug.cgi?id=1599513
Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
src/qemu/qemu_hotplug.c | 42 +++++++++++++++++++++++++----------------
1 file changed, 26 insertions(+), 16 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 1488f0a7c2..76ab56a479 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3445,23 +3445,9 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
goto cleanup;
}
- /* info: if newdev->info is empty, fill it in from olddev,
- * otherwise verify that it matches - nothing is allowed to
- * change. (There is no helper function to do this, so
- * individually check the few feidls of virDomainDeviceInfo that
- * are relevant in this case).
+ /* info: Nothing is allowed to change. First fill the missing newdev->info
+ * from olddev and then check for changes.
*/
- if (!virDomainDeviceAddressIsValid(&newdev->info,
- VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
- virDomainDeviceInfoCopy(&newdev->info, &olddev->info) < 0) {
- goto cleanup;
- }
- if (!virPCIDeviceAddressEqual(&olddev->info.addr.pci,
- &newdev->info.addr.pci)) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
- _("cannot modify network device guest PCI address"));
- goto cleanup;
- }
/* grab alias from olddev if not set in newdev */
if (!newdev->info.alias &&
VIR_STRDUP(newdev->info.alias, olddev->info.alias) < 0)
@@ -3469,26 +3455,50 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
/* device alias is checked already in virDomainDefCompatibleDevice */
+ if (newdev->info.rombar == VIR_TRISTATE_BOOL_ABSENT)
+ newdev->info.rombar = olddev->info.rombar;
if (olddev->info.rombar != newdev->info.rombar) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("cannot modify network device rom bar setting"));
goto cleanup;
}
+
+ if (!newdev->info.romfile &&
+ VIR_STRDUP(newdev->info.romfile, olddev->info.romfile) < 0)
+ goto cleanup;
if (STRNEQ_NULLABLE(olddev->info.romfile, newdev->info.romfile)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("cannot modify network rom file"));
goto cleanup;
}
+
+ if (newdev->info.bootIndex == 0)
+ newdev->info.bootIndex = olddev->info.bootIndex;
if (olddev->info.bootIndex != newdev->info.bootIndex) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("cannot modify network device boot index setting"));
goto cleanup;
}
+
+ if (newdev->info.romenabled == VIR_TRISTATE_BOOL_ABSENT)
+ newdev->info.romenabled = olddev->info.romenabled;
if (olddev->info.romenabled != newdev->info.romenabled) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("cannot modify network device rom enabled setting"));
goto cleanup;
}
+
+ /* if pci addr is missing or is invalid we overwrite it from olddev */
+ if (!virDomainDeviceAddressIsValid(&newdev->info,
+ VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)) {
+ newdev->info.addr.pci = olddev->info.addr.pci;
+ }
+ if (!virPCIDeviceAddressEqual(&olddev->info.addr.pci,
+ &newdev->info.addr.pci)) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("cannot modify network device guest PCI address"));
+ goto cleanup;
+ }
/* (end of device info checks) */
if (STRNEQ_NULLABLE(olddev->filter, newdev->filter) ||
--
2.17.1
6 years, 3 months
[libvirt] [PATCH v3 0/9] RISC-V Guest Support
by Lubomir Rintel
Hi.
Third iteration of RISC-V guest support. I believe I addressed all
points of Andrea's review. Tested with: images from [1]:
virt-install \
--import --name riscv64 \
--arch riscv64 --machine virt \
--memory 2048 \
--rng /dev/urandom \
--disk /var/lib/libvirt/images/stage4-disk.img,bus=virtio \
--boot kernel=/var/lib/libvirt/images/bbl,kernel_args="console=ttyS0 ro root=/dev/vda"
[1] https://fedorapeople.org/groups/risc-v/disk-images/
Note that the large test suite changes that touch the '*.replies' files
seem to upset the mail server, thus you're unlikely to receive them from
the list. You can get them straight from my repository instead:
git pull https://github.com/lkundrak/libvirt.git lr/riscv-v3
Changes since v2:
* Regenerated cap test data with QEMU 3.0.0
* Squashed the tests together
* Folded "docs/schemas: add RISC-V architectures" into "util: add RISC-V architectures"
* Streamlined the Virtio MMIO address assignment
* Added qemuDomainIsRISCVVirt() and qemuDomainMachineIsRISCVVirt()
* Cosmetic changes to "util: add RISC-V architectures"
* New commits:
qemu: add qemuDomainAssignVirtioMMIOAddresses()
qemu: add qemuDomainIsRISCVVirt() and qemuDomainMachineIsRISCVVirt()
qemu: RISC-V machines have no PCI
news: Add a mention of RISC-V guest support
* Dropped:
qemu: no USB by default on RISC-V machines
(not sure why I thought this was needed)
Lubomir Rintel (9):
qemu: rename qemuDomainMachineIsVirt()
qemu: rename qemuDomainArmVirt()
util: add RISC-V architectures
qemu: RISC-V machines have no PCI
qemu: add qemuDomainIsRISCVVirt() and qemuDomainMachineIsRISCVVirt()
qemu: add qemuDomainAssignVirtioMMIOAddresses()
qemu: assign addresses to virtio devices on RISC-V
tests: Add RISC-V architectures
news: Add a mention of RISC-V guest support
docs/news.xml | 8 +
docs/schemas/basictypes.rng | 2 +
src/qemu/qemu_capabilities.c | 6 +-
src/qemu/qemu_command.c | 4 +-
src/qemu/qemu_domain.c | 46 +-
src/qemu/qemu_domain.h | 9 +-
src/qemu/qemu_domain_address.c | 34 +-
src/util/virarch.c | 5 +-
src/util/virarch.h | 8 +-
tests/capabilityschemadata/caps-qemu-kvm.xml | 36 +
.../caps_3.0.0.riscv32.replies | 14819 ++++++++++++++++
.../caps_3.0.0.riscv32.xml | 118 +
.../caps_3.0.0.riscv64.replies | 14819 ++++++++++++++++
.../caps_3.0.0.riscv64.xml | 118 +
tests/qemucapabilitiestest.c | 2 +
tests/qemuxml2argvdata/riscv64-virt.args | 30 +
tests/qemuxml2argvdata/riscv64-virt.xml | 32 +
tests/qemuxml2argvtest.c | 3 +
.../riscv64-virt.xml | 42 +
tests/qemuxml2xmloutdata/riscv64-virt.xml | 36 +
tests/qemuxml2xmltest.c | 2 +
tests/testutilsqemu.c | 72 +
tests/vircapstest.c | 6 +
23 files changed, 30232 insertions(+), 25 deletions(-)
create mode 100644 tests/qemucapabilitiesdata/caps_3.0.0.riscv32.replies
create mode 100644 tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml
create mode 100644 tests/qemucapabilitiesdata/caps_3.0.0.riscv64.replies
create mode 100644 tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml
create mode 100644 tests/qemuxml2argvdata/riscv64-virt.args
create mode 100644 tests/qemuxml2argvdata/riscv64-virt.xml
create mode 100644 tests/qemuxml2startupxmloutdata/riscv64-virt.xml
create mode 100644 tests/qemuxml2xmloutdata/riscv64-virt.xml
--
2.17.1
6 years, 3 months