From 1817e62a1a79061fbf397b2a8dfda8fdbf0d419b Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Mon, 5 Nov 2018 09:30:32 -0500 Subject: Remove downloading undercloud.qcow2 OOO team is removing the undercloud disk image as it is no longer needed for containerized undercloud deployments. Instead, we can just use the overcloud image as the undercloud image. Additionally, OOO team has recommended we use current-tripleo instead of current-tripleo-rdo. current-tripleo-rdo was previously thought to be more stable with more promotion checks, but now it seems that it is older and current-tripleo now has the same stability/checks. This patch also bumps the undercloud RAM from 8GB to 10GB. With the new containerized undercloud there is more RAM consumption during deployment. Change-Id: I9e6bb2260dbe9f8796ee54d20527c0aad96476ec Signed-off-by: Tim Rozet --- apex/undercloud/undercloud.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'apex/undercloud/undercloud.py') diff --git a/apex/undercloud/undercloud.py b/apex/undercloud/undercloud.py index 8b6b9d4c..feae43c3 100644 --- a/apex/undercloud/undercloud.py +++ b/apex/undercloud/undercloud.py @@ -15,6 +15,7 @@ import shutil import subprocess import time +from apex.builders import undercloud_builder as uc_builder from apex.virtual import utils as virt_utils from apex.virtual import configure_vm as vm_lib from apex.common import constants @@ -72,7 +73,8 @@ class Undercloud: kernel_args=['console={}'.format(console), 'root=/dev/{}'.format(root)], default_network=True, - template_dir=self.template_path) + template_dir=self.template_path, + memory=10240) self.setup_volumes() self.inject_auth() @@ -180,11 +182,19 @@ class Undercloud: if os.path.exists(dest_img): os.remove(dest_img) shutil.copyfile(src_img, dest_img) + if img_file == self.image_name and platform.machine() != 'aarch64': + uc_builder.expand_disk(dest_img) + self.expand_root_fs() + shutil.chown(dest_img, user='qemu', group='qemu') os.chmod(dest_img, 0o0744) - # TODO(trozet):check if resize needed right now size is 50gb + + def expand_root_fs(self): # there is a lib called vminspect which has some dependencies and is # not yet available in pip. Consider switching to this lib later. + logging.debug("Expanding root filesystem on /dev/sda partition") + virt_ops = [{constants.VIRT_RUN_CMD: 'xfs_growfs /dev/sda'}] + virt_utils.virt_customize(virt_ops, self.volume) def inject_auth(self): virt_ops = list() @@ -200,9 +210,14 @@ class Undercloud: run_cmds = [ 'chmod 600 /root/.ssh/authorized_keys', 'restorecon -R -v /root/.ssh', + 'id -u stack || useradd -m stack', + 'mkdir -p /home/stack/.ssh', + 'chown stack:stack /home/stack/.ssh', 'cp /root/.ssh/authorized_keys /home/stack/.ssh/', 'chown stack:stack /home/stack/.ssh/authorized_keys', - 'chmod 600 /home/stack/.ssh/authorized_keys' + 'chmod 600 /home/stack/.ssh/authorized_keys', + 'echo "stack ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers', + 'touch /etc/cloud/cloud-init.disabled' ] for cmd in run_cmds: virt_ops.append({constants.VIRT_RUN_CMD: cmd}) -- cgit 1.2.3-korg