qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Robert Foley <robert.foley@linaro.org>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: "Peter Puhov" <peter.puhov@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>
Subject: Re: [PATCH v7 09/12] tests/vm: Added a new script for ubuntu.aarch64.
Date: Fri, 22 May 2020 15:24:16 -0400	[thread overview]
Message-ID: <CAEyhzFtJC8zGm9fESE4k5Yvojk5Yvw8ey5ECz2c9S69s16j=UA@mail.gmail.com> (raw)
In-Reply-To: <878shkdlvg.fsf@linaro.org>

On Fri, 22 May 2020 at 11:34, Alex Bennée <alex.bennee@linaro.org> wrote:
>
>
> Robert Foley <robert.foley@linaro.org> writes:
<snip>
> >
> > +############################################
> > +# efi-aarch64 probe
> > +# Check for efi files needed by aarch64 VMs.
> > +# By default we will use the efi included with QEMU.
> > +# Allow user to override the path for efi also.
> > +qemu_efi_aarch64=$PWD/pc-bios/edk2-aarch64-code.fd
>
> as you only define this once there is no harm in just having a long line
> bellow rather than running the potential confusion when looking at the
> variables.

OK, makes sense, will change to just go for the longer line.

> > +for fd in $efi_aarch64_arg $qemu_efi_aarch64
> > +do
> > +    if test -f $fd; then
> > +        efi_aarch64=$fd
> > +        break
> > +    fi
> > +done
>
> This only detects the pc-bios bundled version of edk on a directory
> which has already been built. Maybe we need to do a straight forward:
>
>   if not test -f $efi_aarch64; then
>       if test -f $SRC/pc-bios/edk2-aarch64-code.fd.bz2; then
>           # valid after build
>           efi_aarch64=$PWD/pc-bios/edk2-aarch64-code.fd
>       else
>           efi_aarch64=""
>       fi
>   fi
>
> what do you think?

I agree.  The straight up if check is easier to read.  Will change to this.

> <snip>
> > +
> > +    def build_image(self, img):
> > +        os_img = self._download_with_cache(self.image_link)
> > +        img_tmp = img + ".tmp"
> > +        subprocess.check_call(["cp", "-f", os_img, img_tmp])
> > +        subprocess.check_call(["qemu-img", "resize", img_tmp, "+50G"])
> > +        ci_img = self.gen_cloud_init_iso()
> > +
> > +        self.boot(img_tmp, extra_args = ["-cdrom", ci_img])
> > +        if self.debug:
> > +            self.wait_boot()
> > +        # First command we issue is fix for slow ssh login.
> > +        self.wait_ssh(wait_root=True,
> > +                      cmd="chmod -x /etc/update-motd.d/*")
> > +        # Wait for cloud init to finish
> > +        self.wait_ssh(wait_root=True,
> > +                      cmd="ls /var/lib/cloud/instance/boot-finished")
> > +        self.ssh_root("touch /etc/cloud/cloud-init.disabled")
> > +        # Disable auto upgrades.
> > +        # We want to keep the VM system state stable.
> > +        self.ssh_root('sed -ie \'s/"1"/"0"/g\' /etc/apt/apt.conf.d/20auto-upgrades')
> > +        # If the user chooses *not* to do the second phase,
> > +        # then we will jump right to the graceful shutdown
> > +        if self._config['install_cmds'] != "":
> > +            self.ssh_root("sync")
> > +            # Shutdown and then boot it again.
> > +            # Allows us to know for sure it is booting (not shutting down)
> > +            # before we call wait_ssh().
> > +            self.graceful_shutdown()
> > +            self.boot(img_tmp)
> > +            if self.debug:
> > +                self.wait_boot()
> > +            self.wait_ssh(wait_root=True)
> > +            self.wait_ssh(wait_root=True, cmd="locale")
>
> Why do we need to shutdown before proceeding with the install commands?
> I see ubuntu.i386 does it as well although with a slightly hackier
> approach.

The reboot was carried over from the way i386 did things.
I have a guess as to why the reboot is there, it is just after the
install of cloud-initramfs-growroot, which does require a reboot.
So I assume that we wanted to grow the root, reboot, and then
begin installation of all the new packages.

