GNU bug report logs - #45986
scripts: system: Remove 'vm-image' command.

Previous Next

Package: guix-patches;

Reported by: Mathieu Othacehe <othacehe <at> gnu.org>

Date: Tue, 19 Jan 2021 18:10:01 UTC

Severity: normal

Done: Mathieu Othacehe <othacehe <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45986 in the body.
You can then email your comments to 45986 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#45986; Package guix-patches. (Tue, 19 Jan 2021 18:10:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mathieu Othacehe <othacehe <at> gnu.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 19 Jan 2021 18:10:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: guix-patches <at> gnu.org
Subject: scripts: system: Remove 'vm-image' command.
Date: Tue, 19 Jan 2021 19:09:30 +0100
[Message part 1 (text/plain, inline)]
Hello,

This patch removes the 'vm-image' command that has been superseded by
the 'image' command.

Thanks,

Mathieu
[0001-scripts-system-Remove-vm-image-command.patch (text/x-diff, inline)]
From 5bb4ea792df2d4c946ca406bd79eebfc9e9bede1 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <othacehe <at> gnu.org>
Date: Tue, 19 Jan 2021 18:09:28 +0100
Subject: [PATCH] scripts: system: Remove 'vm-image' command.

Remove the 'vm-image' command that has been superseded by the 'image'
command.

* gnu/system/vm.scm (system-qemu-image): Remove it.
* guix/scripts/system.scm (system-derivation-for-action): Mark 'vm-image'
command as deprecated and use the image API to produce the VM image.
(perform-action, show-help): Adapt accordingly.
* tests/guix-system.sh: Ditto.
* doc/guix.texi (Invoking guix system,
Running Guix in a VM): Ditto.
* etc/completion/fish/guix.fish: Ditto.
* etc/completion/zsh/_guix: Ditto.
---
 doc/guix.texi                 | 33 +++++++++---------
 etc/completion/fish/guix.fish |  7 ++--
 etc/completion/zsh/_guix      |  2 +-
 gnu/system/vm.scm             | 63 -----------------------------------
 guix/scripts/system.scm       | 24 ++++++-------
 tests/guix-system.sh          |  2 +-
 6 files changed, 33 insertions(+), 98 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index f02353d9fa..0d9eae9512 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -31392,8 +31392,7 @@ size of the image.
 
 @cindex System images, creation in various formats
 @cindex Creating system images in various formats
-@item vm-image
-@itemx image
+@item image
 @itemx docker-image
 Return a virtual machine, disk image, or Docker image of the operating
 system declared in @var{file} that stands alone.  By default,
@@ -31437,15 +31436,15 @@ the image to it using the following command:
 The @code{--list-image-types} command lists all the available image
 types.
 
-@cindex vm-image, creating virtual machine images
-When using @code{vm-image}, the returned image is in qcow2 format, which
-the QEMU emulator can efficiently use. @xref{Running Guix in a VM}, for
-more information on how to run the image in a virtual machine.  The
-@code{grub-bootloader} bootloader is always used independently of what
-is declared in the @code{operating-system} file passed as argument.
-This is to make it easier to work with QEMU, which uses the SeaBIOS BIOS
-by default, expecting a bootloader to be installed in the Master Boot
-Record (MBR).
+@cindex creating virtual machine images
+When using the @code{qcow2} image type, the returned image is in qcow2
+format, which the QEMU emulator can efficiently use. @xref{Running Guix
+in a VM}, for more information on how to run the image in a virtual
+machine.  The @code{grub-bootloader} bootloader is always used
+independently of what is declared in the @code{operating-system} file
+passed as argument.  This is to make it easier to work with QEMU, which
+uses the SeaBIOS BIOS by default, expecting a bootloader to be installed
+in the Master Boot Record (MBR).
 
 @cindex docker-image, creating docker images
 When using @code{docker-image}, a Docker image is produced.  Guix builds
@@ -31540,7 +31539,7 @@ create a virtual machine image that contains provenance information, you
 can run:
 
 @example
-guix system vm-image --save-provenance config.scm
+guix system image -t qcow2 --save-provenance config.scm
 @end example
 
 That way, the resulting image will effectively ``embed its own source''
@@ -31563,10 +31562,10 @@ When this option is omitted, @command{guix system} uses the
 for burning on CDs and DVDs.
 
 @item --image-size=@var{size}
-For the @code{vm-image} and @code{image} actions, create an image
-of the given @var{size}.  @var{size} may be a number of bytes, or it may
-include a unit as a suffix (@pxref{Block size, size specifications,,
-coreutils, GNU Coreutils}).
+For the @code{image} action, create an image of the given @var{size}.
+@var{size} may be a number of bytes, or it may include a unit as a
+suffix (@pxref{Block size, size specifications,, coreutils, GNU
+Coreutils}).
 
 When this option is omitted, @command{guix system} computes an estimate
 of the image size as a function of the size of the system declared in
