From b7e867d2cd9f536a4a3ae201edce0f38b19bc8e4 Mon Sep 17 00:00:00 2001 From: Lizzie Salmon Date: Wed, 18 Dec 2024 15:25:10 +0000 Subject: [PATCH] Starting to add in checks for status --- lib/workflows/migrate_server.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/workflows/migrate_server.py b/lib/workflows/migrate_server.py index c3e355fd..79335c42 100644 --- a/lib/workflows/migrate_server.py +++ b/lib/workflows/migrate_server.py @@ -1,5 +1,6 @@ from typing import Optional +import openstackquery from openstack.connection import Connection from openstack_api.openstack_server import migrate_server, snapshot_server @@ -22,5 +23,14 @@ def server_migration( :type live: bool """ snapshot_server(conn, server_id) - - migrate_server(conn, server_id=server_id, dest_host=destination_host, live=live) + # Determine the status of the server + query = getattr(openstackquery, "ServerQuery")() + query.select("server_status") + query.where( + preset="any_in", + prop="server_id", + values=server_id, + ) + query.run("dev") # Do I need to add cloud account so that this will work on dev + print(query.to_string()) + # migrate_server(conn, server_id=server_id, dest_host=destination_host, live=live)