Skip to content

Commit

Permalink
added semipermanent as an option
Browse files Browse the repository at this point in the history
  • Loading branch information
XaverStiensmeier committed Oct 29, 2024
1 parent f75b357 commit 6ec4f5d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion bibigrid/core/actions/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,10 @@ def create_server_volumes(self, provider, instance, name):
self.log.info("Creating volumes ...")
return_volumes = []
for i, volume in enumerate(instance.get("volumes", [])):
base_volume_name = f"{name}-{i}"
if volume.get("semiPermanent"):
base_volume_name = f"{name}-semiperm-{i}"
else:
base_volume_name = f"{name}-{i}"
if volume.get('snapshot'):
if not volume.get("name"):
volume["name"] = base_volume_name
Expand Down
2 changes: 1 addition & 1 deletion bibigrid/core/actions/terminate.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def delete_tmp_volumes(provider, cluster_id, log):
log.info("Deleting tmp volumes on provider %s...", provider.cloud_specification['identifier'])
volume_list = provider.list_volumes()
cluster_volume_state = []
volume_regex = re.compile(fr"^bibigrid-(master-{cluster_id}|(worker|vpngtw)-{cluster_id}-(\d+))$")
volume_regex = re.compile(fr"^bibigrid-(master-{cluster_id}|(worker|vpngtw)-{cluster_id}-(\d+))-(\d+|semiperm.*)$")
for volume in volume_list:
if volume_regex.match(volume["name"]):
log.info("Trying to delete volume %s on cloud %s.", volume['name'], provider.cloud_specification[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ def create_server_volumes(connection, host_vars, name):
with FileLock(f"{host_vars_path}.lock"):
logging.info(f"Instance Volumes {volumes}")
for i, volume in enumerate(volumes):
base_volume_name = f"{name}-{i}"
if volume.get("semiPermanent"):
base_volume_name = f"{name}-semiperm-{i}"
else:
base_volume_name = f"{name}-{i}"
if volume.get('snapshot'):
if not volume.get("name"):
volume["name"] = base_volume_name
Expand Down

0 comments on commit 6ec4f5d

Please sign in to comment.