@@ -122,8 +122,14 @@ def _load_tags(self):
122
122
# filters instances that were deleted since the last time the head node was up
123
123
for instance_id , instance_tags in tags .items ():
124
124
try :
125
- self .ibm_vpc_client .get_instance (instance_id )
126
- self .nodes_tags [instance_id ] = instance_tags
125
+ instance = self .ibm_vpc_client .get_instance (instance_id ).get_result ()
126
+ if instance and instance ["status" ] not in ["deleting" ,"failed" ]:
127
+ self .nodes_tags [instance_id ] = instance_tags
128
+ else :
129
+ logger .warning (
130
+ f"cached instance { instance_id } is not in a valid state, \
131
+ and will be removed from cache"
132
+ )
127
133
except Exception as e :
128
134
cli_logger .warning (instance_id )
129
135
if e .message == "Instance not found" :
@@ -343,7 +349,6 @@ def is_terminated(self, node_id)-> bool:
343
349
logger .debug (f"""node: { node_id } is_terminated? { node ["status" ] not in ["running" , "starting" , "pending" ]} """ )
344
350
return node ["status" ] not in ["running" , "starting" , "pending" ]
345
351
except Exception :
346
- logger .debug (f"""node: { node_id } is_terminated? TRUE""" )
347
352
return True
348
353
349
354
@@ -446,7 +451,7 @@ def _create_instance(self, name, base_config):
446
451
447
452
boot_volume_profile = {
448
453
"capacity" : base_config .get ("boot_volume_capacity" , 100 ),
449
- "name" : "{}- boot" . format ( name ) ,
454
+ "name" : f" boot-volume- { uuid4 (). hex [: 4 ] } " ,
450
455
"profile" : {
451
456
"name" : base_config .get ("volume_tier_name" , VOLUME_TIER_NAME_DEFAULT )
452
457
},
@@ -631,7 +636,7 @@ def create_node(self, base_config, tags, count) -> None:
631
636
count(int): number of nodes to create.
632
637
633
638
"""
634
- logger .debug (f"""create_node: count: { count } \n tags: { pprint (tags )} \n base_config:{ pprint (base_config )} \n """ )
639
+ logger .debug (f"""create_node:\n count: { count } \n tags:{ pprint (tags )} \n base_config:{ pprint (base_config )} \n """ )
635
640
stopped_nodes_dict = {}
636
641
futures = []
637
642
0 commit comments