[libvirt] [PATCH v2 0/3] adding virGetLastErrorCode/Domain to paritally replace virGetLastError
by ramyelkest
Changes from v1[1]:
* removed virHasLastError() and s/virHasLastError/virGetLastErrorCode/g
* replaced in missed files: virmodule.c and virnetlibsshsession.c
* better split of patches
[1] https://www.redhat.com/archives/libvir-list/2018-May/msg00259.html
ramyelkest (3):
util: cleanup: using virGetLastErrorMessage instead of err->message
util: added virGetLastErrorCode/Domain
all: replacing virGetLastError with virGetLastErrorCode where we can
include/libvirt/virterror.h | 2 ++
src/libvirt_public.syms | 6 ++++++
src/locking/lock_driver_lockd.c | 3 +--
src/lxc/lxc_controller.c | 4 +---
src/qemu/qemu_agent.c | 3 +--
src/qemu/qemu_conf.c | 3 +--
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 12 ++++++------
src/qemu/qemu_hotplug.c | 2 +-
src/qemu/qemu_migration.c | 4 ++--
src/qemu/qemu_monitor.c | 5 ++---
src/qemu/qemu_monitor_json.c | 2 +-
src/qemu/qemu_process.c | 4 ++--
src/remote/remote_driver.c | 3 +--
src/rpc/virnetclient.c | 2 +-
src/rpc/virnetlibsshsession.c | 4 +---
src/util/virerror.c | 42 +++++++++++++++++++++++++++++++++++++++++
src/util/virfilecache.c | 3 +--
src/util/virmodule.c | 3 +--
src/util/virxml.c | 4 ++--
tests/commandtest.c | 2 +-
tests/testutils.c | 6 ++----
tests/virhostcputest.c | 2 +-
tests/virstoragetest.c | 8 ++++----
tools/virsh-domain-monitor.c | 7 +++----
tools/virsh-domain.c | 4 +---
tools/virsh-util.c | 3 +--
tools/vsh.c | 2 +-
28 files changed, 90 insertions(+), 57 deletions(-)
--
2.7.4
6 years, 4 months
[libvirt] [PATCH v3 0/4] qemu: use FD passing for chardev UNIX sockets
by Daniel P. Berrangé
This series makes use of the chardev fd passing arriving in QEMU 2.12
to get rid of the startup race wrt opening the QEMU monitor. It is
actually enabled in all chardev UNIX sockets for sake of having the
same codepath everywhere, but is only important for the monitor socket.
Changed in v3:
- Refactor UNIX socket opening code to allow it to be mocked
in the unit tests to avoid creating real UNIX sockets
Daniel P. Berrangé (4):
qemu: probe for -chardev 'fd' parameter for FD passing
qemu: support passing pre-opened UNIX socket listen FD
qemu: don't retry connect() if doing FD passing
qemu: remove pointless connect retry logic in agent
src/qemu/qemu_agent.c | 84 ++-----------------
src/qemu/qemu_capabilities.c | 4 +-
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 64 +++++++++++++-
src/qemu/qemu_command.h | 4 +
src/qemu/qemu_monitor.c | 54 +++++++-----
src/qemu/qemu_monitor.h | 1 +
src/qemu/qemu_process.c | 27 ++++--
.../caps_2.12.0.aarch64.xml | 1 +
.../caps_2.12.0.ppc64.xml | 1 +
.../caps_2.12.0.s390x.xml | 1 +
.../caps_2.12.0.x86_64.xml | 1 +
tests/qemumonitortestutils.c | 1 +
.../disk-drive-write-cache.x86_64-latest.args | 3 +-
...irtio-scsi-reservations.x86_64-latest.args | 3 +-
tests/qemuxml2argvmock.c | 16 ++++
16 files changed, 153 insertions(+), 113 deletions(-)
--
2.17.0
6 years, 4 months
[libvirt] [PATCH v8 00/18] Add support for TPM emulator (for 4.5)
by Stefan Berger
This series of patches adds support for the TPM emulator backend that
is available in QEMU and based on swtpm + libtpms. It allows to attach a
TPM 1.2 or 2 to a QEMU VM. sVirt labels are used for labeling the swtpm
process, its Unix socket, and log file with the same label that the
QEMU process gets. Besides that swtpm is added to the emulator cgroup to
restrict its CPU usage.
The device XML can be changed from a TPM 1.2 to a TPM 2 and back to a
TPM 1.2. The device state is not removed during those changes but only
when the domain is undefined.
The swtpm needs persistent storage to store its state. For that I am
using the uuid of the VM as part of the path since the name of the VM
can be changed. Logfiles, PID files, and socket names are based on the
name of the VM, though.
Stefan
v7->v8:
- Delaying this series for 4.5; adjusted references to 4.4
- Fixed a test case since version='1.2' is now formatted as well
- Appended patches for AppArmor and auditing
- Appended patches that improve / fix existing code
- patch for validating the TPM configuration rather than overwriting it;
a particular case is the CRB interface does not work with a TPM 1.2
- swtpm_setup can be run for a TPM 2 in unprivileged mode as well
v6->v7:
- followed Jan Tomko's suggestion with resulting changing to patch
10/12.
- re-added missing parts related to swtpm_setup and TPM that got lost
in v4
v5->v6:
- Addressed John Ferlan's comments
- rebased on latest tip
- Added patch 12.
v4->v5:
- Addressed John Ferlan's, Boris Fiuczysnki's and Marc Hartmayer's comments
- rebased on latest tip
v3->v4:
- Addressed John Ferlan's comments
- Fixed bugs I found while testing
- rebased on latest tip
Stefan Berger (18):
conf: Add support for external swtpm TPM emulator to domain XML
qemu: Extend QEMU capabilities with 'tpm-emulator'
util: Implement virFileChownFiles()
security: Add DAC and SELinux security for tpm-emulator
qemu: Extend qemu_conf with tpm-emulator support
qemu: Extend QEMU with external TPM support
qemu: Add support for external swtpm TPM emulator
tests: Add test cases for external swtpm TPM emulator
security: Label the external swtpm with SELinux labels
conf: Add support for choosing emulation of a TPM 2
qemu: Add swtpm to emulator cgroup
news: Update news with new TPM emulator feature
security: Add swtpm paths to the domain's AppArmor profile
qemu: Run swtpm_setup in unprivileged mode for a TPM 2
qemu: Validate chosen TPM model rather than overwriting it
conf: Audit TPM emulator device at domain startup
conf: Use resrc=tpm in case of TPM passthrough following docs
conf: Use virDomainChrSourceDefClear() rather than VIR_FREE()
docs/auditlog.html.in | 2 +-
docs/formatdomain.html.in | 43 +
docs/news.xml | 13 +
docs/schemas/domaincommon.rng | 17 +
examples/apparmor/libvirt-qemu | 3 +
libvirt.spec.in | 2 +
src/conf/domain_audit.c | 20 +-
src/conf/domain_conf.c | 49 +-
src/conf/domain_conf.h | 15 +
src/libvirt_private.syms | 3 +
src/qemu/Makefile.inc.am | 10 +
src/qemu/libvirtd_qemu.aug | 5 +
src/qemu/qemu.conf | 8 +
src/qemu/qemu_capabilities.c | 5 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_cgroup.c | 36 +
src/qemu/qemu_cgroup.h | 2 +
src/qemu/qemu_command.c | 34 +-
src/qemu/qemu_conf.c | 43 +
src/qemu/qemu_conf.h | 6 +
src/qemu/qemu_domain.c | 31 +-
src/qemu/qemu_extdevice.c | 180 ++++
src/qemu/qemu_extdevice.h | 59 ++
src/qemu/qemu_process.c | 16 +
src/qemu/qemu_security.c | 69 ++
src/qemu/qemu_security.h | 11 +
src/qemu/qemu_tpm.c | 922 +++++++++++++++++++++
src/qemu/qemu_tpm.h | 56 ++
src/qemu/test_libvirtd_qemu.aug.in | 2 +
src/security/security_dac.c | 7 +
src/security/security_driver.h | 7 +
src/security/security_manager.c | 36 +
src/security/security_manager.h | 6 +
src/security/security_selinux.c | 172 ++++
src/security/security_stack.c | 40 +
src/security/virt-aa-helper.c | 24 +
src/util/virfile.c | 55 ++
src/util/virfile.h | 3 +
tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 +
.../tpm-emulator-tpm2.x86_64-latest.args | 33 +
tests/qemuxml2argvdata/tpm-emulator-tpm2.xml | 30 +
.../tpm-emulator.x86_64-latest.args | 33 +
tests/qemuxml2argvdata/tpm-emulator.xml | 30 +
tests/qemuxml2argvtest.c | 16 +-
tests/qemuxml2xmloutdata/tpm-emulator-tpm2.xml | 34 +
tests/qemuxml2xmloutdata/tpm-emulator.xml | 34 +
tests/qemuxml2xmltest.c | 1 +
51 files changed, 2212 insertions(+), 17 deletions(-)
create mode 100644 src/qemu/qemu_extdevice.c
create mode 100644 src/qemu/qemu_extdevice.h
create mode 100644 src/qemu/qemu_tpm.c
create mode 100644 src/qemu/qemu_tpm.h
create mode 100644 tests/qemuxml2argvdata/tpm-emulator-tpm2.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/tpm-emulator-tpm2.xml
create mode 100644 tests/qemuxml2argvdata/tpm-emulator.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/tpm-emulator.xml
create mode 100644 tests/qemuxml2xmloutdata/tpm-emulator-tpm2.xml
create mode 100644 tests/qemuxml2xmloutdata/tpm-emulator.xml
--
2.14.3
6 years, 4 months
[libvirt] [PATCH 0/8] vsock hotplug
by Ján Tomko
Followup for:
https://bugzilla.redhat.com/show_bug.cgi?id=1291851
Ján Tomko (8):
qemu: split out qemuBuildVsockDevStr
qemuBuildVsockDevStr: allow passing a fdprefix
export virDomainVsockDefFree
qemu: export vsock-related functions
qemu: implement vsock hotplug
conf: introduce virDomainVsockDefEquals
qemu: implement vsock hotunplug
qemu: implement vsock coldplug/coldunplug
src/conf/domain_conf.c | 18 +++++++
src/conf/domain_conf.h | 3 ++
src/libvirt_private.syms | 2 +
src/qemu/qemu_alias.c | 2 +-
src/qemu/qemu_alias.h | 2 +
src/qemu/qemu_command.c | 39 ++++++++++----
src/qemu/qemu_command.h | 8 +++
src/qemu/qemu_driver.c | 36 +++++++++++--
src/qemu/qemu_hotplug.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++-
src/qemu/qemu_hotplug.h | 7 +++
src/qemu/qemu_process.c | 2 +-
src/qemu/qemu_process.h | 2 +
12 files changed, 241 insertions(+), 18 deletions(-)
--
2.16.1
6 years, 4 months
[libvirt] [jenkins-ci PATCH 0/5] guests: Make Perl and Python paths dynamic
by Andrea Bolognani
Plus other cleanups. See patches 3/5 and 4/5 for the good stuff.
Andrea Bolognani (5):
guests: Add .j2 extension to existing templates
guests: Remove distinction between files and templates
guests: Make PERL5LIB dynamic
guests: Make PYTHONPATH dynamic
guests: Move remaining paths out of the inventory
guests/group_vars/all/main.yml | 13 --------
guests/host_vars/libvirt-centos-6/main.yml | 3 --
guests/host_vars/libvirt-centos-7/main.yml | 3 --
guests/host_vars/libvirt-debian-8/main.yml | 3 --
guests/host_vars/libvirt-debian-9/main.yml | 3 --
guests/host_vars/libvirt-debian-sid/main.yml | 3 --
guests/host_vars/libvirt-fedora-27/main.yml | 3 --
guests/host_vars/libvirt-fedora-28/main.yml | 3 --
.../host_vars/libvirt-fedora-rawhide/main.yml | 3 --
guests/host_vars/libvirt-freebsd-10/main.yml | 3 --
guests/host_vars/libvirt-freebsd-11/main.yml | 3 --
.../libvirt-freebsd-current/main.yml | 3 --
guests/host_vars/libvirt-ubuntu-14/main.yml | 3 --
guests/host_vars/libvirt-ubuntu-16/main.yml | 3 --
guests/host_vars/libvirt-ubuntu-18/main.yml | 3 --
guests/tasks/base.yml | 12 +++----
guests/tasks/users.yml | 6 ++--
.../{bash_profile => bash_profile.j2} | 0
guests/templates/bashrc | 20 ------------
guests/templates/bashrc.j2 | 32 +++++++++++++++++++
.../ccache.conf => templates/ccache.conf.j2} | 0
.../fedora-rawhide-kernel-nodebug.repo.j2} | 0
.../jessie-backports.preferences.j2} | 0
.../jessie-backports.sources.j2} | 0
24 files changed, 41 insertions(+), 84 deletions(-)
rename guests/templates/{bash_profile => bash_profile.j2} (100%)
delete mode 100644 guests/templates/bashrc
create mode 100644 guests/templates/bashrc.j2
rename guests/{files/ccache.conf => templates/ccache.conf.j2} (100%)
rename guests/{files/fedora-rawhide-kernel-nodebug.repo => templates/fedora-rawhide-kernel-nodebug.repo.j2} (100%)
rename guests/{files/jessie-backports.preferences => templates/jessie-backports.preferences.j2} (100%)
rename guests/{files/jessie-backports.sources => templates/jessie-backports.sources.j2} (100%)
--
2.17.0
6 years, 4 months
[libvirt] [jenkins-ci PATCH] guests: Fix os_version for development branches
by Andrea Bolognani
We currently know about three development branches: Fedora
Rawhide, Debian sid and FreeBSD -CURRENT.
For all three, we use the name of the development branch in
the guest name; however, the value of os_version is not set
consistently, making it awkward to create package mappings
specific to these development branches.
As an added bonus, this makes the code setting os_name and
os_version more straightforward by simplifying conditionals
and removing regexp-based string replacement.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/tasks/base.yml | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index 70d5abc..9f27470 100644
--- a/guests/tasks/base.yml
+++ b/guests/tasks/base.yml
@@ -2,25 +2,33 @@
- name: Set additional facts (OS)
set_fact:
os_name: '{{ ansible_distribution }}'
+
+- name: Set additional facts (OS)
+ set_fact:
os_version: '{{ ansible_distribution_major_version }}'
when:
- - ansible_distribution != 'FreeBSD'
- - ansible_distribution_release != 'Rawhide'
+ - ansible_distribution_major_version is defined
- name: Set additional facts (OS)
set_fact:
- os_name: '{{ ansible_distribution }}'
os_version: Rawhide
when:
- - ansible_distribution != 'FreeBSD'
+ - os_name == 'Fedora'
- ansible_distribution_release == 'Rawhide'
- name: Set additional facts (OS)
set_fact:
- os_name: '{{ ansible_distribution }}'
- os_version: '{{ ansible_distribution_release|regex_replace("^(\d+)\.\d+-.*$", "\1") }}'
+ os_version: Sid
+ when:
+ - os_name == 'Debian'
+ - '{{ ansible_distribution_major_version|match("^.*/sid$") }}'
+
+- name: Set additional facts (OS)
+ set_fact:
+ os_version: Current
when:
- ansible_distribution == 'FreeBSD'
+ - '{{ ansible_distribution_release|match("^.*-CURRENT$") }}'
- name: Set additional facts (package format)
set_fact:
--
2.17.0
6 years, 4 months
[libvirt] [PATCH V2] tests: xmconfigtest: add tests for cmdline formating
by Jim Fehlig
Commit 656151bf fixed formatting of the <cmdline> element. Perhaps it
would have been noticed and fixed earlier if we had a test. With this
change, all possible cases of formating <cmdline> from xmconfig are
covered
1. no 'extra=' or 'root=' in xm.cfg
2. 'extra=' but no 'root=' in xm.cfg
3. 'root=' but no 'extra=' in xm.cfg
4. both 'root=' and 'extra=' in xm.cfg
Case 1 is covered by all existing paravirt tests since they have no
'extra=' or 'root='. Case 2 is covered by adding 'extra=' to a few
of the existing paravirt tests. Cases 3 and 4 are covered by new
tests that only test conversion of xm.cfg to xml.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
tests/xmconfigdata/test-paravirt-extra-root.cfg | 13 ++++++++++
tests/xmconfigdata/test-paravirt-extra-root.xml | 34 +++++++++++++++++++++++++
tests/xmconfigdata/test-paravirt-maxvcpus.cfg | 1 +
tests/xmconfigdata/test-paravirt-maxvcpus.xml | 1 +
tests/xmconfigdata/test-paravirt-root.cfg | 12 +++++++++
tests/xmconfigdata/test-paravirt-root.xml | 34 +++++++++++++++++++++++++
tests/xmconfigdata/test-paravirt-vcpu.cfg | 1 +
tests/xmconfigdata/test-paravirt-vcpu.xml | 1 +
tests/xmconfigtest.c | 2 ++
9 files changed, 99 insertions(+)
create mode 100644 tests/xmconfigdata/test-paravirt-extra-root.cfg
create mode 100644 tests/xmconfigdata/test-paravirt-extra-root.xml
create mode 100644 tests/xmconfigdata/test-paravirt-root.cfg
create mode 100644 tests/xmconfigdata/test-paravirt-root.xml
diff --git a/tests/xmconfigdata/test-paravirt-extra-root.cfg b/tests/xmconfigdata/test-paravirt-extra-root.cfg
new file mode 100644
index 0000000000..2569f2f22c
--- /dev/null
+++ b/tests/xmconfigdata/test-paravirt-extra-root.cfg
@@ -0,0 +1,13 @@
+name = "XenGuest1"
+uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
+memory = 512
+vcpus = 2
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
+bootloader = "/usr/bin/pygrub"
+root = "/dev/xvda2"
+extra = "console=hvc0"
+disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
diff --git a/tests/xmconfigdata/test-paravirt-extra-root.xml b/tests/xmconfigdata/test-paravirt-extra-root.xml
new file mode 100644
index 0000000000..325b07d8e1
--- /dev/null
+++ b/tests/xmconfigdata/test-paravirt-extra-root.xml
@@ -0,0 +1,34 @@
+<domain type='xen'>
+ <name>XenGuest1</name>
+ <uuid>c7a5fdb0-cdaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>524288</memory>
+ <currentMemory unit='KiB'>524288</currentMemory>
+ <vcpu placement='static'>2</vcpu>
+ <bootloader>/usr/bin/pygrub</bootloader>
+ <os>
+ <type arch='x86_64' machine='xenpv'>linux</type>
+ <cmdline>root=/dev/xvda2 console=hvc0</cmdline>
+ </os>
+ <clock offset='utc' adjustment='reset'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <disk type='block' device='disk'>
+ <driver name='phy' type='raw'/>
+ <source dev='/dev/HostVG/XenGuest1'/>
+ <target dev='xvda' bus='xen'/>
+ </disk>
+ <interface type='bridge'>
+ <mac address='00:16:3e:66:94:9c'/>
+ <source bridge='br0'/>
+ <script path='vif-bridge'/>
+ </interface>
+ <console type='pty'>
+ <target type='xen' port='0'/>
+ </console>
+ <input type='mouse' bus='xen'/>
+ <input type='keyboard' bus='xen'/>
+ <memballoon model='xen'/>
+ </devices>
+</domain>
diff --git a/tests/xmconfigdata/test-paravirt-maxvcpus.cfg b/tests/xmconfigdata/test-paravirt-maxvcpus.cfg
index 8d1ac4d786..f06db61171 100644
--- a/tests/xmconfigdata/test-paravirt-maxvcpus.cfg
+++ b/tests/xmconfigdata/test-paravirt-maxvcpus.cfg
@@ -10,4 +10,5 @@ on_reboot = "restart"
on_crash = "restart"
vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
bootloader = "/usr/bin/pygrub"
+extra = "console=hvc0"
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
diff --git a/tests/xmconfigdata/test-paravirt-maxvcpus.xml b/tests/xmconfigdata/test-paravirt-maxvcpus.xml
index ce66503dc5..3012821ad4 100644
--- a/tests/xmconfigdata/test-paravirt-maxvcpus.xml
+++ b/tests/xmconfigdata/test-paravirt-maxvcpus.xml
@@ -7,6 +7,7 @@
<bootloader>/usr/bin/pygrub</bootloader>
<os>
<type arch='x86_64' machine='xenpv'>linux</type>
+ <cmdline>console=hvc0</cmdline>
</os>
<clock offset='utc' adjustment='reset'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/xmconfigdata/test-paravirt-root.cfg b/tests/xmconfigdata/test-paravirt-root.cfg
new file mode 100644
index 0000000000..8cdfbd9384
--- /dev/null
+++ b/tests/xmconfigdata/test-paravirt-root.cfg
@@ -0,0 +1,12 @@
+name = "XenGuest1"
+uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
+memory = 512
+vcpus = 2
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
+bootloader = "/usr/bin/pygrub"
+root = "/dev/xvda2"
+disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
diff --git a/tests/xmconfigdata/test-paravirt-root.xml b/tests/xmconfigdata/test-paravirt-root.xml
new file mode 100644
index 0000000000..12d1e3bdbd
--- /dev/null
+++ b/tests/xmconfigdata/test-paravirt-root.xml
@@ -0,0 +1,34 @@
+<domain type='xen'>
+ <name>XenGuest1</name>
+ <uuid>c7a5fdb0-cdaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>524288</memory>
+ <currentMemory unit='KiB'>524288</currentMemory>
+ <vcpu placement='static'>2</vcpu>
+ <bootloader>/usr/bin/pygrub</bootloader>
+ <os>
+ <type arch='x86_64' machine='xenpv'>linux</type>
+ <cmdline>root=/dev/xvda2</cmdline>
+ </os>
+ <clock offset='utc' adjustment='reset'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <disk type='block' device='disk'>
+ <driver name='phy' type='raw'/>
+ <source dev='/dev/HostVG/XenGuest1'/>
+ <target dev='xvda' bus='xen'/>
+ </disk>
+ <interface type='bridge'>
+ <mac address='00:16:3e:66:94:9c'/>
+ <source bridge='br0'/>
+ <script path='vif-bridge'/>
+ </interface>
+ <console type='pty'>
+ <target type='xen' port='0'/>
+ </console>
+ <input type='mouse' bus='xen'/>
+ <input type='keyboard' bus='xen'/>
+ <memballoon model='xen'/>
+ </devices>
+</domain>
diff --git a/tests/xmconfigdata/test-paravirt-vcpu.cfg b/tests/xmconfigdata/test-paravirt-vcpu.cfg
index 8d1ac4d786..f06db61171 100644
--- a/tests/xmconfigdata/test-paravirt-vcpu.cfg
+++ b/tests/xmconfigdata/test-paravirt-vcpu.cfg
@@ -10,4 +10,5 @@ on_reboot = "restart"
on_crash = "restart"
vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
bootloader = "/usr/bin/pygrub"
+extra = "console=hvc0"
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
diff --git a/tests/xmconfigdata/test-paravirt-vcpu.xml b/tests/xmconfigdata/test-paravirt-vcpu.xml
index ce66503dc5..3012821ad4 100644
--- a/tests/xmconfigdata/test-paravirt-vcpu.xml
+++ b/tests/xmconfigdata/test-paravirt-vcpu.xml
@@ -7,6 +7,7 @@
<bootloader>/usr/bin/pygrub</bootloader>
<os>
<type arch='x86_64' machine='xenpv'>linux</type>
+ <cmdline>console=hvc0</cmdline>
</os>
<clock offset='utc' adjustment='reset'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index 6851fa73cd..eaec7c3a5c 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -200,6 +200,8 @@ mymain(void)
DO_TEST("paravirt-net-vifname");
DO_TEST("paravirt-vcpu");
DO_TEST("paravirt-maxvcpus");
+ DO_TEST_FORMAT("paravirt-root");
+ DO_TEST_FORMAT("paravirt-extra-root");
DO_TEST("fullvirt-new-cdrom");
DO_TEST("fullvirt-utc");
DO_TEST("fullvirt-localtime");
--
2.16.3
6 years, 5 months
[libvirt] [PATCH] nwfilter: directly use poll to wait for packets instead of pcap_next
by Daniel P. Berrangé
When a QEMU VM shuts down its TAP device gets deleted while nwfilter
IP address learning thread is still capturing packets. It is seen that
with TPACKET_V3 support in libcap, the pcap_next() call will not always
exit its poll() when the NIC is removed. This prevents the learning
thread from exiting which blocks the rest of libvirtd waiting on mutex
acquisition. By switching to do poll() in libvirt code, we can ensure
that we always exit the poll() at a time that is right for libvirt.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/nwfilter/nwfilter_learnipaddr.c | 37 +++++++++++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 061b39d72b..e117be9ce2 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -31,6 +31,7 @@
#include <fcntl.h>
#include <sys/ioctl.h>
+#include <poll.h>
#include <arpa/inet.h>
#include <net/ethernet.h>
@@ -414,6 +415,7 @@ learnIPAddressThread(void *arg)
bool showError = true;
enum howDetect howDetected = 0;
virNWFilterTechDriverPtr techdriver = req->techdriver;
+ struct pollfd fds[1];
if (virNWFilterLockIface(req->ifname) < 0)
goto err_no_lock;
@@ -435,6 +437,9 @@ learnIPAddressThread(void *arg)
goto done;
}
+ fds[0].fd = pcap_fileno(handle);
+ fds[0].events = POLLIN | POLLERR;
+
virMacAddrFormat(&req->macaddr, macaddr);
switch (req->howDetect) {
@@ -483,17 +488,45 @@ learnIPAddressThread(void *arg)
pcap_freecode(&fp);
while (req->status == 0 && vmaddr == 0) {
+ int n = poll(fds, ARRAY_CARDINALITY(fds), PKT_TIMEOUT_MS);
+
+ if (n < 0) {
+ if (errno == EAGAIN || errno == EINTR)
+ continue;
+
+ req->status = errno;
+ showError = true;
+ break;
+ }
+
+ if (n == 0) {
+ if (threadsTerminate || req->terminate) {
+ VIR_DEBUG("Terminate request seen, cancelling pcap");
+ req->status = ECANCELED;
+ showError = false;
+ break;
+ }
+ continue;
+ }
+
+ if (fds[0].revents & (POLLHUP | POLLERR)) {
+ VIR_DEBUG("Error from FD probably dev deleted");
+ req->status = ENODEV;
+ showError = false;
+ break;
+ }
+
packet = pcap_next(handle, &header);
if (!packet) {
-
+ /* Already handled with poll, but lets be sure */
if (threadsTerminate || req->terminate) {
req->status = ECANCELED;
showError = false;
break;
}
- /* check whether VM's dev is still there */
+ /* Again, already handled above, but lets be sure */
if (virNetDevValidateConfig(req->ifname, NULL, req->ifindex) <= 0) {
virResetLastError();
req->status = ENODEV;
--
2.17.0
6 years, 5 months
[libvirt] [PATCH] conf: Introduce align for hostmem-file
by Jie Wang
QEMU has add the 'align' option to 'memory-backend-file'. Expose
this option to users by new element align.
Signed-off-by: Jie Wang <wangjie88(a)huawei.com>
---
docs/formatdomain.html.in | 18 +++++++
docs/schemas/domaincommon.rng | 7 +++
src/conf/domain_conf.c | 14 +++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 4 ++
.../memory-hotplug-nvdimm-align.args | 31 +++++++++++
.../memory-hotplug-nvdimm-align.xml | 63 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 3 ++
.../memory-hotplug-nvdimm-align.xml | 1 +
tests/qemuxml2xmltest.c | 1 +
10 files changed, 143 insertions(+)
create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.args
create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
create mode 100644 tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-align.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0d0fd3b..29fe145 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7932,6 +7932,9 @@ qemu-kvm -net nic,model=? /dev/null
</target>
</memory>
<memory model='nvdimm'>
+ <align>
+ <sieze unit='KiB'>2048</size>
+ </align>
<source>
<path>/tmp/nvdimm</path>
</source>
@@ -7983,6 +7986,21 @@ qemu-kvm -net nic,model=? /dev/null
</p>
</dd>
+ <dt><code>align</code></dt>
+ <dd>
+ <p>
+ For NVDIMM type devices one can optionally use
+ <code>align</code> and its subelement <code>size</code>
+ to configure the size of alignment within the NVDIMM module.
+ The <code>size</code> element has usual meaning described
+ <a href="#elementsMemoryAllocation">here</a>.
+ For QEMU domains the following restrictions apply:
+ </p>
+ <ol>
+ <li>the alignment must be multiples of page size 4KiB,</li>
+ </ol>
+ </dd>
+
<dt><code>source</code></dt>
<dd>
<p>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 71ac3d0..9e994b1 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5145,6 +5145,13 @@
<ref name="virYesNo"/>
</attribute>
</optional>
+ <optional>
+ <element name="align">
+ <element name="size">
+ <ref name="scaledInteger"/>
+ </element>
+ </element>
+ </optional>
<interleave>
<optional>
<ref name="memorydev-source"/>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3689ac0..bf91167 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15739,6 +15739,12 @@ virDomainMemoryDefParseXML(virDomainXMLOptionPtr xmlopt,
}
VIR_FREE(tmp);
+ if ((node = virXPathNode("./align", ctxt))) {
+ if (virDomainParseMemory("./align/size", "./align/size/@unit", ctxt,
+ &def->align, true, false) < 0)
+ goto error;
+ }
+
/* source */
if ((node = virXPathNode("./source", ctxt)) &&
virDomainMemorySourceDefParseXML(node, ctxt, def) < 0)
@@ -25334,6 +25340,14 @@ virDomainMemoryDefFormat(virBufferPtr buf,
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
+ if (def->align) {
+ virBufferAddLit(buf, "<align>\n");
+ virBufferAdjustIndent(buf, 2);
+ virBufferAsprintf(buf, "<size unit='KiB'>%llu</size>\n", def->align);
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</align>\n");
+ }
+
if (virDomainMemorySourceDefFormat(buf, def) < 0)
return -1;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a78fdee..1155c84 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2107,6 +2107,7 @@ typedef enum {
struct _virDomainMemoryDef {
virDomainMemoryAccess access;
virTristateBool discard;
+ unsigned long long align;
/* source */
virBitmapPtr sourceNodes;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c423733..5862457 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3186,6 +3186,10 @@ qemuBuildMemoryBackendStr(virJSONValuePtr *backendProps,
if (virJSONValueObjectAdd(props, "U:size", mem->size * 1024, NULL) < 0)
goto cleanup;
+ if (mem->align &&
+ virJSONValueObjectAdd(props, "u:align", mem->align * 1024, NULL) < 0)
+ goto cleanup;
+
if (mem->sourceNodes) {
nodemask = mem->sourceNodes;
} else {
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.args
new file mode 100644
index 0000000..e6fcf58
--- /dev/null
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.args
@@ -0,0 +1,31 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off,nvdimm=on \
+-m size=219136k,slots=16,maxmem=1099511627776k \
+-smp 2,sockets=2,cores=1,threads=1 \
+-numa node,nodeid=0,cpus=0-1,mem=214 \
+-object memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm,\
+share=no,size=536870912,align=2097152 \
+-device nvdimm,node=0,label-size=131072,memdev=memnvdimm0,id=nvdimm0,slot=0 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
new file mode 100644
index 0000000..aa9e99b
--- /dev/null
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
@@ -0,0 +1,63 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
+ <memory unit='KiB'>1267710</memory>
+ <currentMemory unit='KiB'>1267710</currentMemory>
+ <vcpu placement='static' cpuset='0-1'>2</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <idmap>
+ <uid start='0' target='1000' count='10'/>
+ <gid start='0' target='1000' count='10'/>
+ </idmap>
+ <cpu>
+ <topology sockets='2' cores='1' threads='1'/>
+ <numa>
+ <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
+ </numa>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-i686</emulator>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </memballoon>
+ <memory model='nvdimm' access='private'>
+ <align>
+ <size unit='KiB'>2048</size>
+ </align>
+ <source>
+ <path>/tmp/nvdimm</path>
+ </source>
+ <target>
+ <size unit='KiB'>523264</size>
+ <node>0</node>
+ <label>
+ <size unit='KiB'>128</size>
+ </label>
+ </target>
+ <address type='dimm' slot='0'/>
+ </memory>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 07e5ba1..4674ded 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2588,6 +2588,9 @@ mymain(void)
DO_TEST("memory-hotplug-nvdimm-label",
QEMU_CAPS_DEVICE_NVDIMM,
QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
+ DO_TEST("memory-hotplug-nvdimm-align",
+ QEMU_CAPS_DEVICE_NVDIMM,
+ QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("machine-aeskeywrap-on-caps",
QEMU_CAPS_AES_KEY_WRAP,
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-align.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-align.xml
new file mode 100644
index 0000000..9fc6001
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-align.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 7cedc2b..822e98a 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1098,6 +1098,7 @@ mymain(void)
DO_TEST("memory-hotplug-nvdimm", NONE);
DO_TEST("memory-hotplug-nvdimm-access", NONE);
DO_TEST("memory-hotplug-nvdimm-label", NONE);
+ DO_TEST("memory-hotplug-nvdimm-align", NONE);
DO_TEST("net-udp", NONE);
DO_TEST("video-virtio-gpu-device", NONE);
--
1.8.3.1
6 years, 5 months
[libvirt] [PATCH] Add Virtlyst web application to apps.html
by Daniel Nicoletti
---
docs/apps.html.in | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/docs/apps.html.in b/docs/apps.html.in
index 863be4ff23..0aa3568eed 100644
--- a/docs/apps.html.in
+++ b/docs/apps.html.in
@@ -466,6 +466,21 @@
minutes. The only requirements for the users are a Web browser and
a lightweight remote viewer.
</dd>
+ <dt><a href="https://github.com/cutelyst/Virtlyst">Virtlyst</a></dt>
+ <dd>
+ Virtlyst is an open source web application built with C++11, Cutelyst and Qt.
+ It features:
+ <ul>
+ <li>Low memory usage (around 5 MiB of RAM)</li>
+ <li>Look and feel easily customized with HTML templates that use the Django syntax</li>
+ <li>VNC/Spice console pages</li>
+ <li>Host and Domain stats graphs (CPU, Memory, IO, Network)</li>
+ <li>Connect to multiple libvirtd intances (over local unix socket, SSH, TCP and TLS)</li>
+ <li>Manage Storages, Networks, Interfaces and Secrets</li>
+ <li>Create and launch VMs</li>
+ <li>Configure VMs with easy pannels or go pro and edit it's XML</li>
+ </ul>
+ </dd>
</dl>
<h2><a id="mobile">Mobile applications</a></h2>
--
2.17.0
6 years, 5 months