[libvirt] [PATCH] qemu: use "id" instead of deprecated "name" for -net
by Ján Tomko
-net name= will be deprecated in QEMU 3.1:
commit 101625a4d4ac7e96227a156bc5f6d21a9cc383cd
net: Deprecate the "name" parameter of -net
git describe: v3.0.0-791-g101625a4d4
Use the id option instead, supported since QEMU 1.2:
commit 6687b79d636cd60ed9adb1177d0d946b58fa7717
convert net_client_init() to OptsVisitor
git describe: v1.0-3564-g6687b79d63 contains: v1.2.0-rc0~142^2~8
Thankfully, libvirt only uses -net for non-PCI, non-virtio NICs
on ARM.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_command.c | 2 +-
tests/qemuxml2argvdata/arm-vexpressa9-basic.args | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d77cf8c2d6..269276f2f9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3516,7 +3516,7 @@ qemuBuildLegacyNicStr(virDomainNetDefPtr net)
net->info.alias,
(net->model ? ",model=" : ""),
(net->model ? net->model : ""),
- (net->info.alias ? ",name=" : ""),
+ (net->info.alias ? ",id=" : ""),
(net->info.alias ? net->info.alias : "")));
return str;
}
diff --git a/tests/qemuxml2argvdata/arm-vexpressa9-basic.args b/tests/qemuxml2argvdata/arm-vexpressa9-basic.args
index 90661d8b55..b925baa0e0 100644
--- a/tests/qemuxml2argvdata/arm-vexpressa9-basic.args
+++ b/tests/qemuxml2argvdata/arm-vexpressa9-basic.args
@@ -27,6 +27,6 @@ server,nowait \
-usb \
-drive file=/arm.raw,format=raw,if=sd,index=0 \
-netdev user,id=hostnet0 \
--net nic,macaddr=52:54:00:09:a4:37,netdev=hostnet0,model=lan9118,name=net0 \
+-net nic,macaddr=52:54:00:09:a4:37,netdev=hostnet0,model=lan9118,id=net0 \
-chardev pty,id=charserial0 \
-serial chardev:charserial0
--
2.16.4
6 years, 1 month
[libvirt] [PATCH] virFileIsSharedFSType: Copy mnt_dir when browsing mount table
by Han Han
virFileIsSharedFSType doesn't fix f_type when "fuse.glusterfs"
is not the last row of mount table. For example, it doesn't works on
the mount table like following:
10.XX.XX.XX:/gv0 /mnt fuse.glusterfs rw 0 0
root@XX.XX.XX:/tmp/mkdir /tmp/br0 fuse.sshfs rw 0 0
Copy mnt_dir of struct mntent in case its mnt_dir is changed by
getmntent_r in the loop later.
Signed-off-by: Han Han <hhan(a)redhat.com>
---
src/util/virfile.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 2a7e87102a..c503462633 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -3469,7 +3469,7 @@ virFileIsSharedFixFUSE(const char *path,
long *f_type)
{
char *dirpath = NULL;
- const char **mounts = NULL;
+ char **mounts = NULL;
size_t nmounts = 0;
char *p;
FILE *f = NULL;
@@ -3491,8 +3491,12 @@ virFileIsSharedFixFUSE(const char *path,
if (STRNEQ("fuse.glusterfs", mb.mnt_type))
continue;
- if (VIR_APPEND_ELEMENT_COPY(mounts, nmounts, mb.mnt_dir) < 0)
+ char *mnt_dir;
+ if (VIR_STRDUP(mnt_dir, mb.mnt_dir) < 0 ||
+ VIR_APPEND_ELEMENT_COPY(mounts, nmounts, mnt_dir) < 0) {
+ VIR_FREE(mnt_dir);
goto cleanup;
+ }
}
/* Add NULL sentinel so that this is a virStringList */
@@ -3512,7 +3516,7 @@ virFileIsSharedFixFUSE(const char *path,
else
*p = '\0';
- if (virStringListHasString(mounts, dirpath)) {
+ if (virStringListHasString((const char **)mounts, dirpath)) {
VIR_DEBUG("Found gluster FUSE mountpoint=%s for path=%s. "
"Fixing shared FS type", dirpath, path);
*f_type = GFS2_MAGIC;
@@ -3523,7 +3527,7 @@ virFileIsSharedFixFUSE(const char *path,
ret = 0;
cleanup:
endmntent(f);
- VIR_FREE(mounts);
+ virStringListFree(mounts);
VIR_FREE(dirpath);
return ret;
}
--
2.19.1
6 years, 1 month
[libvirt] [PATCH v2] qemu: agent: Avoid agentError when closing the QEMU agent
by Wang Yechao
After calling qemuAgentClose(), it is still possible for
the QEMU Agent I/O event callback to get invoked. This
will trigger an agent error because mon->fd has been set
to -1 at this point. Then vm->privateData->agentError is
always 'true' except that restart libvirtd or restart
qemu-guest-agent process in guest.
Silently ignore the case where mon->fd is -1, likewise for
mon->watch being zero.
Signed-off-by: Wang Yechao <wang.yechao255(a)zte.com.cn>
---
v1 patch:
https://www.redhat.com/archives/libvir-list/2018-September/msg01382.html
Changes in v2:
- do not set agentError, let agent state as disconnected instead of error.
---
src/qemu/qemu_agent.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 97ad0e7..d842b0e 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -530,6 +530,9 @@ static void qemuAgentUpdateWatch(qemuAgentPtr mon)
VIR_EVENT_HANDLE_HANGUP |
VIR_EVENT_HANDLE_ERROR;
+ if (!mon->watch)
+ return;
+
if (mon->lastError.code == VIR_ERR_OK) {
events |= VIR_EVENT_HANDLE_READABLE;
@@ -555,6 +558,12 @@ qemuAgentIO(int watch, int fd, int events, void *opaque)
VIR_DEBUG("Agent %p I/O on watch %d fd %d events %d", mon, watch, fd, events);
#endif
+ if (mon->fd == -1 || mon->watch == 0) {
+ virObjectUnlock(mon);
+ virObjectUnref(mon);
+ return;
+ }
+
if (mon->fd != fd || mon->watch != watch) {
if (events & (VIR_EVENT_HANDLE_HANGUP | VIR_EVENT_HANDLE_ERROR))
eof = true;
@@ -788,8 +797,10 @@ void qemuAgentClose(qemuAgentPtr mon)
virObjectLock(mon);
if (mon->fd >= 0) {
- if (mon->watch)
+ if (mon->watch) {
virEventRemoveHandle(mon->watch);
+ mon->watch = 0;
+ }
VIR_FORCE_CLOSE(mon->fd);
}
--
1.8.3.1
6 years, 1 month
[libvirt] [PATCH 00/11] qemu: Improve / cleanup QEMU binary handling
by Andrea Bolognani
This is the output of 'virsh capabilities' on my laptop:
<guest>
<os_type>hvm</os_type>
<arch name='x86_64'>
<wordsize>64</wordsize>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<machine maxCpus='255'>pc-i440fx-3.0</machine>
<machine canonical='pc-i440fx-3.0' maxCpus='255'>pc</machine>
<machine maxCpus='288'>pc-q35-3.0</machine>
<machine canonical='pc-q35-3.0' maxCpus='288'>q35</machine>
<!-- Actually way more machine types listed here -->
<domain type='qemu'/>
<domain type='kvm'>
<emulator>/usr/bin/qemu-kvm</emulator>
<machine maxCpus='255'>pc-i440fx-3.0</machine>
<machine canonical='pc-i440fx-3.0' maxCpus='255'>pc</machine>
<machine maxCpus='288'>pc-q35-3.0</machine>
<machine canonical='pc-q35-3.0' maxCpus='288'>q35</machine>
<!-- Actually way more machine types listed here -->
</domain>
</arch>
<!-- Other stuff we don't care about -->
</guest>
Notice how all machine types are listed twice, and how we report
that qemu-system-x86_64 for TCG guests qemu-kvm must be used for
KVM guests - which is inaccurate, since the former can run KVM
guests just fine.
After this series, the output is much more reasonable:
<guest>
<os_type>hvm</os_type>
<arch name='x86_64'>
<wordsize>64</wordsize>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<machine maxCpus='255'>pc-i440fx-3.0</machine>
<machine canonical='pc-i440fx-3.0' maxCpus='255'>pc</machine>
<machine maxCpus='288'>pc-q35-3.0</machine>
<machine canonical='pc-q35-3.0' maxCpus='288'>q35</machine>
<!-- Actually way more machine types listed here -->
<domain type='qemu'/>
<domain type='kvm'/>
</arch>
<!-- Other stuff we don't care about -->
</guest>
As a bonus the code gets *simpler* in the process instead of more
complicated, and we even get to shave off ~100 lines! Yay!
Andrea Bolognani (11):
qemu: Move comments to virQEMUCapsGuestIsNative()
qemu: Don't duplicate binary name in capabilities
qemu: Move armv7l-on-aarch64 special case
qemu: Stop looking after finding the first binary
qemu: Expect a single binary in virQEMUCapsInitGuest()
qemu: Remove unnecessary variables
qemu: Don't look for "qemu-kvm" and "kvm" binaries
qemu: Simplify QEMU binary search
qemu: Rename qemubinCaps => qemuCaps
qemu: Refactor virQEMUCapsCacheLookupByArch()
qemu: Prefer qemu-system-* binaries
src/qemu/qemu_capabilities.c | 170 +++++++-----------
src/qemu/qemu_capabilities.h | 4 +-
.../qemucaps2xmloutdata/caps_1.5.3.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_1.6.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_1.7.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.1.1.x86_64.xml | 4 +-
.../caps_2.10.0.aarch64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.10.0.ppc64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.10.0.s390x.xml | 4 +-
.../caps_2.10.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.11.0.s390x.xml | 4 +-
.../caps_2.11.0.x86_64.xml | 4 +-
.../caps_2.12.0.aarch64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.12.0.ppc64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.12.0.s390x.xml | 4 +-
.../caps_2.12.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.4.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.5.0.x86_64.xml | 4 +-
.../caps_2.6.0.aarch64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.6.0.ppc64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.6.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.7.0.s390x.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.7.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.8.0.s390x.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.8.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.9.0.ppc64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.9.0.s390x.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.9.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_3.0.0.ppc64.xml | 4 +-
.../qemucaps2xmloutdata/caps_3.0.0.x86_64.xml | 4 +-
tests/qemucaps2xmltest.c | 2 -
31 files changed, 97 insertions(+), 191 deletions(-)
--
2.17.1
6 years, 1 month
[libvirt] [PATCH v2 00/12] qemu: Fix media changing problems
by Peter Krempa
Fixes regression in media changing/disk hotplug as the ordering of the
alias allocation and disk preparation was bad.
v2:
- be more explicit about old and new definitions used in certain steps
- clean up legacy hotplug to not access old disk source definition
- also treat network disks as 'raw' if the format was not provided
Peter Krempa (12):
Revert "qemu: hotplug: Prepare disk source in
qemuDomainAttachDeviceDiskLive"
Revert "qemu: hotplug: consolidate media change code paths"
qemu: hotplug: Don't pretend that we support secrets for media change
qemu: domain: Assume 'raw' default storage format also for network
storage
qemu: hotplug: Remove code handling possible missing disk source
format
qemu: hotplug: Allow specifying explicit source for disk backend
hotplug code
qemu: hotplug: Be explicit about old/new sources when changing media
qemu: hotplug: Prepare disk source for media changing
qemu: hotplug: Add wrapper for disk hotplug code
qemu: conf: Export qemuAddSharedDisk
qemu: hotplug: Split out media change code from disk hotplug
qemu: hotplug: Refactor qemuDomainAttachDeviceDiskLiveInternal
src/qemu/qemu_conf.c | 2 +-
src/qemu/qemu_conf.h | 5 +
src/qemu/qemu_domain.c | 4 +-
src/qemu/qemu_driver.c | 7 +-
src/qemu/qemu_hotplug.c | 276 ++++++++++--------
src/qemu/qemu_hotplug.h | 9 +-
tests/qemuhotplugtest.c | 2 +-
.../disk-source-pool-mode.args | 6 +-
tests/qemuxml2argvdata/disk-source-pool.args | 4 +-
.../disk-source-pool-mode.xml | 6 +-
tests/qemuxml2xmloutdata/disk-source-pool.xml | 2 +-
11 files changed, 185 insertions(+), 138 deletions(-)
--
2.17.1
6 years, 1 month
[libvirt] [osinfo-db-tools PATCH v2 0/2] RFC: Make osinfo-db-import aware of URLs
by Fabiano Fidêncio
This is a simple draft of a work that has been discussed back in July as
part of this thread[0].
There are a few things which are not clear to me whether we want (or
whether we do *not* want).
For now I'm not using any progress callback to print the download status
and I don't even know whether it would be desired to have. But this is
something that could be easily done.
Also, for now the operation is synchronous and there's no cancellable
used ... but that's something that could be changed (although I don't
see the need for that right now).
In order to give it a try, please, just build our source with the patch
included and try:
./tools/osinfo-db-import https://releases.pagure.org/libosinfo/osinfo-db-20180920.tar.xz
./tools/osinfo-db-import https://foo.bar/foo.bar.tar.xz
[0]: https://www.redhat.com/archives/libosinfo/2018-July/msg00002.html
Changes since v1:
- Use Gio instead of curl;
- An additional patch removing a unused var;
Fabiano Fidêncio (2):
import: Learn how to deal with URLs
import: Remove unused variable
tools/osinfo-db-import.c | 91 ++++++++++++++++++++++++++++++++++++----
1 file changed, 84 insertions(+), 7 deletions(-)
--
2.19.1
6 years, 1 month
[libvirt] [PATCH 00/15] Move unix socket creation out of qemuBuildCommandLine
by Ján Tomko
Add test coverage for all the possible devices and move all the
socket creation to qemuProcessPrepareHost.
TBD: remove the racy qemuSecuritySetSocketLabel call
as well as the rest of host state modification out of
qemuBuildCommandLine
Ján Tomko (15):
tests: add smartcard-passthrough-unix
tests: add parallel-unix-chardev
tests: add channel-unix-guestfwd
tests: add console-virtio-unix
tests: add usb-redir-unix
tests: add virtio-rng-egd-unix
tests: use real capabilities for net-vhostuser
qemuProcessPrepareDomain: pass xmlopt when creating monConfig
qemu: add fd to qemuDomainChrSourcePrivate
qemuBuildChrChardevStr: split attribute formatting
qemuBuildChrChardevStr: increase scope of qemuBuildChrChardevStr
qemuBuildChrChardevStr: pass fd from private data
qemu: remove QEMU_BUILD_CHARDEV_UNIX_FD_PASS
qemuBuildCommandLine: do not pass security manager
qemuOpenChrChardevUNIXSocket: move to qemu_process
src/qemu/qemu_command.c | 192 +++++----------------
src/qemu/qemu_command.h | 5 -
src/qemu/qemu_domain.c | 3 +
src/qemu/qemu_domain.h | 2 +
src/qemu/qemu_process.c | 188 +++++++++++++++++++-
src/qemu/qemu_process.h | 3 +
.../channel-unix-guestfwd.x86_64-2.5.0.args | 33 ++++
.../channel-unix-guestfwd.x86_64-latest.args | 36 ++++
tests/qemuxml2argvdata/channel-unix-guestfwd.xml | 37 ++++
.../console-virtio-unix.x86_64-2.5.0.args | 34 ++++
.../console-virtio-unix.x86_64-latest.args | 37 ++++
tests/qemuxml2argvdata/console-virtio-unix.xml | 33 ++++
.../net-vhostuser.x86_64-2.5.0.args | 39 +++++
.../net-vhostuser.x86_64-latest.args | 42 +++++
.../parallel-unix-chardev.x86_64-2.5.0.args | 33 ++++
.../parallel-unix-chardev.x86_64-latest.args | 36 ++++
tests/qemuxml2argvdata/parallel-unix-chardev.xml | 35 ++++
.../smartcard-passthrough-unix.x86_64-2.5.0.args | 30 ++++
.../smartcard-passthrough-unix.x86_64-latest.args | 33 ++++
.../smartcard-passthrough-unix.xml | 19 ++
.../usb-redir-unix.x86_64-2.5.0.args | 35 ++++
.../usb-redir-unix.x86_64-latest.args | 38 ++++
tests/qemuxml2argvdata/usb-redir-unix.xml | 45 +++++
.../virtio-rng-egd-unix.x86_64-2.5.0.args | 30 ++++
.../virtio-rng-egd-unix.x86_64-latest.args | 33 ++++
tests/qemuxml2argvdata/virtio-rng-egd-unix.xml | 29 ++++
tests/qemuxml2argvmock.c | 3 +-
tests/qemuxml2argvtest.c | 14 ++
28 files changed, 939 insertions(+), 158 deletions(-)
create mode 100644 tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-2.5.0.args
create mode 100644 tests/qemuxml2argvdata/channel-unix-guestfwd.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/channel-unix-guestfwd.xml
create mode 100644 tests/qemuxml2argvdata/console-virtio-unix.x86_64-2.5.0.args
create mode 100644 tests/qemuxml2argvdata/console-virtio-unix.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/console-virtio-unix.xml
create mode 100644 tests/qemuxml2argvdata/net-vhostuser.x86_64-2.5.0.args
create mode 100644 tests/qemuxml2argvdata/net-vhostuser.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/parallel-unix-chardev.x86_64-2.5.0.args
create mode 100644 tests/qemuxml2argvdata/parallel-unix-chardev.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/parallel-unix-chardev.xml
create mode 100644 tests/qemuxml2argvdata/smartcard-passthrough-unix.x86_64-2.5.0.args
create mode 100644 tests/qemuxml2argvdata/smartcard-passthrough-unix.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/smartcard-passthrough-unix.xml
create mode 100644 tests/qemuxml2argvdata/usb-redir-unix.x86_64-2.5.0.args
create mode 100644 tests/qemuxml2argvdata/usb-redir-unix.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/usb-redir-unix.xml
create mode 100644 tests/qemuxml2argvdata/virtio-rng-egd-unix.x86_64-2.5.0.args
create mode 100644 tests/qemuxml2argvdata/virtio-rng-egd-unix.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/virtio-rng-egd-unix.xml
--
2.16.4
6 years, 1 month
[libvirt] [PATCH] virresctrl: remove bogus virResetLastError
by Ján Tomko
virFileReadValueUint does not log errors for non-existient files,
it merely returns -2.
Commit 12093f1 introduced this.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/util/virresctrl.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index fb25ca84f0..df5b5124e6 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -638,7 +638,6 @@ virResctrlGetMonitorInfo(virResctrlInfoPtr resctrl)
VIR_INFO("The file '" SYSFS_RESCTRL_PATH "/info/L3_MON/num_rmids' "
"does not exist");
ret = 0;
- virResetLastError();
goto cleanup;
} else if (rv < 0) {
/* Other failures are fatal, so just quit */
@@ -653,7 +652,6 @@ virResctrlGetMonitorInfo(virResctrlInfoPtr resctrl)
* will not exist. */
VIR_DEBUG("File '" SYSFS_RESCTRL_PATH
"/info/L3_MON/max_threshold_occupancy' does not exist");
- virResetLastError();
} else if (rv < 0) {
goto cleanup;
}
--
2.16.4
6 years, 1 month
[libvirt] [PATCH] virt-host-validate: Fix build on non-Linux
by Michal Privoznik
For non-Linux platforms we have
virHostValidateCGroupControllers() stub which only reports an
error. But we are not marking the ignored arguments the way we
should.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/virt-host-validate-common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index 4e70fe9e9c..73e3bdb34c 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -322,8 +322,8 @@ int virHostValidateCGroupControllers(const char *hvname,
return ret;
}
#else /* !__linux__ */
-int virHostValidateCGroupControllers(const char *hvname,
- int controllers,
+int virHostValidateCGroupControllers(const char *hvname ATTRIBUTE_UNUSED,
+ int controllers ATTRIBUTE_UNUSED,
virHostValidateLevel level)
{
virHostMsgFail(level, "%s", "This platform does not support cgroups");
--
2.18.0
6 years, 1 month
[libvirt] [jenkins-ci PATCH] guests: Allow ssh access as user regardless of flavor
by Andrea Bolognani
We already allow the host user to ssh into guests as root
using key-based authentication, so it makes no sense to
prevent them to ssh in as the regular user.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/playbooks/update/tasks/users.yml | 2 --
1 file changed, 2 deletions(-)
diff --git a/guests/playbooks/update/tasks/users.yml b/guests/playbooks/update/tasks/users.yml
index abaeaa4..0470686 100644
--- a/guests/playbooks/update/tasks/users.yml
+++ b/guests/playbooks/update/tasks/users.yml
@@ -37,8 +37,6 @@
user: '{{ flavor }}'
key: '{{ lookup("file", lookup("env", "HOME") + "/.ssh/id_rsa.pub") }}'
state: present
- when:
- - flavor == 'test'
- name: '{{ flavor }}: Grant passwordless sudo access'
lineinfile:
--
2.17.1
6 years, 1 month