summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-05-12 19:57:53 +0300
committerLars Wirzenius <liw@liw.fi>2023-05-12 19:57:53 +0300
commit6ab6ca0f488fb6442d124745f5ae9e9938dd1dbc (patch)
tree6ea2059d4dd17cb421187a68517474ee57b5a6a1
parentdbc62aebb37df18d1958e342afbc07c8beac3e98 (diff)
downloadvmdb2-6ab6ca0f488fb6442d124745f5ae9e9938dd1dbc.tar.gz
feat: add more debugging to when state.arch is set
Sponsored-by: author
-rw-r--r--vmdb/app.py1
-rw-r--r--vmdb/plugins/debootstrap_plugin.py1
-rw-r--r--vmdb/plugins/grub_plugin.py24
3 files changed, 18 insertions, 8 deletions
diff --git a/vmdb/app.py b/vmdb/app.py
index ef92548..d974a83 100644
--- a/vmdb/app.py
+++ b/vmdb/app.py
@@ -169,6 +169,7 @@ class ImageBuilder:
state.arch = (
vmdb.runcmd(["dpkg", "--print-architecture"]).decode("UTF-8").strip()
)
+ logging.debug(f"Set state.arch={state.arch!r}")
self.add_template_vars(state.as_dict())
steps = spec.get_steps(self._tvars)
diff --git a/vmdb/plugins/debootstrap_plugin.py b/vmdb/plugins/debootstrap_plugin.py
index ecdd0b2..b712734 100644
--- a/vmdb/plugins/debootstrap_plugin.py
+++ b/vmdb/plugins/debootstrap_plugin.py
@@ -117,4 +117,5 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface):
tag = values["target"]
target = state.tags.get_builder_mount_point(tag)
state.arch = values["arch"]
+ vmdb.progress(f"debootstrap plugin set architecture to {state.arch}")
vmdb.runcmd_chroot(target, ["apt-get", "update"])
diff --git a/vmdb/plugins/grub_plugin.py b/vmdb/plugins/grub_plugin.py
index 45f1e5c..6ce92f0 100644
--- a/vmdb/plugins/grub_plugin.py
+++ b/vmdb/plugins/grub_plugin.py
@@ -116,6 +116,7 @@ class GrubStepRunner(vmdb.StepRunnerInterface):
"arm64": ("grub-efi-arm64", "arm64-efi"),
"armhf": ("grub-efi-arm", "arm-efi"),
}
+ logging.debug(f"grub plugin: state.arch={state.arch!r}")
try:
return variants[state.arch]
except KeyError:
@@ -176,22 +177,22 @@ class GrubStepRunner(vmdb.StepRunnerInterface):
self.bind_mount_many(chroot, ["/dev", "/sys", "/proc"], state)
if efi_dev:
pn = efi_dev[-1]
- vmdb.runcmd(["parted", "-s", image_dev, "set", pn, "esp", "on" ])
+ vmdb.runcmd(["parted", "-s", image_dev, "set", pn, "esp", "on"])
self.mount(chroot, efi_dev, "/boot/efi", state)
elif prep_dev:
pn = prep_dev[-1]
- vmdb.runcmd(["parted", "-s", image_dev, "set", pn, "prep", "on" ])
+ vmdb.runcmd(["parted", "-s", image_dev, "set", pn, "prep", "on"])
image_dev = prep_dev
self.install_package(chroot, grub_package)
kernel_params = values["kernel-params"]
if console == "serial":
- if 'ppc64' in state.arch:
+ if "ppc64" in state.arch:
kernel_params.extend(
["loglevel=3", "console=tty0", "console=hvc0,115200n8"]
)
- elif 'arm' in state.arch:
+ elif "arm" in state.arch:
kernel_params.extend(
["loglevel=3", "console=tty0", "console=ttyAMA0,115200n8"]
)
@@ -229,7 +230,9 @@ class GrubStepRunner(vmdb.StepRunnerInterface):
"grub-install",
"--target=" + grub_target,
"--no-nvram",
- "--no-extra-removable" if b"--no-extra-removable" in help_out else "--force-extra-removable",
+ "--no-extra-removable"
+ if b"--no-extra-removable" in help_out
+ else "--force-extra-removable",
"--no-floppy",
"--modules=part_msdos part_gpt",
"--grub-mkdevicemap=/boot/grub/device.map",
@@ -360,7 +363,9 @@ class GrubStepRunner(vmdb.StepRunnerInterface):
def set_grub_cmdline_config(self, chroot, kernel_params):
param_string = " ".join(kernel_params)
- self.set_grub_default(chroot, "GRUB_CMDLINE_LINUX_DEFAULT", '"' + param_string + '"')
+ self.set_grub_default(
+ chroot, "GRUB_CMDLINE_LINUX_DEFAULT", '"' + param_string + '"'
+ )
def set_grub_default(self, chroot, param, value):
filename = self.chroot_path(chroot, "/etc/default/grub")
@@ -387,8 +392,11 @@ class GrubStepRunner(vmdb.StepRunnerInterface):
def add_grub_serial_console(self, chroot):
self.set_grub_default(chroot, "GRUB_TERMINAL", "serial")
- self.set_grub_default(chroot, "GRUB_SERIAL_COMMAND", '"serial '
- '--speed=115200 --unit=0 --word=8 --parity=no --stop=1"')
+ self.set_grub_default(
+ chroot,
+ "GRUB_SERIAL_COMMAND",
+ '"serial ' '--speed=115200 --unit=0 --word=8 --parity=no --stop=1"',
+ )
def add_grub_crypto_disk(self, chroot):
self.set_grub_default(chroot, "GRUB_ENABLE_CRYPTODISK", "y")