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 VolumeSnapshot.created attribute #473

Closed
wants to merge 3 commits into
base: trunk
from

Conversation

Projects
None yet
2 participants
@allardhoeve
Contributor

allardhoeve commented Mar 3, 2015

One very important aspect of snapshots is when they are made, especially when used as historical backups. The field in VolumeSnapshot.extra that is used to represent this data varies between OS, EC2, GCE and Rackspace. Also, EC2 boasts a datetime value in extra, while OpenStack and derivatives use a plain string.

This PR adds a created attribute to VolumeSnapshot, that is a parsed date. This unified all implementations.

Show outdated Hide outdated libcloud/compute/base.py
driver = None
size = None
extra = None
created = None

This comment has been minimized.

@allardhoeve

allardhoeve Mar 3, 2015

Contributor

Added to aid introspection in all sorts of IDEs and ipython.

@allardhoeve

allardhoeve Mar 3, 2015

Contributor

Added to aid introspection in all sorts of IDEs and ipython.

This comment has been minimized.

@Kami

Kami Mar 4, 2015

Member

The behavior is not exactly the same. Previously those variables were only instance variables, now they are also class variables which could have undesired consequences in some cases (https://stackoverflow.com/questions/207000/python-difference-between-class-and-instance-attributes).

I would prefer to keep it as it was. As far as introspection goes -I need to dig into it, but at least as far as helping with types go - you can help IDE's by adding type asserts and docstring annotation (we already do the latter in most places).

@Kami

Kami Mar 4, 2015

Member

The behavior is not exactly the same. Previously those variables were only instance variables, now they are also class variables which could have undesired consequences in some cases (https://stackoverflow.com/questions/207000/python-difference-between-class-and-instance-attributes).

I would prefer to keep it as it was. As far as introspection goes -I need to dig into it, but at least as far as helping with types go - you can help IDE's by adding type asserts and docstring annotation (we already do the latter in most places).

This comment has been minimized.

@allardhoeve

allardhoeve Mar 5, 2015

Contributor
@allardhoeve

allardhoeve via email Mar 5, 2015

Contributor
@allardhoeve

This comment has been minimized.

Show comment
Hide comment
@allardhoeve
Contributor

allardhoeve commented Mar 3, 2015

@allardhoeve

This comment has been minimized.

Show comment
Hide comment
@allardhoeve

allardhoeve Mar 3, 2015

Contributor
  • CloudFrames implements a CloudFramesSnapshot, which has nothing to do with a VolumeSnapshot 😢
Contributor

allardhoeve commented Mar 3, 2015

  • CloudFrames implements a CloudFramesSnapshot, which has nothing to do with a VolumeSnapshot 😢
Show outdated Hide outdated libcloud/test/compute/test_cloudstack.py
@@ -39,7 +40,7 @@
from libcloud.test.file_fixtures import ComputeFileFixtures
class CloudStackCommonTestCase(TestCaseMixin):
class CloudStackCommonTestCase(unittest.TestCase, TestCaseMixin):

This comment has been minimized.

@allardhoeve

allardhoeve Mar 3, 2015

Contributor

To aid introspection in PyCharm.

@allardhoeve

allardhoeve Mar 3, 2015

Contributor

To aid introspection in PyCharm.

@Kami

This comment has been minimized.

Show comment
Hide comment
@Kami

Kami Mar 4, 2015

Member

Besides the class variables change, this PR looks good to me.

Member

Kami commented Mar 4, 2015

Besides the class variables change, this PR looks good to me.

@allardhoeve

This comment has been minimized.

Show comment
Hide comment
@allardhoeve

allardhoeve Mar 5, 2015

Contributor

Removed instance variables and merged trunk into the branch.

Contributor

allardhoeve commented Mar 5, 2015

Removed instance variables and merged trunk into the branch.

@asfgit asfgit closed this in 373059d Mar 7, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment