Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add undeploy commands #61

Merged
merged 1 commit into from
Dec 8, 2023
Merged

Add undeploy commands #61

merged 1 commit into from
Dec 8, 2023

Conversation

tzumainn
Copy link
Contributor

@tzumainn tzumainn commented Dec 7, 2023

These undeploy commands allow users to cleanup orchestrated clusters.

@tzumainn tzumainn force-pushed the undeploy branch 2 times, most recently from 4883df3 to d276687 Compare December 7, 2023 18:38
"""Undeploy a cluster from ESI nodes"""

log = logging.getLogger(__name__ + ".Undeploy")
REQUIRED_FIELDS = ['nodes', 'private_network_name', 'api_vip',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think REQUIRED_FIELDS is not used to check fields in config file in this class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point - removed!

if len(non_uuid_node_configs) > 0:
print("* %s node configs were skipped, as they do not"
" specify specific nodes" % len(non_uuid_node_configs))
print(" * these nodes and ports will have to be removed"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can user keep track of these unspecified nodes? Should we provide detailed instructions here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They'll just have to use existing CLI commands; there's no real good way to do this except openstack baremetal node list

for node in node_uuids:
print(" * %s" % node)
ironic_client.node.set_provision_state(node, 'deleted')
print(" * waiting for nodes to start undeploy before"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you get an error if deleting a port while a node is still under deleting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope - but it takes ~10 seconds for Ironic to detach the port itself, so I figure there's no harm in waiting!

These undeploy commands allow users to cleanup orchestrated clusters.
@tzumainn
Copy link
Contributor Author

tzumainn commented Dec 8, 2023

@DanNiESh thanks for your comments! Answers in-line. Longer-term, I'm hoping to implement some changes to add some cluster metadata so that removing resources should be much easier.

Copy link
Contributor

@DanNiESh DanNiESh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks!

@tzumainn tzumainn merged commit 0f45137 into CCI-MOC:master Dec 8, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants