Compare commits
6 Commits
dd6a38d5ea
...
7223073afc
Author | SHA1 | Date | |
---|---|---|---|
7223073afc | |||
c1c22c81e7 | |||
712a50ca27 | |||
815041ff20 | |||
823ce8cbf2 | |||
fca02238d7 |
@ -495,9 +495,11 @@ class VMBuilderScript(VMBuilder):
|
||||
self.log_info(
|
||||
f"Installing system with debootstrap: debootstrap --include={','.join(deb_packages)} {deb_release} {temp_dir} {deb_mirror}"
|
||||
)
|
||||
os.system(
|
||||
ret = os.system(
|
||||
f"debootstrap --include={','.join(deb_packages)} {deb_release} {temp_dir} {deb_mirror}"
|
||||
)
|
||||
if ret > 0:
|
||||
self.fail("Failed to run debootstrap")
|
||||
|
||||
# Bind mount the devfs so we can grub-install later
|
||||
os.system("mount --bind /dev {}/dev".format(temp_dir))
|
||||
@ -733,6 +735,7 @@ GRUB_DISABLE_LINUX_UUID=false
|
||||
dst_volume = f"{volume['pool']}/{dst_volume_name}"
|
||||
mapped_dst_volume = f"/dev/rbd/{dst_volume}"
|
||||
mount_path = f"{temp_dir}/{volume['mountpoint']}"
|
||||
self.log_info(f"Unmounting {dst_volume} from {mount_path}")
|
||||
|
||||
if (
|
||||
volume.get("source_volume") is None
|
||||
|
@ -521,9 +521,11 @@ class VMBuilderScript(VMBuilder):
|
||||
self.log_info(
|
||||
f"Installing system with rinse: rinse --arch {rinse_architecture} --directory {temporary_directory} --distribution {rinse_release} --cache-dir {rinse_cache} --add-pkg-list /tmp/addpkg --verbose {mirror_arg}"
|
||||
)
|
||||
os.system(
|
||||
ret = os.system(
|
||||
f"rinse --arch {rinse_architecture} --directory {temporary_directory} --distribution {rinse_release} --cache-dir {rinse_cache} --add-pkg-list /tmp/addpkg --verbose {mirror_arg}"
|
||||
)
|
||||
if ret > 0:
|
||||
self.fail("Failed to run rinse")
|
||||
|
||||
# Bind mount the devfs, sysfs, and procfs so we can grub-install later
|
||||
os.system("mount --bind /dev {}/dev".format(temporary_directory))
|
||||
|
@ -100,7 +100,7 @@ class VMBuilder(object):
|
||||
log_err(None, msg)
|
||||
|
||||
def fail(self, msg, exception=ProvisioningError):
|
||||
fail(None, msg, exception=exception)
|
||||
raise exception(msg)
|
||||
|
||||
#
|
||||
# Primary class functions; implemented by the individual scripts
|
||||
@ -223,7 +223,7 @@ def create_vm(
|
||||
total_stages = 10
|
||||
start(
|
||||
celery,
|
||||
f"Starting provisioning of VM '{vm_name}' with profile '{vm_profile}'",
|
||||
f"Provisioning new VM '{vm_name}' with profile '{vm_profile}'",
|
||||
current=current_stage,
|
||||
total=total_stages,
|
||||
)
|
||||
@ -681,9 +681,15 @@ def create_vm(
|
||||
|
||||
def fail_clean(celery, msg, exception=ProvisioningError):
|
||||
try:
|
||||
vm_builder.cleanup()
|
||||
with chroot(temp_dir):
|
||||
vm_builder.cleanup()
|
||||
except Exception:
|
||||
# We're already failing, do the best we can
|
||||
pass
|
||||
try:
|
||||
general_cleanup()
|
||||
except Exception:
|
||||
# We're already failing, do the best we can
|
||||
pass
|
||||
fail(celery, msg, exception=exception)
|
||||
|
||||
@ -698,7 +704,6 @@ def create_vm(
|
||||
with chroot(temp_dir):
|
||||
vm_builder.setup()
|
||||
except Exception as e:
|
||||
general_cleanup()
|
||||
fail_clean(
|
||||
celery,
|
||||
f"Error in script setup() step: {e}",
|
||||
@ -720,7 +725,6 @@ def create_vm(
|
||||
with chroot(temp_dir):
|
||||
vm_schema = vm_builder.create()
|
||||
except Exception as e:
|
||||
general_cleanup()
|
||||
fail_clean(
|
||||
celery,
|
||||
f"Error in script create() step: {e}",
|
||||
@ -766,9 +770,6 @@ def create_vm(
|
||||
with chroot(temp_dir):
|
||||
vm_builder.prepare()
|
||||
except Exception as e:
|
||||
with chroot(temp_dir):
|
||||
vm_builder.cleanup()
|
||||
general_cleanup()
|
||||
fail_clean(
|
||||
celery,
|
||||
f"Error in script prepare() step: {e}",
|
||||
@ -789,9 +790,6 @@ def create_vm(
|
||||
with chroot(temp_dir):
|
||||
vm_builder.install()
|
||||
except Exception as e:
|
||||
with chroot(temp_dir):
|
||||
vm_builder.cleanup()
|
||||
general_cleanup()
|
||||
fail_clean(
|
||||
celery,
|
||||
f"Error in script install() step: {e}",
|
||||
|
@ -62,7 +62,7 @@ for HOST in ${HOSTS[@]}; do
|
||||
ssh $HOST $SUDO systemctl restart pvcnoded &>/dev/null
|
||||
echo " done."
|
||||
echo -n "Waiting for node daemon to be running..."
|
||||
while [[ $( ssh $HOST "pvc -q node list -f json ${HOST%%.*} | jq -r '.[].daemon_state'" ) != "run" ]]; do
|
||||
while [[ $( ssh $HOST "pvc -q node list -f json ${HOST%%.*} | jq -r '.[].daemon_state'" 2>/dev/null ) != "run" ]]; do
|
||||
sleep 5
|
||||
echo -n "."
|
||||
done
|
||||
|
Reference in New Issue
Block a user