Skip to content

Commit 811e287

Browse files
committed
fix(Scaling):fixed ep
1 parent bc48501 commit 811e287

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

simple_vm_client/openstack_connector/openstack_connector.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ def get_image(
527527
replace_inactive: bool = False,
528528
ignore_not_active: bool = False,
529529
ignore_not_found: bool = False,
530+
replace_not_found: bool = False,
530531
) -> Image:
531532
logger.info(f"Get Image {name_or_id}")
532533

@@ -535,6 +536,14 @@ def get_image(
535536
raise ImageNotFoundException(
536537
message=f"Image {name_or_id} not found!", name_or_id=name_or_id
537538
)
539+
elif not image and replace_not_found:
540+
for version in ["18.04", "20.04", "22.04", "1804", "2004", "2204"]:
541+
if version in name_or_id:
542+
image = self.get_active_image_by_os_version(
543+
os_version=version, os_distro="ubuntu"
544+
)
545+
break
546+
538547
elif image and image.status != "active" and replace_inactive:
539548
metadata = image.get("metadata", None)
540549
image_os_version = metadata.get("os_version", None)
@@ -1214,7 +1223,10 @@ def start_server(
12141223
key_name: str = None # type: ignore
12151224
try:
12161225
image: Image = self.get_image(
1217-
name_or_id=image_name, replace_inactive=True, ignore_not_found=True
1226+
name_or_id=image_name,
1227+
replace_not_found=True,
1228+
replace_inactive=True,
1229+
ignore_not_found=True,
12181230
)
12191231
flavor: Flavor = self.get_flavor(name_or_id=flavor_name)
12201232
network: Network = self.get_network()

0 commit comments

Comments
 (0)