@@ -31929,7 +31928,7 @@ If you built your own image, you must copy it out of the store
 before you can use it.  When invoking QEMU, you must choose a system
 emulator that is suitable for your hardware platform.  Here is a minimal
 QEMU invocation that will boot the result of @command{guix system
-vm-image} on x86_64 hardware:
+image -t qcow2} on x86_64 hardware:
 
 @example
 $ qemu-system-x86_64 \
diff --git a/etc/completion/fish/guix.fish b/etc/completion/fish/guix.fish
index 73bd176112..422baab4bb 100644
--- a/etc/completion/fish/guix.fish
+++ b/etc/completion/fish/guix.fish
@@ -133,7 +133,7 @@ complete -f -c guix -n '__fish_guix_using_command pull' -l url -d 'download the
 complete -f -c guix -n '__fish_guix_using_command pull' -l bootstrap -d 'use the bootstrap Guile to build the new Guix'
 
 #### system
-set -l remotecommands reconfigure roll-back switch-generation list-generations build container vm vm-image disk-image init extension-graph shepherd-graph load-path keep-failed keep-going dry-run fallback no-substitutes substitutes-urls no-grafts no-offload max-silent-time timeout verbosity rounds cores max-jobs derivation on-error image-size no-grub share expose full-boot
+set -l remotecommands reconfigure roll-back switch-generation list-generations build container vm image init extension-graph shepherd-graph load-path keep-failed keep-going dry-run fallback no-substitutes substitutes-urls no-grafts no-offload max-silent-time timeout verbosity rounds cores max-jobs derivation on-error image-size no-grub share expose full-boot
 complete -f -c guix -n '__fish_guix_needs_command' -a system -d 'Build the operating system declared in FILE according to ACTION.'
 complete -f -c guix -n '__fish_guix_using_command system' -l reconfigure -d 'switch to a new operating system configuration'
 complete -f -c guix -n '__fish_guix_using_command system' -l roll-back -d 'switch to the previous operating system configuration'
@@ -142,8 +142,7 @@ complete -f -c guix -n '__fish_guix_using_command system' -l list-generations -d
 complete -f -c guix -n '__fish_guix_using_command system' -l build -d 'build the operating system without installing anything'
 complete -f -c guix -n '__fish_guix_using_command system' -l container -d 'build a container that shares the host\'s store'
 complete -f -c guix -n '__fish_guix_using_command system' -l vm -d 'build a virtual machine image that shares the host\'s store'
-complete -f -c guix -n '__fish_guix_using_command system' -l vm-image -d 'build a freestanding virtual machine image'
-complete -f -c guix -n '__fish_guix_using_command system' -l disk-image -d 'build a disk image, suitable for a USB stick'
+complete -f -c guix -n '__fish_guix_using_command system' -l image -d 'build a disk image, suitable for a USB stick'
 complete -f -c guix -n '__fish_guix_using_command system' -l init -d 'initialize a root file system to run GNU'
 complete -f -c guix -n '__fish_guix_using_command system' -l extension-graph -d 'emit the service extension graph in Dot format'
 complete -f -c guix -n '__fish_guix_using_command system' -l shepherd-graph -d 'emit the graph of shepherd services in Dot format'
@@ -167,7 +166,7 @@ complete -f -c guix -n '__fish_guix_using_command system' -s M -d 'allow at most
 complete -f -c guix -n '__fish_guix_using_command system' -a "--max-jobs=" -d 'allow at most N build jobs'
 complete -f -c guix -n '__fish_guix_using_command system' -s d -l derivation -d 'return the derivation of the given system'
 complete -f -c guix -n '__fish_guix_using_command system' -a "--on-error=" -d 'apply STRATEGY when an error occurs while reading FILE'
-complete -f -c guix -n '__fish_guix_using_command system' -a "--image-size=" -d 'for \'vm-image\', produce an image of SIZE'
+complete -f -c guix -n '__fish_guix_using_command system' -a "--image-size=" -d 'for \'image\', produce an image of SIZE'
 complete -f -c guix -n '__fish_guix_using_command system' -l no-grub -d 'for \'init\', do not install GRUB'
 complete -f -c guix -n '__fish_guix_using_command system' -a "--share=" -d 'for \'vm\', share host file system according to SPEC'
 complete -f -c guix -n '__fish_guix_using_command system' -a "--expose=" -d 'for \'vm\', expose host file system according to SPEC'
diff --git a/etc/completion/zsh/_guix b/etc/completion/zsh/_guix
index ae93b62b1d..aa1a859e0d 100644
--- a/etc/completion/zsh/_guix
+++ b/etc/completion/zsh/_guix
@@ -383,7 +383,7 @@ _guix_list_installed_packages()
         '--max-jobs=[allow at most N build jobs]:N' \
         '--derivation[return the derivation of the given system]' \
         '--on-error=[apply STRATEGY when an error occurs while reading FILE]:STRATEGY' \
-        '--image-size=[for "vm-image", produce an image of SIZE]:SIZE' \
+        '--image-size=[for "image", produce an image of SIZE]:SIZE' \
         '--no-grub[for "init", do not install GRUB]' \
         '--share=[for "vm", share host file system according to SPEC]:SPEC' \
         '--expose=[for "vm", expose host file system according to SPEC]:SPEC' \
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 1afae6b4ed..d7ae048b81 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -73,7 +73,6 @@
   #:export (expression->derivation-in-linux-vm
             qemu-image
             virtualized-operating-system
-            system-qemu-image
 
             system-qemu-image/shared-store
             system-qemu-image/shared-store-script
@@ -557,68 +556,6 @@ the operating system."
      #:single-file-output? #t
      #:references-graphs `((,graph ,os)))))
 
-
-;;;
-;;; VM and disk images.
-;;;
-
-(define* (system-qemu-image os
-                            #:key
-                            (file-system-type "ext4")
-                            (disk-image-size (* 900 (expt 2 20))))
-  "Return the derivation of a freestanding QEMU image of DISK-IMAGE-SIZE bytes
-of the GNU system as described by OS."
-  (define file-systems-to-keep
-    ;; Keep only file systems other than root and not normally bound to real
-    ;; devices.
-    (remove (lambda (fs)
-              (let ((target (file-system-mount-point fs))
-                    (source (file-system-device fs)))
-                (or (string=? target "/")
-                    (and (string? source)
-                         (string-prefix? "/dev/" source))
-                    (uuid? source)
-                    (file-system-label? source))))
-            (operating-system-file-systems os)))
-
-  (define root-uuid
-    ;; UUID of the root file system.
-    (operating-system-uuid os
-                           (if (string=? file-system-type "iso9660")
-                               'iso9660
-                               'dce)))
-
-
-  (let* ((os (operating-system
-               (inherit os)
-
-               ;; As in 'virtualized-operating-system', use BIOS-style GRUB.
-               (bootloader (bootloader-configuration
-                            (bootloader grub-bootloader)
-                            (target "/dev/vda")))
-
-               ;; Assume we have an initrd with the whole QEMU shebang.
-
-               ;; Force our own root file system.  Refer to it by UUID so that
-               ;; it works regardless of how the image is used ("qemu -hda",
-               ;; Xen, etc.).
-               (file-systems (cons (file-system
-                                     (mount-point "/")
-                                     (device root-uuid)
-                                     (type file-system-type))
-                                   file-systems-to-keep))))
-         (bootcfg (operating-system-bootcfg os)))
-    (qemu-image  #:os os
-                 #:bootcfg-drv bootcfg
-                 #:bootloader (bootloader-configuration-bootloader
-                               (operating-system-bootloader os))
-                 #:disk-image-size disk-image-size
-                 #:file-system-type file-system-type
-                 #:file-system-uuid root-uuid
-                 #:inputs `(("system" ,os)
-                            ("bootcfg" ,bootcfg))
-                 #:copy-inputs? #t)))
-
 
 ;;;
 ;;; VMs that share file systems with the host.
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 66225bff35..9b75ac2fd0 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -695,8 +695,6 @@ checking this by themselves in their 'check' procedure."
         os
         #:mappings mappings
         #:shared-network? container-shared-network?))
-      ((vm-image)
-       (system-qemu-image os #:disk-image-size image-size))
       ((vm)
        (system-qemu-image/shared-store-script os
                                               #:full-boot? full-boot?
@@ -705,11 +703,16 @@ checking this by themselves in their 'check' procedure."
                                                   image-size
                                                   (* 70 (expt 2 20)))
                                               #:mappings mappings))
-      ((image disk-image)
-       (let* ((base-image (os->image os #:type image-type))
+      ((image disk-image vm-image)
+       (let* ((image-type (if (eq? action 'vm-image)
+                              qcow2-image-type
+                              image-type))
+              (base-image (os->image os #:type image-type))
               (base-target (image-target base-image)))
          (when (eq? action 'disk-image)
            (warning (G_ "'disk-image' is deprecated: use 'image' instead~%")))
+         (when (eq? action 'vm-image)
+           (warning (G_ "'vm-image' is deprecated: use 'image' instead~%")))
          (lower-object
           (system-image
            (image
@@ -781,9 +784,8 @@ and TARGET arguments."
   "Perform ACTION for OS.  INSTALL-BOOTLOADER? specifies whether to install
 bootloader; BOOTLOADER-TAGET is the target for the bootloader; TARGET is the
 target root directory; IMAGE-SIZE is the size of the image to be built, for
-the 'vm-image' and 'image' actions.  IMAGE-TYPE is the type of image to
-be built.  When VOLATILE-ROOT? is #t, the root file system is mounted
-volatile.
+the 'image' action.  IMAGE-TYPE is the type of image to be built.  When
+VOLATILE-ROOT? is #t, the root file system is mounted volatile.
 
 FULL-BOOT? is used for the 'vm' action; it determines whether to
 boot directly to the kernel or to the bootloader.  CONTAINER-SHARED-NETWORK?
@@ -967,8 +969,6 @@ Some ACTIONS support additional ARGS.\n"))
    container        build a container that shares the host's store\n"))
   (display (G_ "\
    vm               build a virtual machine image that shares the host's store\n"))
-  (display (G_ "\
-   vm-image         build a freestanding virtual machine image\n"))
   (display (G_ "\
    image            build a Guix System image\n"))
   (display (G_ "\
@@ -998,7 +998,7 @@ Some ACTIONS support additional ARGS.\n"))
   (display (G_ "
   -t, --image-type=TYPE  for 'image', produce an image of TYPE"))
   (display (G_ "
-      --image-size=SIZE  for 'vm-image', produce an image of SIZE"))
+      --image-size=SIZE  for 'image', produce an image of SIZE"))
   (display (G_ "
       --no-bootloader    for 'init', do not install a bootloader"))
   (display (G_ "
@@ -1016,8 +1016,8 @@ Some ACTIONS support additional ARGS.\n"))
   (display (G_ "
   -N, --network          for 'container', allow containers to access the network"))
   (display (G_ "
-  -r, --root=FILE        for 'vm', 'vm-image', 'image', 'container',
-                         and 'build', make FILE a symlink to the result, and
+  -r, --root=FILE        for 'vm', 'image', 'container' and 'build',
+                         make FILE a symlink to the result, and
                          register it as a garbage collector root"))
   (display (G_ "
       --full-boot        for 'vm', make a full boot sequence"))
diff --git a/tests/guix-system.sh b/tests/guix-system.sh
index f5ddd1dda3..ddbdd0edcd 100644
--- a/tests/guix-system.sh
+++ b/tests/guix-system.sh
@@ -335,7 +335,7 @@ done
 
 # Verify that the disk image types can be built.
 guix system -n vm gnu/system/examples/vm-image.tmpl
-guix system -n vm-image gnu/system/examples/vm-image.tmpl
+guix system -n image -t qcow2 gnu/system/examples/vm-image.tmpl
 # This invocation was taken care of in the loop above:
 # guix system -n disk-image gnu/system/examples/bare-bones.tmpl
 guix system -n disk-image -t iso9660 gnu/system/examples/bare-bones.tmpl
-- 
2.29.2


Information forwarded to guix-patches <at> gnu.org:
bug#45986; Package guix-patches. (Fri, 29 Jan 2021 11:10:01 GMT) Full text and rfc822 format available.

Message #8 received at 45986 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 45986 <at> debbugs.gnu.org
Subject: Re: [bug#45986] scripts: system: Remove 'vm-image' command.
Date: Fri, 29 Jan 2021 12:09:35 +0100
Hi Mathieu,

On Tue, 19 Jan 2021 at 19:55, Mathieu Othacehe <othacehe <at> gnu.org> wrote:

> This patch removes the 'vm-image' command that has been superseded by
> the 'image' command.

LGTM.  Maybe with an associated "news"?

Cheers,
simon




Reply sent to Mathieu Othacehe <othacehe <at> gnu.org>:
You have taken responsibility. (Wed, 17 Feb 2021 09:54:01 GMT) Full text and rfc822 format available.

Notification sent to Mathieu Othacehe <othacehe <at> gnu.org>:
bug acknowledged by developer. (Wed, 17 Feb 2021 09:54:01 GMT) Full text and rfc822 format available.

Message #13 received at 45986-done <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: zimoun <zimon.toutoune <at> gmail.com>
Cc: 45986-done <at> debbugs.gnu.org
Subject: Re: bug#45986: scripts: system: Remove 'vm-image' command.
Date: Wed, 17 Feb 2021 10:53:38 +0100
Hello,

> LGTM.  Maybe with an associated "news"?

Pushed, thanks!

Mathieu




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 17 Mar 2021 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 39 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.