<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/libvirt.git/tests/commanddata, branch master</title>
<subtitle>libvirt.org: git/libvirt.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libvirt.git/'/>
<entry>
<title>commandtest: Test virCommandSetSendBuffer() with virCommandDoAsyncIO()</title>
<updated>2022-12-01T13:22:39+00:00</updated>
<author>
<name>Michal Privoznik</name>
<email>mprivozn@redhat.com</email>
</author>
<published>2022-03-22T11:06:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libvirt.git/commit/?id=e97b6f4bc5e6811998c957566c3b14fe11ea552f'/>
<id>e97b6f4bc5e6811998c957566c3b14fe11ea552f</id>
<content type='text'>
Introduce a test case which ensures that a daemonized process can
work with virCommandSetSendBuffer() when async IO is enabled.

Signed-off-by: Michal Privoznik &lt;mprivozn@redhat.com&gt;
Reviewed-by: Jonathon Jongsma &lt;jjongsma@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Introduce a test case which ensures that a daemonized process can
work with virCommandSetSendBuffer() when async IO is enabled.

Signed-off-by: Michal Privoznik &lt;mprivozn@redhat.com&gt;
Reviewed-by: Jonathon Jongsma &lt;jjongsma@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virCommandToStringFull: Improve linebreaking behaviour</title>
<updated>2021-04-12T13:55:10+00:00</updated>
<author>
<name>Peter Krempa</name>
<email>pkrempa@redhat.com</email>
</author>
<published>2021-04-06T13:17:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libvirt.git/commit/?id=1f61d7129fb8baa1b6c05967c141c75aa701dc67'/>
<id>1f61d7129fb8baa1b6c05967c141c75aa701dc67</id>
<content type='text'>
Put multiple values for an option if followed by another option as used
in certain iptables arguments.

Signed-off-by: Peter Krempa &lt;pkrempa@redhat.com&gt;
Reviewed-by: Ján Tomko &lt;jtomko@redhat.com&gt;
Reviewed-by: Pavel Hrdina &lt;phrdina@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Put multiple values for an option if followed by another option as used
in certain iptables arguments.

Signed-off-by: Peter Krempa &lt;pkrempa@redhat.com&gt;
Reviewed-by: Ján Tomko &lt;jtomko@redhat.com&gt;
Reviewed-by: Pavel Hrdina &lt;phrdina@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tests: commandtest: Make 'test4' checking daemonization more reliable</title>
<updated>2020-07-27T13:44:38+00:00</updated>
<author>
<name>Peter Krempa</name>
<email>pkrempa@redhat.com</email>
</author>
<published>2020-07-21T10:32:10+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libvirt.git/commit/?id=6ae53a1509748290007c6e1df99a97e66ec16497'/>
<id>6ae53a1509748290007c6e1df99a97e66ec16497</id>
<content type='text'>
The 'commandhelper' checks effectively whether the parent process is
still around to report whether it was daemonized or not.

This creates a unlikely race condition in cases when we do actually
daemonize the process as the intermediate process used for the
daemonization might not have terminated yet which would report wrong
result leading to test failure.

For now there's just 'test4' which actually daemonizes the process.

Add an argument '--check-daemonize' which asks for retries of the
daemonization check in cases where we expect that the commandhelper is
going to be daemonized and use it in 'test4' to make the test more
reliable.

I've observed the test failure sporadically when my box is under load
e.g. while building two trees at once.

Signed-off-by: Peter Krempa &lt;pkrempa@redhat.com&gt;
Reviewed-by: Ján Tomko &lt;jtomko@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The 'commandhelper' checks effectively whether the parent process is
still around to report whether it was daemonized or not.

This creates a unlikely race condition in cases when we do actually
daemonize the process as the intermediate process used for the
daemonization might not have terminated yet which would report wrong
result leading to test failure.

For now there's just 'test4' which actually daemonizes the process.

Add an argument '--check-daemonize' which asks for retries of the
daemonization check in cases where we expect that the commandhelper is
going to be daemonized and use it in 'test4' to make the test more
reliable.

I've observed the test failure sporadically when my box is under load
e.g. while building two trees at once.

Signed-off-by: Peter Krempa &lt;pkrempa@redhat.com&gt;
Reviewed-by: Ján Tomko &lt;jtomko@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>util: keep the pidfile locked</title>
<updated>2020-03-25T08:04:49+00:00</updated>
<author>
<name>Marc-André Lureau</name>
<email>marcandre.lureau@redhat.com</email>
</author>
<published>2020-03-24T23:58:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libvirt.git/commit/?id=be00118d5d9a3afb41e0edcddec823dff63a7ae1'/>
<id>be00118d5d9a3afb41e0edcddec823dff63a7ae1</id>
<content type='text'>
Unfortunately, advisory record locking lose the lock if any fd refering
to the file is closed. There doesn't seem to be a way to preserve the
lock atomically. We could eventually retake the lock if low pidfilefd
is required.

