All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
To: "Denis V. Lunev" <den@openvz.org>, svt-core@virtuozzo.com
Cc: den@virtuozzo.com
Subject: Re: [PATCH 3/3] iotests/migrate-cpr-exec: cover chardevs with logfile= #VSTOR-148304
Date: Mon, 5 Oct 2026 12:05:24 +0300	[thread overview]
Message-ID: <d3cbad7f-1817-4743-9339-b2d9a8f25f15@virtuozzo.com> (raw)
In-Reply-To: <20261002164853.2130337-4-den@openvz.org>

One important case isn't covered. Namely, when source does NOT save the
log FD and target has to proceed without it - what we saw in the
VSTOR-148304.

1. Start with -chardev pty,id=char0 (no log) and isa-serial.
2. In the pre-CPR hook, replace that arg with
pty,id=char0,logfile=<BAD_LOG>.
3. After CPR, check that the VM is still running and that BAD_LOG was
not created (put it in an existing directory, so a reopen by path would
show up).
4. After shutdown, check that self.vm.get_log() contains log file was
not preserved, continuing without it. The exec'd QEMU inherits the old
process's stderr, so the warning ends up in the same log.

Please add this case.


On 10/2/26 7:48 PM, Denis V. Lunev wrote:
> From: Denis V. Lunev <den@openvz.org>
> 
> Run a console pty with its log in an fdset, a guest agent socket and a
> second QMP monitor, each with a log, through cpr-exec with a command
> line whose logfile paths cannot be created, as libvirt's is. Cover
> chardev-change to a new log for pty and socket, and a failed
> chardev-change, whose rollback must keep the old log preserved.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> ---
>  tests/qemu-iotests/tests/migrate-cpr-exec     | 132 ++++++++++++++++++
>  tests/qemu-iotests/tests/migrate-cpr-exec.out |   4 +-
>  2 files changed, 134 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/qemu-iotests/tests/migrate-cpr-exec b/tests/qemu-iotests/tests/migrate-cpr-exec
> index 51e6cbcd659..e8a6c502c84 100755
> --- a/tests/qemu-iotests/tests/migrate-cpr-exec
> +++ b/tests/qemu-iotests/tests/migrate-cpr-exec
> @@ -288,6 +288,138 @@ class TestCprExec(iotests.QMPTestCase):
>              '-device', 'isa-serial,chardev=char0')
>          self._test_cpr(pre_cpr_hook=change_socket)
>  
> +    BAD_LOG = os.path.join(iotests.test_dir, 'nonexistent', 'chr.log')
> +
> +    def _serial_write(self, data: str) -> None:
> +        for c in data:
> +            self.vm.qtest(f'outb 0x3f8 {ord(c)}')
> +
> +    def _open_files(self) -> set:
> +        fd_dir = f'/proc/{self.vm.get_pid()}/fd'
> +        return {os.readlink(os.path.join(fd_dir, fd))
> +                for fd in os.listdir(fd_dir)}

listdir() and readlink() are racy here.  Incoming migration cleanup may
still be closing fds at that point, so readlink can raise
FileNotFoundError. Skip fds that disappear with a try/except.

Andrey

      parent reply	other threads:[~2026-10-05  9:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 16:48 [PATCH 0/3] chardev: fix qemu-update destroying VMs with a console log #VSTOR-148304 Denis V. Lunev
2026-10-02 16:48 ` [PATCH 1/3] chardev: implement cpr_claim_fds() in the base class #VSTOR-148304 Denis V. Lunev
2026-10-02 16:50   ` no-reply
2026-10-05  9:05   ` Andrey Drobyshev
2026-10-02 16:48 ` [PATCH 2/3] chardev: preserve the logfile fd across cpr-exec #VSTOR-148304 Denis V. Lunev
2026-10-02 16:54   ` no-reply
2026-10-05  9:05   ` Andrey Drobyshev
2026-10-02 16:48 ` [PATCH 3/3] iotests/migrate-cpr-exec: cover chardevs with logfile= #VSTOR-148304 Denis V. Lunev
2026-10-02 16:55   ` no-reply
2026-10-05  9:05   ` Andrey Drobyshev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d3cbad7f-1817-4743-9339-b2d9a8f25f15@virtuozzo.com \
    --to=andrey.drobyshev@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=den@virtuozzo.com \
    --cc=svt-core@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.