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

[Libcloud-589] ProfitBricks Compute Driver Support #352

Conversation

baldwinSPC
Copy link
Contributor

I have completed support for the ProfitBricks compute driver. This adds support for the core compute driver functions against ProfitBricks. The JIRA ticket can be found here:

https://issues.apache.org/jira/browse/LIBCLOUD-589

Let me know if there are any issues or if it can be accepted or not.

Thanks.
-matt

@Kami
Copy link
Member

Kami commented Aug 26, 2014

Sweet, thanks!

I will try to review it asap.

@Kami
Copy link
Member

Kami commented Aug 26, 2014

Travis build appears to be failing - https://travis-ci.org/apache/libcloud/builds/33635636

@baldwinSPC
Copy link
Contributor Author

Thanks. Going through and correcting them now.

On Tue, Aug 26, 2014 at 2:28 PM, Tomaz Muraus notifications@github.com
wrote:

Travis build appears to be failing -
https://travis-ci.org/apache/libcloud/builds/33635636


Reply to this email directly or view it on GitHub
#352 (comment).

datacenter) for datacenter in object.findall('.//return')]

def _to_datacenter(self, datacenter):
elements = list(datacenter.iter())
Copy link
Member

Choose a reason for hiding this comment

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

Element.iter is not available in Python 2.6 (https://docs.python.org/2/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.iter), so please use findall instead (datacenter.findall('.//*')).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Kami OK, this is corrected now: all spots where I use iter are now using findall.

data=body,
method='POST').object)

def destroy_node(self, node, remove_attached_disks=None):
Copy link
Member

Choose a reason for hiding this comment

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

Should default to False and not None.

Copy link
Member

Choose a reason for hiding this comment

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

Also, it's an extension argument so it should be prefixed with ex_.

@Kami
Copy link
Member

Kami commented Sep 2, 2014

Added some more comments.

When those are addressed, please squash all the commits.

@Kami
Copy link
Member

Kami commented Sep 6, 2014

@baldwinSPC How are things looking for those last couple of issues?

I will probably be preparing a new release this weekend and it would be great if those things could get addressed so I can also include this driver.

If you can't do it this weekend, let me know and I will do it myself (address those issues + squash the commits) while merging the patch.

@baldwinSPC
Copy link
Contributor Author

Hey Tomaz

I've corrected about half of these. I'll commit and push those this
afternoon. I don't think I can correct the others, but what I'll do is
comment on the ones I've finished up.
On Sep 6, 2014 6:30 AM, "Tomaz Muraus" notifications@github.com wrote:

@baldwinSPC https://github.com/baldwinSPC How are things looking for
those last couple of issues?

I will probably be preparing a new release this weekend and it would be
great if those things could get addressed so I can also include this driver.

If you can't do it this weekend, let me know and I will do it myself
(address those issues + squash the commits) while merging the patch.


Reply to this email directly or view it on GitHub
#352 (comment).

@baldwinSPC
Copy link
Contributor Author

@Kami I just pushed some updates that address most of the items you called out -- there are only two remaining ones: waiting for state and re-working the ET code.

@Kami
Copy link
Member

Kami commented Sep 7, 2014

@baldwinmathew Great, thanks.

I'll work on rest of the issues and try to get it merged tonight.

@Kami
Copy link
Member

Kami commented Sep 7, 2014

Another thing which got me confused while reviewing the changes:

PROVISIONING_STATE = {
        'INACTIVE': NodeState.PENDING,
        'INPROCESS': NodeState.PENDING,
        'AVAILABLE': NodeState.RUNNING,
        'DELETED': NodeState.TERMINATED,
    }

....

def _wait_for_datacenter_state(
            self,
            datacenter,
            state=PROVISIONING_STATE.get(NodeState.RUNNING),
            timeout=300,
            interval=5):

NodeState.RUNNING is mapped to int 0 (libcloud.compute.types.NodeState), but PROVISIONING_STATE dictionary contains strings as keys. Unless I am missing something, this means .get will always return None and _wait function will always time out.

Same goes with while condition - self.PROVISIONING_STATE.get(NodeState.PENDING).

I believe the state should default to state=PROVISIONING_STATE['available']. I will push those fixes to my branch and wait for you to review them before merging them into trunk.

1. Fix "ex_describe_datacenter" to return a single object instead of a list
2. Fix "ex_describe_datacenter" method signature to take an id instead of an object
3. Fix default value for "state" argument in the "_wait_for_datacenter_state" method
4. Fix while condition in the "_wait_for_datacenter_state" method
5. Modify "_wait_for_datacenter_state" to throw an Exception on timeout
6. Do the same fixes in the "_wait_for_storage_volume_state" method
7. Fix "ex_create_datacenter" to return single object instead of a list
8. Fix "create_volume" to return a single object instead of a list
9. Fix "ex_describe_node" to return a single object instead of a list
10. Fix "create_node" to retirn a single object instead of a list
11. Fix "attach_volume" to return volume on success
12. Fix "ex_create_network_interface" to return a single object instead of a list
@Kami
Copy link
Member

Kami commented Sep 7, 2014

@baldwinSPC I performed another review. During the review I still spotted many issues (mostly with function claiming it returns a single object but it actually returned a list) which I have fixed in my branch - Kami@28e9774

I would appreciate if you can go over my fixes, double check them and test them with the actual Profitbricks API (I don't have an account).

Thanks!

@baldwinSPC
Copy link
Contributor Author

@Kami Great. Thanks Tomaz. I will be testing through this tomorrow morning and will update this thread.

@baldwinSPC
Copy link
Contributor Author

@Kami I just merged your branch into mine after testing all the methods live against the API. Everything looks good, however, in my testing I caught two bugs due to empty data coming back from their API. Those are two minor changes you should see on my next commit.

@baldwinSPC
Copy link
Contributor Author

@Kami BTW, thank you for all your support. :)

@Kami
Copy link
Member

Kami commented Sep 12, 2014

@baldwinmathew Great and you are welcome.

I will look into your changes and and look into merging this pull request into trunk this weekend :)

@asfgit asfgit closed this in 34cff30 Sep 14, 2014
@Kami
Copy link
Member

Kami commented Sep 14, 2014

Looks good.

I've made "a bunch of ifs" to "for loop" change and merged patch into trunk. Thanks!

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.

None yet

2 participants