linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: linux-ext4@vger.kernel.org, root <root@deb7build>
Subject: Re: [PATCH 1/2] xfstests-bld: Split system images in two parts
Date: Wed, 22 Oct 2014 20:48:12 -0400	[thread overview]
Message-ID: <20141023004812.GA7841@thunk.org> (raw)
In-Reply-To: <20141022212535.GC6295@thunk.org>

On Wed, Oct 22, 2014 at 05:25:35PM -0400, Theodore Ts'o wrote:
> So what I suggest instead is that we have a new script, update-image,
> which takes an existing root_fs.img, and installs the updated
> xfstests, the configuration files, and startup files, leaving the
> existing debian base image intact.

Here's an enhancement to the gen-image script which adds a new
--update option.

					- Ted

commit debd9734bc23108f37c6f62914cb5f9e16da20cc
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Wed Oct 22 20:42:32 2014 -0400

    test-appliance: add --update option to the gen-image script
    
    This allows gen-image to to update the xfstests.tar.gz tarball and the
    xfstests driver scripts into an existing root_fs.img file, keeping the
    original operating systems files unchanged.  This takes less than 15
    seconds, compared to about 90 seconds to do a full gen-image build
    using a local disk debian mirror.  It also allows a xfstests developer
    to generate new versions of the root_fs.img more simply on a system
    that does not have debootstrap installed or has access to a Debian
    archive or mirror.
    
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>

diff --git a/kvm-xfstests/test-appliance/gen-image b/kvm-xfstests/test-appliance/gen-image
index 550d070..27f9d96 100755
--- a/kvm-xfstests/test-appliance/gen-image
+++ b/kvm-xfstests/test-appliance/gen-image
@@ -12,6 +12,7 @@ ROOT_FS=$DIR/root_fs.img
 COMPAT="-o compat=0.10"
 SAVE_RAW_ROOT=no
 DO_GCE=no
+DO_UPDATE=no
 
 if test -r config.custom ; then
    . $(pwd)/config.custom
@@ -29,8 +30,11 @@ while [ "$1" != "" ]; do
       DO_GCE=yes
       SAVE_RAW_ROOT=yes;
       ;;
+    --update)
+      DO_UPDATE=yes
+      ;;
     *)
-      echo "usage: gen-image [--save_raw_root] [--do_gce] [--mirror MIRROR_LOC]"
+      echo "usage: gen-image [--save_raw_root] [--do_gce] [--update] [--mirror MIRROR_LOC]"
       exit 1
       ;;
   esac
@@ -42,6 +46,31 @@ then
     RAW_ROOT_FS=/tmp/root_fs.raw.$$
 fi
 
+update_xfstests()
+{
+   tar -C $ROOTDIR/root -xf ../../xfstests.tar.gz
+   rsync -avH files/* $ROOTDIR
+}
+
+finalize_rootfs()
+{
+   e2fsck -fyD $RAW_ROOT_FS
+   e2fsck -fy -E discard $RAW_ROOT_FS
+   qemu-img convert -f raw -O qcow2 $COMPAT -c $RAW_ROOT_FS $ROOT_FS
+}
+
+mkdir -p $ROOTDIR
+if test $DO_UPDATE = "yes" ; then
+   qemu-img convert -f qcow2 -O raw $ROOT_FS $RAW_ROOT_FS
+   mount -t ext4 -o loop $RAW_ROOT_FS $ROOTDIR
+   rm -rf $ROOTDIR/xfstests
+   update_xfstests
+   umount $ROOTDIR
+   rmdir $ROOTDIR
+   finalize_rootfs
+   exit 0
+fi
+
 mkdir -p gce
 if test $DO_GCE = "yes" ; then
     sh get-gce-debs
@@ -51,7 +80,6 @@ else
     variant=xfstests
 fi
 
-mkdir -p $ROOTDIR
 mkdir -p var.cache.apt.archives
 mkdir -p var.lib.apt.lists
 mkdir -p debs
@@ -69,9 +97,7 @@ mount --bind gce $ROOTDIR/gce
 mkdir -p $ROOTDIR/imgdir
 mount --bind $(dirname $RAW_ROOT_FS) $ROOTDIR/imgdir
 debootstrap --variant=$variant $ARCH $SUITE $ROOTDIR $MIRROR $DIR/kvm-xfstest.script
-cp -r files/* rootdir
-echo "untaring xfstests"
-tar -C rootdir/root -xf ../../xfstests.tar.gz
+update_xfstests
 for i in vda vdb vdc vdd vde vdf results
 do
 	mkdir $ROOTDIR/$i
@@ -139,9 +165,7 @@ rmdir $ROOTDIR
 
 if test $DO_GCE != "yes" ; then
    tune2fs -O has_journal $RAW_ROOT_FS
-   e2fsck -fyD $RAW_ROOT_FS
-   e2fsck -fy -E discard $RAW_ROOT_FS
-   qemu-img convert -f raw -O qcow2 $COMPAT -c $RAW_ROOT_FS $ROOT_FS
+   finalize_rootfs
 fi
 
 if test "$SAVE_RAW_ROOT" = "yes" ; then

  reply	other threads:[~2014-10-23  0:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-22 15:06 [PATCH 1/2] xfstests-bld: Split system images in two parts Dmitry Monakhov
2014-10-22 15:06 ` [PATCH 2/2] xfstests-bld: test-apliance add castomization options Dmitry Monakhov
2014-10-22 21:25 ` [PATCH 1/2] xfstests-bld: Split system images in two parts Theodore Ts'o
2014-10-23  0:48   ` Theodore Ts'o [this message]
2014-10-23 11:25     ` Dmitry Monakhov
2014-10-23 14:06       ` Theodore Ts'o
  -- strict thread matches above, loose matches on Subject: below --
2014-10-22 15:37 Dmitry Monakhov

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=20141023004812.GA7841@thunk.org \
    --to=tytso@mit.edu \
    --cc=dmonakhov@openvz.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=root@deb7build \
    /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 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 NNTP newsgroup(s).