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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add state attribute to StorageVolume #476

Merged
merged 2 commits into from Mar 27, 2015

Conversation

Projects
None yet
4 participants
@allardhoeve
Contributor

allardhoeve commented Mar 5, 2015

  1. Currently, volume state is defined by the driver in a key in extra. This key varies between drivers. Also, the value varies between drivers.
  2. However, it is a commonly accessed attribute that should be unified across drivers, just as Node state is unified in NodeState.
  3. This PR does exactly that.

Some caveats:

  1. Except for OS and EC2, all other drivers return StorageVolume objects with state UNKNOWN.
    1. I have no access to GCE.
    2. I could find no exhaustive list of GCE disk states.
    3. The same holds for all the other drivers.
    4. I do not think this is a problem, because the instance variable does not currently exist at all 馃槈

UPDATE: GCE list is here: https://cloud.google.com/compute/docs/reference/latest/disks#resource

Acceptable values are:
"CREATING": The disk is being created.
"FAILED": The disk failed to be created.
"READY": The disk is ready to use.
"RESTORING": The disk is being restored from either a snapshot or an image.
@gertjanol

This comment has been minimized.

Show comment
Hide comment
@gertjanol

gertjanol Mar 5, 2015

Contributor

EC2 Volume states: creating | available | in-use | deleting | deleted | error
OpenStack Volume states: creating | available | attaching | in-use | deleting | error | error_deleting | backing-up | restoring-backup | error_restoring | error_extending

Contributor

gertjanol commented Mar 5, 2015

EC2 Volume states: creating | available | in-use | deleting | deleted | error
OpenStack Volume states: creating | available | attaching | in-use | deleting | error | error_deleting | backing-up | restoring-backup | error_restoring | error_extending

@allardhoeve

This comment has been minimized.

Show comment
Hide comment
@allardhoeve

allardhoeve Mar 5, 2015

Contributor

Fixed unknown node states, thanks @gertjanol

Contributor

allardhoeve commented Mar 5, 2015

Fixed unknown node states, thanks @gertjanol

@allardhoeve

This comment has been minimized.

Show comment
Hide comment
@allardhoeve

allardhoeve Mar 7, 2015

Contributor

@Kami, does this need a proposal @ dev?

Contributor

allardhoeve commented Mar 7, 2015

@Kami, does this need a proposal @ dev?

@allardhoeve allardhoeve changed the title from Add state to StorageVolume to Add state attribute to StorageVolume Mar 11, 2015

Show outdated Hide outdated libcloud/compute/drivers/ec2.py
namespace=NAMESPACE)
try:
state = self.VOLUME_STATE_MAP[raw_state]

This comment has been minimized.

@Kami

Kami Mar 13, 2015

Member

Minor style thing - doing self.VOLUME_STATE_MAP.get(raw_state, StorageVolumeState.UNKNOWN) saves a couple of lines of code. On top of that, code also won't break and require an immediate update if a provider adds a new state (unlikely, but still).

@Kami

Kami Mar 13, 2015

Member

Minor style thing - doing self.VOLUME_STATE_MAP.get(raw_state, StorageVolumeState.UNKNOWN) saves a couple of lines of code. On top of that, code also won't break and require an immediate update if a provider adds a new state (unlikely, but still).

This comment has been minimized.

@allardhoeve

allardhoeve Mar 13, 2015

Contributor

Done.

@allardhoeve

allardhoeve Mar 13, 2015

Contributor

Done.

Show outdated Hide outdated libcloud/compute/types.py
@@ -221,6 +221,18 @@ def fromstring(cls, value):
return getattr(cls, value.upper(), None)
class StorageVolumeState(object):
UNKNOWN = None

This comment has been minimized.

@Kami

Kami Mar 13, 2015

Member

Should probably also use a number for unknown - that's what other ENUM classes to and this way we can differentiate between "no state" and "state not recognized by libcloud".

@Kami

Kami Mar 13, 2015

Member

Should probably also use a number for unknown - that's what other ENUM classes to and this way we can differentiate between "no state" and "state not recognized by libcloud".

This comment has been minimized.

@allardhoeve

allardhoeve Mar 13, 2015

Contributor

And done.

@allardhoeve

allardhoeve Mar 13, 2015

Contributor

And done.

@Kami

This comment has been minimized.

Show comment
Hide comment
@Kami

Kami Mar 13, 2015

Member

Need to update the changelog.

Besides that, LGTM, +1

Member

Kami commented Mar 13, 2015

Need to update the changelog.

Besides that, LGTM, +1

@allardhoeve

This comment has been minimized.

Show comment
Hide comment
@allardhoeve

allardhoeve Mar 13, 2015

Contributor

thanks!

Contributor

allardhoeve commented Mar 13, 2015

thanks!

@allardhoeve

This comment has been minimized.

Show comment
Hide comment
@allardhoeve

allardhoeve Mar 13, 2015

Contributor

Documented the changelog. Will wait for the build, then merge.

Contributor

allardhoeve commented Mar 13, 2015

Documented the changelog. Will wait for the build, then merge.

@Kami

This comment has been minimized.

Show comment
Hide comment
@Kami

Kami Mar 14, 2015

Member

Looks like the build is stuck :/

Member

Kami commented Mar 14, 2015

Looks like the build is stuck :/

@allardhoeve

This comment has been minimized.

Show comment
Hide comment
@allardhoeve

allardhoeve Mar 14, 2015

Contributor

Travis is very, very slow lately

Contributor

allardhoeve commented Mar 14, 2015

Travis is very, very slow lately

@Kami

This comment has been minimized.

Show comment
Hide comment
@Kami

Kami Mar 14, 2015

Member

Yeah, build just seems to be stuck. Probably best to just merge since since we don't have admin permissions and we can't restart the build (we could push a "dummy" commit but that's annoying...).

Member

Kami commented Mar 14, 2015

Yeah, build just seems to be stuck. Probably best to just merge since since we don't have admin permissions and we can't restart the build (we could push a "dummy" commit but that's annoying...).

Allard Hoeve added some commits Mar 6, 2015

Allard Hoeve
Document functions and update signature
- Document create_volume_snapshot arguments properly
- Document destroy_volume_snapshot arguments properly
- Update signature to match all existing implementations
  - name should be optional

closes #478
Allard Hoeve

@asfgit asfgit merged commit 7845e08 into apache:trunk Mar 27, 2015

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment