diff mbox series

[v3,4/4] runqemu: print snapshot mode state in console

Message ID 20250731082707.3481718-4-yoann.congal@smile.fr
State New
Headers show
Series [v3,1/4] runqemu: Add support for running compressed .zst rootfs images | expand

Commit Message

Yoann Congal July 31, 2025, 8:27 a.m. UTC
From: Yoann Congal <yoann.congal@smile.fr>

With snapshot enabled, no change on rootfs will be saved after qemu
shutdown. Since this is not what a user might expect, print the snapshot
mode state and its consequence in console at runqemu start.

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 scripts/runqemu | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Alexander Kanavin July 31, 2025, 8:55 a.m. UTC | #1
On Thu, 31 Jul 2025 at 10:27, Yoann Congal via lists.openembedded.org
<yoann.congal=smile.fr@lists.openembedded.org> wrote:
> +        if self.snapshot:
> +            msg = "Enabled. Changes on rootfs won't be kept after QEMU shutdown."
> +        else:
> +            msg = "Disabled. Changes on rootfs will be kept after QEMU shutdown."
> +        logoutput.append('SNAPSHOT: [%s]' % msg)

msg is not a good name, snapshot_msg is better. I would also avoid the
if-else block altogether, and just use a conditional expression after
%:

'Enabled. ...' if self.snapshot else 'Disabled. ...'

Alex
Yoann Congal July 31, 2025, 10:24 a.m. UTC | #2
Le jeu. 31 juil. 2025 à 10:55, Alexander Kanavin <alex.kanavin@gmail.com> a
écrit :

> On Thu, 31 Jul 2025 at 10:27, Yoann Congal via lists.openembedded.org
> <yoann.congal=smile.fr@lists.openembedded.org> wrote:
> > +        if self.snapshot:
> > +            msg = "Enabled. Changes on rootfs won't be kept after QEMU
> shutdown."
> > +        else:
> > +            msg = "Disabled. Changes on rootfs will be kept after QEMU
> shutdown."
> > +        logoutput.append('SNAPSHOT: [%s]' % msg)
>
> msg is not a good name, snapshot_msg is better. I would also avoid the
> if-else block altogether, and just use a conditional expression after
> %:
>
> 'Enabled. ...' if self.snapshot else 'Disabled. ...'
>

Thanks! I used that in v4.


>
> Alex
>
diff mbox series

Patch

diff --git a/scripts/runqemu b/scripts/runqemu
index da53265219..99ea0a98ea 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1053,6 +1053,11 @@  to your build configuration.
             logoutput.append('NFS_DIR: [%s]' % self.rootfs)
         else:
             logoutput.append('ROOTFS: [%s]' % self.rootfs)
+        if self.snapshot:
+            msg = "Enabled. Changes on rootfs won't be kept after QEMU shutdown."
+        else:
+            msg = "Disabled. Changes on rootfs will be kept after QEMU shutdown."
+        logoutput.append('SNAPSHOT: [%s]' % msg)
         if self.ovmf_bios:
             logoutput.append('OVMF: %s' % self.ovmf_bios)
         if (self.ovmf_secboot_pkkek1):