However, at this point, it looks like even without installing that package,
(with i386 or aarch64) the root is growing to fill the new size of the image,
so it seems that package and the reboot is no longer needed.
Will plan to remove these as part of making build_image common
(discussed below).

> > +            # The previous update sometimes doesn't survive a reboot, so do it again
> > +            self.ssh_root("sed -ie s/^#\ deb-src/deb-src/g /etc/apt/sources.list")
> > +
> > +            # Issue the install commands.
> > +            # This can be overriden by the user in the config .yml.
> > +            install_cmds = self._config['install_cmds'].split(',')
> > +            for cmd in install_cmds:
> > +                self.ssh_root(cmd)
> > +        self.graceful_shutdown()
> > +        self.wait()
> > +        os.rename(img_tmp, img)
> > +        return 0
>
> How come we are diverging from the ubuntu.i386 install here? You've
> moved all the complications for aarch64 into a it's own handling so
> these steps are almost but not quite the same. Couldn't the ubuntu
> build_img code be common and then just have a slightly different set of
> install commands?

I'm glad you brought this up.  I was noticing the commonality here especially if
we wanted to add another architecture of Ubuntu VM.
For example, we brought up a ppc64 Ubuntu VM script the other day and it really
cried out for creating a common Ubuntu module here since most of the
code is the same.

As suggested, I will plan to create a common Ubuntu module here and share
the build_img code, but have a different set of install commands.

Thanks & Regards,
-Rob

>
> > +
> > +if __name__ == "__main__":
> > +    defaults = aarch64vm.get_config_defaults(UbuntuAarch64VM, DEFAULT_CONFIG)
> > +    sys.exit(basevm.main(UbuntuAarch64VM, defaults))
>
>
> --
> Alex Bennée


  reply	other threads:[~2020-05-22 19:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 13:22 [PATCH v7 00/12] tests/vm: Add support for aarch64 VMs Robert Foley
2020-05-19 13:22 ` [PATCH v7 01/12] configure: add alternate binary for genisoimage Robert Foley
2020-05-19 13:22 ` [PATCH v7 02/12] tests/vm: pass --genisoimage to basevm script Robert Foley
2020-05-19 13:22 ` [PATCH v7 03/12] tests/vm: pass args through to BaseVM's __init__ Robert Foley
2020-05-20 21:49   ` Alex Bennée
2020-05-22 12:58     ` Robert Foley
2020-05-19 13:22 ` [PATCH v7 04/12] tests/vm: Add configuration to basevm.py Robert Foley
2020-05-22 14:22   ` Alex Bennée
2020-05-19 13:22 ` [PATCH v7 05/12] tests/vm: Added configuration file support Robert Foley
2020-05-22 14:26   ` Alex Bennée
2020-05-19 13:22 ` [PATCH v7 06/12] tests/vm: Pass --debug through for vm-boot-ssh Robert Foley
2020-05-22 14:29   ` Alex Bennée
2020-05-19 13:22 ` [PATCH v7 07/12] tests/vm: Add ability to select QEMU from current build Robert Foley
2020-05-22 14:40   ` Alex Bennée
2020-05-22 18:53     ` Robert Foley
2020-05-19 13:22 ` [PATCH v7 08/12] tests/vm: allow wait_ssh() to specify command Robert Foley
2020-05-19 13:22 ` [PATCH v7 09/12] tests/vm: Added a new script for ubuntu.aarch64 Robert Foley
2020-05-22 15:34   ` Alex Bennée
2020-05-22 19:24     ` Robert Foley [this message]
2020-05-19 13:22 ` [PATCH v7 10/12] tests/vm: Added a new script for centos.aarch64 Robert Foley
2020-05-22 15:59   ` Alex Bennée
2020-05-22 19:44     ` Robert Foley
2020-05-19 13:22 ` [PATCH v7 11/12] tests/vm: change scripts to use self._config Robert Foley
2020-05-19 13:22 ` [PATCH v7 12/12] tests/vm: Add workaround to consume console Robert Foley
2020-05-22 16:31   ` Alex Bennée
2020-05-22 20:44     ` Robert Foley

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='CAEyhzFtJC8zGm9fESE4k5Yvojk5Yvw8ey5ECz2c9S69s16j=UA@mail.gmail.com' \
    --to=robert.foley@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=peter.puhov@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).