Skip to content

Commit

Permalink
Starting to add in checks for status
Browse files Browse the repository at this point in the history
  • Loading branch information
lizsalmon committed Dec 18, 2024
1 parent d93b5bd commit 8f21f19
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lib/workflows/migrate_server.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -21,6 +22,18 @@ def server_migration(
:param live: True to use live 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", all_projects=True, as_admin=True
) # Do I need to add cloud account so that this will work on dev
print(query.to_props())
# snapshot_server(conn, server_id)
# migrate_server(conn, server_id=server_id, dest_host=destination_host, live=live)

0 comments on commit 8f21f19

Please sign in to comment.