-
Notifications
You must be signed in to change notification settings - Fork 290
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
[FLOC-3983] Acceptance tests prep for node shutdown #2532
base: master
Are you sure you want to change the base?
Changes from all commits
585f093
dc5ba06
e2437dd
920e2a8
4e96474
4e2d3b5
019ce4d
e2632af
28d5e01
333b0b9
e72dc5d
5c9d08f
cab8122
39a0003
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1108,6 +1108,14 @@ def get_device_path(blockdevice_id): | |
""" | ||
|
||
|
||
class CloudComputeInstance(PClass): | ||
""" | ||
A compute instance in a cloud. | ||
""" | ||
node_id = field(type=unicode) | ||
ip_addresses = pset_field(unicode) | ||
|
||
|
||
class ICloudAPI(Interface): | ||
""" | ||
Additional functionality provided specifically by cloud-based block | ||
|
@@ -1118,6 +1126,13 @@ class ICloudAPI(Interface): | |
|
||
This is specifically designed for cloud systems where shut down nodes | ||
continue to have volumes attached to them. | ||
|
||
This API is not very well designed, so probably should not be | ||
implemented by third party providers until we do some cleanup. Worth | ||
noting that ``list_live_nodes`` could also be provided by e.g. Swarm | ||
or K8s-specific backend, which suggests ``compute_instance_id`` and | ||
``list_live_nodes`` should be on a different object than | ||
``IBlockDeviceAPI``, an object that is loaded by all agents. | ||
""" | ||
def list_live_nodes(): | ||
""" | ||
|
@@ -1126,8 +1141,7 @@ def list_live_nodes(): | |
This is used to figure out which nodes are dead, so that other | ||
nodes can do the detach. | ||
|
||
:returns: A collection of ``unicode`` compute instance IDs, compatible | ||
with those returned by ``IBlockDeviceAPI.compute_instance_id``. | ||
:returns: A list of ``CloudComputeInstance``. | ||
""" | ||
|
||
def start_node(node_id): | ||
|
@@ -1677,7 +1691,9 @@ def is_existing_block_device(dataset_id, path): | |
pass | ||
|
||
if ICloudAPI.providedBy(self._underlying_blockdevice_api): | ||
live_instances = self._underlying_blockdevice_api.list_live_nodes() | ||
live_instances = list( | ||
instance.node_id for instance in | ||
self._underlying_blockdevice_api.list_live_nodes()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❔ I personally prefer TBH, I always think that turning a dictionary into a list should have the behavior of |
||
else: | ||
# Can't know accurately who is alive and who is dead: | ||
live_instances = None | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❔ Potentially awkward interface note. This is kind of like a
Get details on the nodes, and filter results so that I only see the live nodes
. For instance, if this was directly an interface on GCE I would probably be a bit upset.I think more natural would be 'list_nodes' with an optional filter for only live nodes.
No great ideas here though, just something to think about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think we need to rewrite this before it's public. I'll add a comment to that effect.