This fixes processes being leaked, as they are not killed in
virPidFileForceCleanupPath() if the lock can be taken. Here also, we may
consider this is not good enough, as a process may leak by simply
closing the pidfilefd.

Fixes commit d146105f1e4a9e0ab179f0b78c070ea38b9d5334 ("virCommand:
Actually acquire pidfile instead of just writing it")

Signed-off-by: Marc-André Lureau &lt;marcandre.lureau@redhat.com&gt;
Reviewed-by: Michal Privoznik &lt;mprivozn@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Unfortunately, advisory record locking lose the lock if any fd refering
to the file is closed. There doesn't seem to be a way to preserve the
lock atomically. We could eventually retake the lock if low pidfilefd
is required.

This fixes processes being leaked, as they are not killed in
virPidFileForceCleanupPath() if the lock can be taken. Here also, we may
consider this is not good enough, as a process may leak by simply
closing the pidfilefd.

Fixes commit d146105f1e4a9e0ab179f0b78c070ea38b9d5334 ("virCommand:
Actually acquire pidfile instead of just writing it")

Signed-off-by: Marc-André Lureau &lt;marcandre.lureau@redhat.com&gt;
Reviewed-by: Michal Privoznik &lt;mprivozn@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>virCommand: Actually acquire pidfile instead of just writing it</title>
<updated>2020-03-24T14:44:23+00:00</updated>
<author>
<name>Michal Privoznik</name>
<email>mprivozn@redhat.com</email>
</author>
<published>2020-03-13T12:12:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libvirt.git/commit/?id=d146105f1e4a9e0ab179f0b78c070ea38b9d5334'/>
<id>d146105f1e4a9e0ab179f0b78c070ea38b9d5334</id>
<content type='text'>
Our virCommand module allows us to set a pidfile for commands we
want to spawn. The caller constructs the string of pidfile path
and then uses virCommandSetPidFile() to tell the module to write
the pidfile once the command is ran. This usually works, but has
two flaws:

1) the child process does not hold the pidfile open &amp; locked.
Therefore, the caller (or anybody else) can't use our fancy
virPidFileForceCleanupPath() function to kill the command
afterwards. Also, for everybody else on the system it's
needlessly harder to check if the pid from the pidfile is still
alive or not.

2) if the caller ever makes a mistake and passes the same pidfile
path for two different commands, the start of the second command
will overwrite the pidfile even though the first command might
still be running.

NOTE that this temporarily renders some command spawning
unusable, specifically those code patterns where both
virCommandSetPidFile() is used together with instructing spawned
command to acquire pidfile itself. Fortunately, there is only one
occurrence of such pattern and it is in
qemuProcessStartManagedPRDaemon(). This is fixed in next commit.

Signed-off-by: Michal Privoznik &lt;mprivozn@redhat.com&gt;
Reviewed-by: Marc-André Lureau &lt;marcandre.lureau@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Our virCommand module allows us to set a pidfile for commands we
want to spawn. The caller constructs the string of pidfile path
and then uses virCommandSetPidFile() to tell the module to write
the pidfile once the command is ran. This usually works, but has
two flaws:

1) the child process does not hold the pidfile open &amp; locked.
Therefore, the caller (or anybody else) can't use our fancy
virPidFileForceCleanupPath() function to kill the command
afterwards. Also, for everybody else on the system it's
needlessly harder to check if the pid from the pidfile is still
alive or not.

2) if the caller ever makes a mistake and passes the same pidfile
path for two different commands, the start of the second command
will overwrite the pidfile even though the first command might
still be running.

NOTE that this temporarily renders some command spawning
unusable, specifically those code patterns where both
virCommandSetPidFile() is used together with instructing spawned
command to acquire pidfile itself. Fortunately, there is only one
occurrence of such pattern and it is in
qemuProcessStartManagedPRDaemon(). This is fixed in next commit.

Signed-off-by: Michal Privoznik &lt;mprivozn@redhat.com&gt;
Reviewed-by: Marc-André Lureau &lt;marcandre.lureau@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tests: remove event loop from command test</title>
<updated>2020-02-04T14:00:44+00:00</updated>
<author>
<name>Daniel P. Berrangé</name>
<email>berrange@redhat.com</email>
</author>
<published>2020-01-17T10:52:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libvirt.git/commit/?id=abab604e309c6d41dd4a36f96a8ff63e639d2991'/>
<id>abab604e309c6d41dd4a36f96a8ff63e639d2991</id>
<content type='text'>
This effectively reverts

  commit 39c77fe586baccd0a4a9862e8cf7c78ac7af3494
  Author: Michal Prívozník &lt;mprivozn@redhat.com&gt;
  Date:   Wed Jan 16 11:58:00 2013 +0100

    Introduce event loop to commandtest

because nothing in the current test suite needs this
event loop.

Reviewed-by: Pavel Hrdina &lt;phrdina@redhat.com&gt;
Signed-off-by: Daniel P. Berrangé &lt;berrange@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This effectively reverts

  commit 39c77fe586baccd0a4a9862e8cf7c78ac7af3494
  Author: Michal Prívozník &lt;mprivozn@redhat.com&gt;
  Date:   Wed Jan 16 11:58:00 2013 +0100

    Introduce event loop to commandtest

because nothing in the current test suite needs this
event loop.

Reviewed-by: Pavel Hrdina &lt;phrdina@redhat.com&gt;
Signed-off-by: Daniel P. Berrangé &lt;berrange@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>commandtest: Remove commandhelper.log in test27</title>
<updated>2019-07-29T14:27:05+00:00</updated>
<author>
<name>Michal Privoznik</name>
<email>mprivozn@redhat.com</email>
</author>
<published>2019-07-29T14:11:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libvirt.git/commit/?id=019911339bd270ea61de296d6532d000988ecaca'/>
<id>019911339bd270ea61de296d6532d000988ecaca</id>
<content type='text'>
The recently added test27 spawns commandhelper. This is fine,
except, one of the things that commandhelper does is it records
arguments it was spawn with into commandhelper.log. Other test
cases then use checkoutput() to compare the arguments against the
expected ones and also unlink() the log file. However, test27()
is not doing that and thus it leaves the file behind. This
breaks distcheck.

Signed-off-by: Michal Privoznik &lt;mprivozn@redhat.com&gt;
Reviewed-by: Daniel P. Berrangé &lt;berrange@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The recently added test27 spawns commandhelper. This is fine,
except, one of the things that commandhelper does is it records
arguments it was spawn with into commandhelper.log. Other test
cases then use checkoutput() to compare the arguments against the
expected ones and also unlink() the log file. However, test27()
is not doing that and thus it leaves the file behind. This
breaks distcheck.

Signed-off-by: Michal Privoznik &lt;mprivozn@redhat.com&gt;
Reviewed-by: Daniel P. Berrangé &lt;berrange@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>util: remove code spawning with systemd activation env vars</title>
<updated>2019-07-12T15:55:40+00:00</updated>
<author>
<name>Daniel P. Berrangé</name>
<email>berrange@redhat.com</email>
</author>
<published>2019-06-25T17:09:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libvirt.git/commit/?id=2dfacbffea47743fff942b6401f5f36b3ae4655a'/>
<id>2dfacbffea47743fff942b6401f5f36b3ae4655a</id>
<content type='text'>
The only use of this code was removed by:

  commit be78814ae07f092d9c4e71fd82dd1947aba2f029
  Author: Michal Privoznik &lt;mprivozn@redhat.com&gt;
  Date:   Thu Apr 2 14:41:17 2015 +0200

    virNetSocketNewConnectUNIX: Use flocks when spawning a daemon

less than a year after it was first introduced in

  commit 1b807f92dbb617db5b9d551777d3026d8ff0903f
  Author: Martin Kletzander &lt;mkletzan@redhat.com&gt;
  Date:   Wed Jul 16 08:00:19 2014 +0200

    rpc: pass listen FD to the daemon being started

Reviewed-by: Michal Privoznik &lt;mprivozn@redhat.com&gt;
Signed-off-by: Daniel P. Berrangé &lt;berrange@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The only use of this code was removed by:

  commit be78814ae07f092d9c4e71fd82dd1947aba2f029
  Author: Michal Privoznik &lt;mprivozn@redhat.com&gt;
  Date:   Thu Apr 2 14:41:17 2015 +0200

    virNetSocketNewConnectUNIX: Use flocks when spawning a daemon

less than a year after it was first introduced in

  commit 1b807f92dbb617db5b9d551777d3026d8ff0903f
  Author: Martin Kletzander &lt;mkletzan@redhat.com&gt;
  Date:   Wed Jul 16 08:00:19 2014 +0200

    rpc: pass listen FD to the daemon being started

Reviewed-by: Michal Privoznik &lt;mprivozn@redhat.com&gt;
Signed-off-by: Daniel P. Berrangé &lt;berrange@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>qemu: use line breaks in command line args written to log</title>
<updated>2018-12-17T15:02:11+00:00</updated>
<author>
<name>Daniel P. Berrangé</name>
<email>berrange@redhat.com</email>
</author>
<published>2018-12-14T12:07:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libvirt.git/commit/?id=07c9d6601d0b440acd13794b258bdcb570ae93f4'/>
<id>07c9d6601d0b440acd13794b258bdcb570ae93f4</id>
<content type='text'>
The QEMU command line arguments are very long and currently all written
on a single line to /var/log/libvirt/qemu/$GUEST.log. This introduces
logic to add line breaks after every env variable and "-" optional
argument, and every positional argument. This will create a clearer log
file, which will in turn present better in bug reports when people cut +
paste from the log into a bug comment.

An example log file entry now looks like this:

  2018-12-14 12:57:03.677+0000: starting up libvirt version: 5.0.0, qemu version: 3.0.0qemu-3.0.0-1.fc29, kernel: 4.19.5-300.fc29.x86_64, hostname: localhost.localdomain
  LC_ALL=C \
  PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin \
  HOME=/home/berrange \
  USER=berrange \
  LOGNAME=berrange \
  QEMU_AUDIO_DRV=none \
  /usr/bin/qemu-system-ppc64 \
  -name guest=guest,debug-threads=on \
  -S \
  -object secret,id=masterKey0,format=raw,file=/home/berrange/.config/libvirt/qemu/lib/domain-33-guest/master-key.aes \
  -machine pseries-2.10,accel=tcg,usb=off,dump-guest-core=off \
  -m 1024 \
  -realtime mlock=off \
  -smp 1,sockets=1,cores=1,threads=1 \
  -uuid c8a74977-ab18-41d0-ae3b-4041c7fffbcd \
  -display none \
  -no-user-config \
  -nodefaults \
  -chardev socket,id=charmonitor,fd=23,server,nowait \
  -mon chardev=charmonitor,id=monitor,mode=control \
  -rtc base=utc \
  -no-shutdown \
  -boot strict=on \
  -device qemu-xhci,id=usb,bus=pci.0,addr=0x1 \
  -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
  -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
  -msg timestamp=on
  2018-12-14 12:57:03.730+0000: shutting down, reason=failed

Signed-off-by: Daniel P. Berrangé &lt;berrange@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The QEMU command line arguments are very long and currently all written
on a single line to /var/log/libvirt/qemu/$GUEST.log. This introduces
logic to add line breaks after every env variable and "-" optional
argument, and every positional argument. This will create a clearer log
file, which will in turn present better in bug reports when people cut +
paste from the log into a bug comment.

An example log file entry now looks like this:

  2018-12-14 12:57:03.677+0000: starting up libvirt version: 5.0.0, qemu version: 3.0.0qemu-3.0.0-1.fc29, kernel: 4.19.5-300.fc29.x86_64, hostname: localhost.localdomain
  LC_ALL=C \
  PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin \
  HOME=/home/berrange \
  USER=berrange \
  LOGNAME=berrange \
  QEMU_AUDIO_DRV=none \
  /usr/bin/qemu-system-ppc64 \
  -name guest=guest,debug-threads=on \
  -S \
  -object secret,id=masterKey0,format=raw,file=/home/berrange/.config/libvirt/qemu/lib/domain-33-guest/master-key.aes \
  -machine pseries-2.10,accel=tcg,usb=off,dump-guest-core=off \
  -m 1024 \
  -realtime mlock=off \
  -smp 1,sockets=1,cores=1,threads=1 \
  -uuid c8a74977-ab18-41d0-ae3b-4041c7fffbcd \
  -display none \
  -no-user-config \
  -nodefaults \
  -chardev socket,id=charmonitor,fd=23,server,nowait \
  -mon chardev=charmonitor,id=monitor,mode=control \
  -rtc base=utc \
  -no-shutdown \
  -boot strict=on \
  -device qemu-xhci,id=usb,bus=pci.0,addr=0x1 \
  -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
  -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
  -msg timestamp=on
  2018-12-14 12:57:03.730+0000: shutting down, reason=failed

Signed-off-by: Daniel P. Berrangé &lt;berrange@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tests: fix typo</title>
<updated>2017-11-20T12:22:48+00:00</updated>
<author>
<name>Nikolay Shirokovskiy</name>
<email>nshirokovskiy@virtuozzo.com</email>
</author>
<published>2017-11-17T13:17:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libvirt.git/commit/?id=0d110277c0b57d934415a2ea29d3e6cbf9f0f200'/>
<id>0d110277c0b57d934415a2ea29d3e6cbf9f0f200</id>
<content type='text'>
Signed-off-by: Michal Privoznik &lt;mprivozn@redhat.com&gt;
Reviewed-by: Daniel P. Berrange &lt;berrange@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Michal Privoznik &lt;mprivozn@redhat.com&gt;
Reviewed-by: Daniel P. Berrange &lt;berrange@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
