unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#28635] [PATCH] Allow configuring the disk image size of a virtual machine
@ 2017-09-28 19:54 Christopher Baines
  2017-09-28 19:57 ` [bug#28635] [PATCH 1/2] vm: Add a minimum root size Christopher Baines
  0 siblings, 1 reply; 6+ messages in thread
From: Christopher Baines @ 2017-09-28 19:54 UTC (permalink / raw)
  To: 28635

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

Allow configuring the size of the virtual machine disk when using the
virtual-matchine record type.

Christopher Baines (2):
  vm: Add a minimum root size.
  vm: Add disk-image-size to <virtual-machine>.

 gnu/system/vm.scm | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#28635] [PATCH 1/2] vm: Add a minimum root size.
  2017-09-28 19:54 [bug#28635] [PATCH] Allow configuring the disk image size of a virtual machine Christopher Baines
@ 2017-09-28 19:57 ` Christopher Baines
  2017-09-28 19:57   ` [bug#28635] [PATCH 2/2] vm: Add disk-image-size to <virtual-machine> Christopher Baines
  2017-10-03 13:11   ` [bug#28635] [PATCH 1/2] vm: Add a minimum root size Ludovic Courtès
  0 siblings, 2 replies; 6+ messages in thread
From: Christopher Baines @ 2017-09-28 19:57 UTC (permalink / raw)
  To: 28635

* gnu/system/vm.scm (qemu-image): When guessing the root-size, use a lower
  bound of 20 MiB, otherwise the root file system size is sometimes 0 MiB in
  size.
---
 gnu/system/vm.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 78143e4f7..d340a8563 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -304,9 +304,12 @@ the image."
                                #:register-closures? #$register-closures?
                                #:system-directory #$os-drv))
                   (root-size  #$(if (eq? 'guess disk-image-size)
-                                    #~(estimated-partition-size
-                                       (map (cut string-append "/xchg/" <>)
-                                            graphs))
+                                    #~(max
+                                       ;; Minimum 20 MiB root size
+                                       (* 20 (expt 2 20))
+                                       (estimated-partition-size
+                                        (map (cut string-append "/xchg/" <>)
+                                             graphs)))
                                     (- disk-image-size
                                        (* 50 (expt 2 20)))))
                   (partitions (list (partition
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#28635] [PATCH 2/2] vm: Add disk-image-size to <virtual-machine>.
  2017-09-28 19:57 ` [bug#28635] [PATCH 1/2] vm: Add a minimum root size Christopher Baines
@ 2017-09-28 19:57   ` Christopher Baines
  2017-10-03 13:12     ` Ludovic Courtès
  2017-10-03 13:11   ` [bug#28635] [PATCH 1/2] vm: Add a minimum root size Ludovic Courtès
  1 sibling, 1 reply; 6+ messages in thread
From: Christopher Baines @ 2017-09-28 19:57 UTC (permalink / raw)
  To: 28635

* gnu/system/vm.scm (<virtual-machine>): Add disk-image-size.
  (port-forwardings->qemu-options): Use disk-image-size from
  <virtual-machine>.
---
 gnu/system/vm.scm | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index d340a8563..2f31a615b 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -709,6 +709,8 @@ it is mostly useful when FULL-BOOT?  is true."
                     (default #f))
   (memory-size      virtual-machine-memory-size   ;integer (MiB)
                     (default 256))
+  (disk-image-size  virtual-machine-disk-image-size   ;integer (bytes)
+                    (default 'guess))
   (port-forwardings virtual-machine-port-forwardings ;list of integer pairs
                     (default '())))
 
@@ -737,12 +739,15 @@ FORWARDINGS is a list of host-port/guest-port pairs."
                                                 system target)
   ;; XXX: SYSTEM and TARGET are ignored.
   (match vm
-    (($ <virtual-machine> os qemu graphic? memory-size ())
+    (($ <virtual-machine> os qemu graphic? disk-image-size memory-size ())
      (system-qemu-image/shared-store-script os
                                             #:qemu qemu
                                             #:graphic? graphic?
-                                            #:memory-size memory-size))
-    (($ <virtual-machine> os qemu graphic? memory-size forwardings)
+                                            #:memory-size memory-size
+                                            #:disk-image-size
+                                            disk-image-size))
+    (($ <virtual-machine> os qemu graphic? memory-size disk-image-size
+                          forwardings)
      (let ((options
             `("-net" ,(string-append
                        "user,"
@@ -751,6 +756,8 @@ FORWARDINGS is a list of host-port/guest-port pairs."
                                               #:qemu qemu
                                               #:graphic? graphic?
                                               #:memory-size memory-size
+                                              #:disk-image-size
+                                              disk-image-size
                                               #:options options)))))
 
 ;;; vm.scm ends here
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#28635] [PATCH 1/2] vm: Add a minimum root size.
  2017-09-28 19:57 ` [bug#28635] [PATCH 1/2] vm: Add a minimum root size Christopher Baines
  2017-09-28 19:57   ` [bug#28635] [PATCH 2/2] vm: Add disk-image-size to <virtual-machine> Christopher Baines
@ 2017-10-03 13:11   ` Ludovic Courtès
  1 sibling, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2017-10-03 13:11 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 28635

Christopher Baines <mail@cbaines.net> skribis:

> * gnu/system/vm.scm (qemu-image): When guessing the root-size, use a lower
>   bound of 20 MiB, otherwise the root file system size is sometimes 0 MiB in
>   size.

LGTM, thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#28635] [PATCH 2/2] vm: Add disk-image-size to <virtual-machine>.
  2017-09-28 19:57   ` [bug#28635] [PATCH 2/2] vm: Add disk-image-size to <virtual-machine> Christopher Baines
@ 2017-10-03 13:12     ` Ludovic Courtès
  2017-10-04  6:25       ` bug#28635: " Christopher Baines
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2017-10-03 13:12 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 28635

Christopher Baines <mail@cbaines.net> skribis:

> * gnu/system/vm.scm (<virtual-machine>): Add disk-image-size.
>   (port-forwardings->qemu-options): Use disk-image-size from
>   <virtual-machine>.

As long as “make check-system TESTS=basic” passes, fine with me!

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#28635: [PATCH 2/2] vm: Add disk-image-size to <virtual-machine>.
  2017-10-03 13:12     ` Ludovic Courtès
@ 2017-10-04  6:25       ` Christopher Baines
  0 siblings, 0 replies; 6+ messages in thread
From: Christopher Baines @ 2017-10-04  6:25 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 28635-done

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]

On Tue, 03 Oct 2017 15:12:04 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

> Christopher Baines <mail@cbaines.net> skribis:
> 
> > * gnu/system/vm.scm (<virtual-machine>): Add disk-image-size.
> >   (port-forwardings->qemu-options): Use disk-image-size from
> >   <virtual-machine>.  
> 
> As long as “make check-system TESTS=basic” passes, fine with me!

It failed at first, as I had a the memory-size and disk-image-size
fields the wrong way around in a match statement, but after I fixed
that it worked fine.

I've now pushed these changes, thanks for your review :)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-04  6:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-28 19:54 [bug#28635] [PATCH] Allow configuring the disk image size of a virtual machine Christopher Baines
2017-09-28 19:57 ` [bug#28635] [PATCH 1/2] vm: Add a minimum root size Christopher Baines
2017-09-28 19:57   ` [bug#28635] [PATCH 2/2] vm: Add disk-image-size to <virtual-machine> Christopher Baines
2017-10-03 13:12     ` Ludovic Courtès
2017-10-04  6:25       ` bug#28635: " Christopher Baines
2017-10-03 13:11   ` [bug#28635] [PATCH 1/2] vm: Add a minimum root size Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).