From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67B39137C48 for ; Thu, 25 Jan 2024 20:35:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706214915; cv=none; b=bVIR63h3yzxXHTeW2gZTTQCwjSFZJxzgQFg0XfzjE4B2C0TK3v+jatE8BNZ78gDBRlo0ML3b6NzFn8DM1IVYdVq0t/ztxEzlDcGVWUDKjLcEPWHNN+bqekhjMqgoG2R0dy9QtQFgerScJNwDrNwl6kjPXMioQdp3I5XrKSPO7Og= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706214915; c=relaxed/simple; bh=d55zSC4Fi989VbWYPx4lZA+BOMRLZM7gxOuXvWft5jM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BjeAnT7A9otAgNEwXVmF4OLSVs3CJgHWlMjRjiwrLQzdcelS7pUUTDCl4aWUi/QF273Cp9ZplGe3tkobzLex8saqxanspcDR7bAdAfp+7RrexGLcz0646F/HOCeDjNODr0IzZu4VvYiVonAdT6MTBlcdZPTttT1LpSqMk/mZvYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=XmetWIQ/; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="XmetWIQ/" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=SvFWD/SwNPG51x4tdJVmhrMbGvgy3+gvoj2otI5lKkE=; b=XmetWIQ/Exp2ZmCJTLmUoQzDb5 k/lp7stEbVZjYPgbmlOQ0esenTMi65oKLOV+Ze7XdxdcTw4oRpJflaD7giTgNwj79KgeFt+eSGzLp amN7NgZ6ARyYwWjWsQQhPZB+GqQbpedkoMY0+XNi5EYKPb80SXesH5UNX93KMAgBT8zRAj1Mf8vhA xcI7NNUKDwd7sbv3gKtzjcTeJGdWI71I/3TZQ35dDJKvk3+TftLogiEmUYYU8nRS3f37VOzp5eTQW 4XYEunejLTJ04aVYLXCnvpVfqObZ8yLgwJRSZOId99L94mTIDrD1gae316pZzp/eFX+zQXci2CNkq BAKFK8gg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT6RK-00000001ntf-1YV1; Thu, 25 Jan 2024 20:35:10 +0000 From: Luis Chamberlain To: kdevops@lists.linux.dev, da.gomez@samsung.com, p.raghav@samsung.com Cc: Luis Chamberlain Subject: [PATCH 2/6] bringup: split provisioning into 2 steps Date: Thu, 25 Jan 2024 12:35:03 -0800 Message-ID: <20240125203507.430113-3-mcgrof@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240125203507.430113-1-mcgrof@kernel.org> References: <20240125203507.430113-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain Right now we deal with provisioning as a post bringup work item and it does two things: 1) Update ssh config file 2) Runs the devconfig playbook, which optionally installs some deps other than do basic things like setup console, kdump, etc. The fact that deps are optional on the devconfig playbook makes it hard to add dependencies we want to install without incurring a penalty to everyone as a default option to install all standard generic kernel development tools we define under CONFIG_KDEVOPS_TRY_INSTALL_KDEV_TOOLS. The reason we disable CONFIG_KDEVOPS_TRY_INSTALL_KDEV_TOOLS by default is it delays bringup. However the devconfig playbook is also used to place random oddball generic tools may want to install on bringup. Some of these tools we may want to try to install early on, even before we run the devconfig playbook for generic stuff like setting up the console or kdump. To help with this, and in order to allow us to keep relying on the devconfig playbook for random packages we may want to allow users to install, we split the above two provisioning tasks into two separate tasks. This will allow us to add another middle set of targets which get executed after 1) but before 2). We will add support for this in the next subsequent commit. For now this should be a no-op for both vagrant and libguest. For terraform we actually enhance the experience by adding a guard to not run the devconfig playbook twice if a user by mistake tried to run 'make bringup' twice. This guard was not present before for terraform. Maybe later on we should share these snippets between all 3 bringup methods. Note we have no generic task for bare metal yet, but we should -- we should just add the devconfig playbook. That would cases where bare metal systems which are already brought up and you have ssh configuration going for already working. Signed-off-by: Luis Chamberlain --- .gitignore | 4 +++- Makefile | 5 +++-- scripts/guestfs.Makefile | 24 ++++++++++++++++++------ scripts/terraform.Makefile | 18 ++++++++++++++++++ scripts/vagrant.Makefile | 22 +++++++++++++++++----- 5 files changed, 59 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 738d073e889a..1d2653c5b26c 100644 --- a/.gitignore +++ b/.gitignore @@ -29,9 +29,11 @@ scripts/workflows/lib/__pycache__/ vagrant/kdevops_nodes.yaml vagrant/.Vagrantfile.generated vagrant/Vagrantfile -vagrant/.provisioned_once +vagrant/.provisioned_once* .vagrant/ +terraform/.provisioned_once* + include/ # You can override role specific stuff on these diff --git a/Makefile b/Makefile index ad34743e3e53..8ee02f2a9b6c 100644 --- a/Makefile +++ b/Makefile @@ -86,9 +86,10 @@ endif # CONFIG_NEEDS_LOCAL_DEVELOPMENT_PATH ANSIBLE_EXTRA_ARGS += $(LOCAL_DEVELOPMENT_ARGS) # These should be set as non-empty if you want any generic bring up -# targets to come up. We support 2 bring up methods: +# targets to come up. We support 3 bring up methods: # -# - vagrant: for kvm/virtualbox +# - vagrant: for kvm/virtualbox - will eventually be deprecated +# - libguestfs: for kvm # - terraform: for any cloud provider # # If you are using bare metal, you don't do bring up, or you'd diff --git a/scripts/guestfs.Makefile b/scripts/guestfs.Makefile index 211ac9ba688e..17c8cbd354c1 100644 --- a/scripts/guestfs.Makefile +++ b/scripts/guestfs.Makefile @@ -5,9 +5,11 @@ GUESTFS_ARGS := KDEVOPS_NODES_TEMPLATE := $(KDEVOPS_NODES_ROLE_TEMPLATE_DIR)/guestfs_nodes.j2 KDEVOPS_NODES := guestfs/kdevops_nodes.yaml -export KDEVOPS_GUESTFS_PROVISIONED := guestfs/.provisioned_once +export KDEVOPS_GUESTFS_PROVISIONED_SSH := guestfs/.provisioned_once_ssh +export KDEVOPS_GUESTFS_PROVISIONED_DEVCONFIG := guestfs/.provisioned_once_devconfig -KDEVOPS_MRPROPER += $(KDEVOPS_GUESTFS_PROVISIONED) +KDEVOPS_MRPROPER += $(KDEVOPS_GUESTFS_PROVISIONED_SSH) +KDEVOPS_MRPROPER += $(KDEVOPS_GUESTFS_PROVISIONED_DEVCONFIG) GUESTFS_ARGS += kdevops_enable_guestfs=True GUESTFS_ARGS += guestfs_path='$(TOPDIR_PATH)/guestfs' @@ -51,11 +53,18 @@ GUESTFS_BRINGUP_DEPS := GUESTFS_BRINGUP_DEPS += $(9P_HOST_CLONE) GUESTFS_BRINGUP_DEPS += $(LIBVIRT_PCIE_PASSTHROUGH) -KDEVOPS_BRING_UP_DEPS := bringup_guestfs + KDEVOPS_BRING_UP_DEPS := bringup_guestfs KDEVOPS_DESTROY_DEPS := destroy_guestfs # Provisioning goes last -KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_GUESTFS_PROVISIONED) +# +# Provisioning split into 2 steps: +# 1) Ensuring we can use ansible with ssh +# 2) Generic devconfig final configuration (which may include extra tools) +# +# Anything deps after this is dealt with on each respective workflow. +KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_GUESTFS_PROVISIONED_SSH) +KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_GUESTFS_PROVISIONED_DEVCONFIG) 9p_linux_clone: $(Q)make linux-clone @@ -66,15 +75,18 @@ libvirt_pcie_passthrough_permissions: playbooks/libvirt_pcie_passthrough.yml \ -e 'ansible_python_interpreter=/usr/bin/python3' -$(KDEVOPS_GUESTFS_PROVISIONED): +$(KDEVOPS_GUESTFS_PROVISIONED_SSH): $(Q)if [[ "$(CONFIG_KDEVOPS_SSH_CONFIG_UPDATE)" == "y" ]]; then \ LIBVIRT_DEFAULT_URI=$(CONFIG_LIBVIRT_URI) $(TOPDIR)/scripts/update_ssh_config_guestfs.py; \ fi + $(Q)touch $(KDEVOPS_GUESTFS_PROVISIONED_SSH) + +$(KDEVOPS_GUESTFS_PROVISIONED_DEVCONFIG): $(Q)if [[ "$(CONFIG_KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK)" != "" ]]; then \ ansible-playbook $(ANSIBLE_VERBOSE) -i \ $(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/$(KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK) ; \ fi - $(Q)touch $(KDEVOPS_GUESTFS_PROVISIONED) + $(Q)touch $(KDEVOPS_GUESTFS_PROVISIONED_DEVCONFIG) bringup_guestfs: $(GUESTFS_BRINGUP_DEPS) $(Q)$(TOPDIR)/scripts/bringup_guestfs.sh diff --git a/scripts/terraform.Makefile b/scripts/terraform.Makefile index d4caa4dbb6d6..8e95e8cd822b 100644 --- a/scripts/terraform.Makefile +++ b/scripts/terraform.Makefile @@ -2,7 +2,22 @@ TERRAFORM_EXTRA_VARS := +export KDEVOPS_TERRAFORM_PROVISIONED_DEVCONFIG := terraform/.provisioned_once_devconfig +KDEVOPS_MRPROPER += $(KDEVOPS_TERRAFORM_PROVISIONED_DEVCONFIG) + KDEVOPS_BRING_UP_DEPS := bringup_terraform +# Provisioning goes last +# +# Provisioning split into 2 steps: +# 1) Ensuring we can use ansible with ssh - this is implied by all +# terraform providers. That is, our terraform providers all have a last +# provisioning element task which does this update for us as part of +# the above bringup_terraform. +# 2) Generic devconfig final configuration (which may include extra tools) +# +# Anything deps after this is dealt with on each respective workflow. +KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_TERRAFORM_PROVISIONED_DEVCONFIG) + KDEVOPS_DESTROY_DEPS := destroy_terraform KDEVOPS_NODES_TEMPLATE := $(KDEVOPS_NODES_ROLE_TEMPLATE_DIR)/terraform_nodes.tf.j2 @@ -163,10 +178,13 @@ ANSIBLE_EXTRA_ARGS += $(TERRAFORM_EXTRA_VARS) bringup_terraform: $(Q)$(TOPDIR)/scripts/bringup_terraform.sh + +$(KDEVOPS_TERRAFORM_PROVISIONED_DEVCONFIG): $(Q)if [[ "$(CONFIG_KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK)" != "" ]]; then \ ansible-playbook $(ANSIBLE_VERBOSE) -i \ $(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/$(KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK) ;\ fi + $(Q)touch $(KDEVOPS_TERRAFORM_PROVISIONED_DEVCONFIG) destroy_terraform: $(Q)$(TOPDIR)/scripts/destroy_terraform.sh diff --git a/scripts/vagrant.Makefile b/scripts/vagrant.Makefile index 0633f90da719..825cfd210c6b 100644 --- a/scripts/vagrant.Makefile +++ b/scripts/vagrant.Makefile @@ -8,11 +8,13 @@ KDEVOPS_NODES := vagrant/kdevops_nodes.yaml KDEVOPS_VAGRANT_TEMPLATE := $(KDEVOPS_NODES_ROLE_TEMPLATE_DIR)/Vagrantfile.j2 KDEVOPS_VAGRANT_GENERATED:= vagrant/.Vagrantfile.generated KDEVOPS_VAGRANT := vagrant/Vagrantfile -export KDEVOPS_VAGRANT_PROVISIONED := vagrant/.provisioned_once +export KDEVOPS_VAGRANT_PROVISIONED_SSH := vagrant/.provisioned_once_ssh +export KDEVOPS_VAGRANT_PROVISIONED_DEVCONFIG := vagrant/.provisioned_once_devconfig KDEVOPS_MRPROPER += $(KDEVOPS_VAGRANT_GENERATED) KDEVOPS_MRPROPER += $(KDEVOPS_VAGRANT) -KDEVOPS_MRPROPER += $(KDEVOPS_VAGRANT_PROVISIONED) +KDEVOPS_MRPROPER += $(KDEVOPS_VAGRANT_PROVISIONED_SSH) +KDEVOPS_MRPROPER += $(KDEVOPS_VAGRANT_PROVISIONED_DEVCONFIG) VAGRANT_ARGS += kdevops_vagrant_template_full_path='$(TOPDIR_PATH)/$(KDEVOPS_VAGRANT_TEMPLATE)' @@ -75,7 +77,14 @@ VAGRANT_BRINGUP_DEPS += $(LIBVIRT_PCIE_PASSTHROUGH) KDEVOPS_BRING_UP_DEPS := bringup_vagrant # Provisioning goes last -KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_VAGRANT_PROVISIONED) +# +# Provisioning split into 2 steps: +# 1) Ensuring we can use ansible with ssh +# 2) Generic devconfig final configuration (which may include extra tools) +# +# Anything deps after this is dealt with on each respective workflow. +KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_VAGRANT_PROVISIONED_SSH) +KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_VAGRANT_PROVISIONED_DEVCONFIG) KDEVOPS_DESTROY_DEPS := destroy_vagrant @@ -99,18 +108,21 @@ libvirt_pcie_passthrough_permissions: playbooks/libvirt_pcie_passthrough.yml \ -e 'ansible_python_interpreter=/usr/bin/python3' -$(KDEVOPS_VAGRANT_PROVISIONED): +$(KDEVOPS_VAGRANT_PROVISIONED_SSH): $(Q)if [[ "$(CONFIG_KDEVOPS_SSH_CONFIG_UPDATE)" == "y" ]]; then \ ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \ --inventory localhost, \ playbooks/update_ssh_config_vagrant.yml \ -e 'ansible_python_interpreter=/usr/bin/python3' ;\ fi + $(Q)touch $(KDEVOPS_VAGRANT_PROVISIONED_SSH) + +$(KDEVOPS_VAGRANT_PROVISIONED_DEVCONFIG): $(Q)if [[ "$(CONFIG_KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK)" != "" ]]; then \ ansible-playbook $(ANSIBLE_VERBOSE) -i \ $(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/$(KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK) ;\ fi - $(Q)touch $(KDEVOPS_VAGRANT_PROVISIONED) + $(Q)touch $(KDEVOPS_VAGRANT_PROVISIONED_DEVCONFIG) bringup_vagrant: $(VAGRANT_BRINGUP_DEPS) $(Q)$(TOPDIR)/scripts/bringup_vagrant.sh -- 2.42.0