From 8b429d0ffec495366396dd69a348f07564584e71 Mon Sep 17 00:00:00 2001 From: Jiri Kyjovsky Date: Mon, 9 Sep 2024 17:24:58 +0200 Subject: [PATCH] Allow dynamic spefifying of volume size --- resalloc_ibm_cloud/argparsers.py | 6 ++++++ resalloc_ibm_cloud/ibm_cloud_vm.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/resalloc_ibm_cloud/argparsers.py b/resalloc_ibm_cloud/argparsers.py index c1bc77a..98593e3 100644 --- a/resalloc_ibm_cloud/argparsers.py +++ b/resalloc_ibm_cloud/argparsers.py @@ -60,6 +60,12 @@ def vm_arg_parser(): ), required=True, ) + parser_create.add_argument( + "--additional-volume-size", + type=int, + help="Allocate additional volume of given size in GB", + required=True, + ) parser_delete = subparsers.add_parser( "delete", help="Delete instance by it's name from IBM Cloud" ) diff --git a/resalloc_ibm_cloud/ibm_cloud_vm.py b/resalloc_ibm_cloud/ibm_cloud_vm.py index b62909c..323ab0a 100755 --- a/resalloc_ibm_cloud/ibm_cloud_vm.py +++ b/resalloc_ibm_cloud/ibm_cloud_vm.py @@ -180,7 +180,7 @@ def create_instance(service, instance_name, opts): { "volume": { "name": instance_name + "-swap", - "capacity": 168, + "capacity": opts.additional_volume_size, "profile": {"name": "general-purpose"}, }, "delete_volume_on_instance_delete": True,