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鈥檒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
Merged

Conversation

@allardhoeve
Copy link
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
Copy link
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
Copy link
Contributor Author

allardhoeve commented Mar 5, 2015

Fixed unknown node states, thanks @gertjanol

@allardhoeve
Copy link
Contributor Author

allardhoeve commented Mar 7, 2015

@Kami, does this need a proposal @ dev?

@allardhoeve allardhoeve changed the title Add state to StorageVolume Add state attribute to StorageVolume Mar 11, 2015
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).

This comment has been minimized.

@allardhoeve

allardhoeve Mar 13, 2015 Author Contributor

Done.

@@ -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".

This comment has been minimized.

@allardhoeve

allardhoeve Mar 13, 2015 Author Contributor

And done.

@Kami
Copy link
Member

Kami commented Mar 13, 2015

Need to update the changelog.

Besides that, LGTM, +1

@allardhoeve
Copy link
Contributor Author

allardhoeve commented Mar 13, 2015

thanks!

@allardhoeve
Copy link
Contributor Author

allardhoeve commented Mar 13, 2015

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

@Kami
Copy link
Member

Kami commented Mar 14, 2015

Looks like the build is stuck :/

@allardhoeve
Copy link
Contributor Author

allardhoeve commented Mar 14, 2015

Travis is very, very slow lately

@Kami
Copy link
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 2 commits Mar 6, 2015
Allard Hoeve
- 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
closes #476
@allardhoeve allardhoeve force-pushed the ByteInternet:add-volume-state branch from 528556e to 7845e08 Mar 27, 2015
@asfgit asfgit merged commit 7845e08 into apache:trunk Mar 27, 2015
0 of 2 checks passed
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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can鈥檛 perform that action at this time.