-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[salt-cloud] libcloud >= 1.0.0 incompatible regarding node_state #33367
Comments
@supertom i'm not able to replicate this behavior on ec2. Here is my test case:
as you can see my libcloud version is 1.0.0rc2:
what version of salt are you running this on? |
@Ch3LL Thanks for taking a look. Any provider that's delegating the list_nodes action to SaltStack rather than providing its own is possibly affected. I misspoke previously, EC2 isn't affected (see below as to why). GCE is definitely affected. Test case for GCE is simply:
You'll receive the error message: No machines were found to be destroyed. Stack trace shows:
(As I mentioned earlier, it's because node_state expects an int, but the new libcloud now returns a string.) I'll read the code for some other providers and see if they are affected, but I don't have test suites to confirm that. Do you have those available? Others possibly affected look to be: dimensiondata, rackspace, cloudstack, and openstack. EC2 isn't affected as it doesn't delegate this action. There is code directly in SaltStack to handle this. We can code around this, as was done for EC2, but I think others will be affected, and then points to some potentially dead/not-useful code in libcloudfuncs. Version Report: Dependency Versions: System Versions: |
Option 3. You already have the six library loaded. IMHO this is the best option because SaltStack doesn't dictate libcloud version (only minimum) and my perception is that 0.14 is most common. libcloud 1.0 (proper) is coming out v. soon so we need to support both in 2016.3.1
|
@supertom thanks for the clarification and pointing out I was just testing with the wrong cloud provider. Looks like I am actually seeing this with rackspace:
Looks like @tonybaloney has created a fix. I did a quick smoke test with the fix and it seems to be working. Would you mind seeing if that fixes the issue on GCE? |
@Ch3LL Tested with GCE. LGTM. |
Description of Issue/Question
The data type of NodeState members has changed in libcloud >= 1.0. In the latest stable (0.20.1), it is an integer, in >= 1.0.0, it is a string.
0.20.1
https://github.com/apache/libcloud/blob/87deb04498ea8bb5068e362810c3d2ab89359b48/libcloud/compute/types.py#L192
In version 1.0.0, it is a string
1.0.0
https://github.com/apache/libcloud/blob/735a786e05590a6a1425bff042e8cd35206579b2/libcloud/compute/types.py#L244
Salt-Cloud, explicitly the node_state function, is expecting an integer.
salt/salt/cloud/libcloudfuncs.py
Line 54 in 0a35106
This results in an error:
Failed to execute 'gce.list_nodes()' while querying for running nodes: 'running', which ultimately affects the deletion of nodes.
For context, here's the pull request in libcloud referencing where the change was made and the discussion behind it.
Possible Solutions
I see a few options to resolve this.
The first option is the easiest, of course. It's also not clear to me the future of node_state, as it's not used in too many places. Node state is an important concept; rather than a utility function, perhaps we should make it an enum or a class (in libcloud it's a class with defined data members) drivers can directly reference?
Happy to implement the fix but would like some feedback/thoughts before I do. FYI @erjohnso FYI @tonybaloney
Steps to Reproduce Issue
salt-cloud -d instance-name
(No machines were found to be destroyed)salt-cloud -Q
(no response)Versions Report
All recent salt-cloud versions expect node.state to be an integer
The text was updated successfully, but these errors were encountered: