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

Add state attribute to StorageVolume #476

Merged
merged 2 commits into from
Mar 27, 2015

Conversation

allardhoeve
Copy link
Contributor

  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

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

Fixed unknown node states, thanks @gertjanol

@allardhoeve
Copy link
Contributor Author

@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]
Copy link
Member

Choose a reason for hiding this comment

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

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@Kami
Copy link
Member

Kami commented Mar 13, 2015

Need to update the changelog.

Besides that, LGTM, +1

@allardhoeve
Copy link
Contributor Author

thanks!

@allardhoeve
Copy link
Contributor Author

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

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 March 27, 2015 11:59
- Document create_volume_snapshot arguments properly
- Document destroy_volume_snapshot arguments properly
- Update signature to match all existing implementations
  - name should be optional

closes apache#478
@asfgit asfgit merged commit 7845e08 into apache:trunk Mar 27, 2015
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.

4 participants