[PATCH] qemu: Drop has_ccw_address from _qemuAgentDiskAddress
by Michal Privoznik
In recent patches new mambers to _qemuAgentDiskAddress struct
were introduced to keep optional CCW address sent by the guest
agent. These two members are a struct to store CCW address into
and a boolean to keep track whether the CCW address is valid.
Well, we can hold the same information with a pointer - instead
of storing the CCW address structure let's keep just a pointer to
it.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_agent.c | 18 ++++++++++++------
src/qemu/qemu_agent.h | 3 +--
src/qemu/qemu_driver.c | 9 +++------
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index b155896e78..af0397e6e2 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -1824,6 +1824,7 @@ qemuAgentDiskAddressFree(qemuAgentDiskAddressPtr info)
g_free(info->serial);
g_free(info->bus_type);
g_free(info->devnode);
+ g_free(info->ccw_addr);
g_free(info);
}
@@ -1899,12 +1900,17 @@ qemuAgentGetDiskAddress(virJSONValuePtr json)
GET_DISK_ADDR(pci, &addr->pci_controller.function, "function");
if ((ccw = virJSONValueObjectGet(json, "ccw-address"))) {
- addr->has_ccw_address = true;
- GET_DISK_ADDR(ccw, &addr->ccw_addr.cssid, "cssid");
- if (addr->ccw_addr.cssid == 0) /* Guest CSSID 0 is 0xfe on host */
- addr->ccw_addr.cssid = 0xfe;
- GET_DISK_ADDR(ccw, &addr->ccw_addr.ssid, "ssid");
- GET_DISK_ADDR(ccw, &addr->ccw_addr.devno, "devno");
+ g_autofree virDomainDeviceCCWAddressPtr ccw_addr = NULL;
+
+ ccw_addr = g_new0(virDomainDeviceCCWAddress, 1);
+
+ GET_DISK_ADDR(ccw, &ccw_addr->cssid, "cssid");
+ if (ccw_addr->cssid == 0) /* Guest CSSID 0 is 0xfe on host */
+ ccw_addr->cssid = 0xfe;
+ GET_DISK_ADDR(ccw, &ccw_addr->ssid, "ssid");
+ GET_DISK_ADDR(ccw, &ccw_addr->devno, "devno");
+
+ addr->ccw_addr = g_steal_pointer(&ccw_addr);
}
#undef GET_DISK_ADDR
diff --git a/src/qemu/qemu_agent.h b/src/qemu/qemu_agent.h
index 4ea9b9dc1e..0d47230161 100644
--- a/src/qemu/qemu_agent.h
+++ b/src/qemu/qemu_agent.h
@@ -77,8 +77,7 @@ struct _qemuAgentDiskAddress {
unsigned int target;
unsigned int unit;
char *devnode;
- bool has_ccw_address;
- virDomainDeviceCCWAddress ccw_addr;
+ virDomainDeviceCCWAddressPtr ccw_addr;
};
void qemuAgentDiskAddressFree(qemuAgentDiskAddressPtr addr);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuAgentDiskAddress, qemuAgentDiskAddressFree);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 62b0852c33..a376824854 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18887,8 +18887,7 @@ qemuAgentFSInfoToPublic(qemuAgentFSInfoPtr agent,
diskDef = virDomainDiskByAddress(vmdef,
&agentdisk->pci_controller,
- agentdisk->has_ccw_address ?
- &agentdisk->ccw_addr : NULL,
+ agentdisk->ccw_addr,
agentdisk->bus,
agentdisk->target,
agentdisk->unit);
@@ -19931,8 +19930,7 @@ qemuAgentDiskInfoFormatParams(qemuAgentDiskInfoPtr *info,
/* match the disk to the target in the vm definition */
diskdef = virDomainDiskByAddress(vmdef,
&info[i]->address->pci_controller,
- info[i]->address->has_ccw_address ?
- &info[i]->address->ccw_addr : NULL,
+ info[i]->address->ccw_addr,
info[i]->address->bus,
info[i]->address->target,
info[i]->address->unit);
@@ -20017,8 +20015,7 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo,
/* match the disk to the target in the vm definition */
diskdef = virDomainDiskByAddress(vmdef,
&d->pci_controller,
- d->has_ccw_address ?
- &d->ccw_addr : NULL,
+ d->ccw_addr,
d->bus,
d->target,
d->unit);
--
2.26.2
3 years, 11 months
live migration is not using secondary interface
by Olaf Hering
A naive 'virsh migrate --live domU xen+tcp://cross-over-ip' uses the ordinary uplink instead of the requested IP address. According to the documentation an additional option has to be specified to really use the other network interface. However, neither 'tcp://cross-over-ip' nor 'xenmigr:cross-over-ip/' works, the migration does not start.
'xenmigr' was removed with 1dac5fbbbb06a0341e8087dc33af75c8352d77a4 and 7ed598438687feaddaf0a653d7cbb8a1c1ad4933, but the docs were not updated.
This leaves 'tcp://ip'. What change needs to be done in the driver to support a secondary interface?
Olaf
3 years, 11 months
[RFC PATCH 0/3] Fix "virsh domfsinfo" on s390x (again)
by Thomas Huth
My previous attempts to fix "virsh domfsinfo" on s390x were unfortunately
wrong due to some misunderstandings on my side.
To correctly list the "Target" device in the output of "virsh domfsinfo",
we need to search through the available devices using their CCW address
on s390x.
For this the QEMU guest agent will be enhanced to also send the CCW
address of devices in the guest (see the following URL for details:
https://lore.kernel.org/qemu-devel/20201125105417.380317-1-thuth@redhat.com/
... but it has just been posted and will take some time to get merged,
since QEMU is still in hard freeze, that's why I've labed this libvirt
series here as RFC only). Using this CCW address, we then can look up
the correct target devices on the libvirt side, too.
See also https://bugzilla.redhat.com/show_bug.cgi?id=1858771 for some
more information.
Thomas Huth (3):
qemu: agent: Store CCW address in qemuAgentDiskInfo if provided by the
guest
domain_conf: Allow to look up virtio-block devices by their CCW
address
domain_conf: Allow to look up scsi disks when controller uses a CCW
address
src/conf/domain_conf.c | 33 ++++++++++++++++++++++++++++++++-
src/conf/domain_conf.h | 4 ++++
src/qemu/qemu_agent.c | 11 +++++++++++
src/qemu/qemu_agent.h | 2 ++
src/qemu/qemu_driver.c | 8 +++++---
5 files changed, 54 insertions(+), 4 deletions(-)
--
2.18.4
3 years, 11 months
[PATCH] virt-aa-helper: disallow graphics socket read permissions
by Simon Arlott
The VM does not need read permission for its own sockets to create(),
bind(), accept() connections or to recv(), send(), etc. on connections.
This was fixed in ab9569e5460d1e4737fe8b625c67687dc2204665
(virt-aa-helper: disallow VNC socket read permissions),
but then b6465e1aa49397367a9cd0f27110b9c2280a7385
(graphics: introduce new listen type 'socket')
and acc83afe333bfadd3f7f79091d38ca3d7da1eeb2
(acc83afe333bfadd3f7f79091d38ca3d7da1eeb2) reverted it.
Unless the read permission is omitted, VMs can connect to each other's
VNC/graphics sockets.
Signed-off-by: Simon Arlott <libvirt(a)octiron.net>
---
src/security/virt-aa-helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 6e6dd1b1db..fddbdafc41 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -1053,7 +1053,7 @@ get_files(vahControl * ctl)
if (listenObj.type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET &&
listenObj.socket &&
- vah_add_file(&buf, listenObj.socket, "rw"))
+ vah_add_file(&buf, listenObj.socket, "w"))
goto cleanup;
}
}
--
2.17.1
--
Simon Arlott
3 years, 11 months