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 a check function for the EBS resource. #877

Closed
wants to merge 0 commits into from

Conversation

benhamad
Copy link
Contributor

@benhamad benhamad commented Feb 25, 2018

If missing the volume will be marked as such, after a check
operation. Also show more meaningful error message when a volume
disappear. This fix #876.

def check(self):
volume = nixops.ec2_utils.get_volume_by_id(self.connect(self.region), self.volume_id)
if volume is None:
self.state = self.MISSING
Copy link
Member

Choose a reason for hiding this comment

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

we probably need a warning that the volume is no longer available here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, the disks check doesn't include notes like the machine one. But after updating the volume state, the check table show it as missing

Machines state:
+---------+--------+-----+-----------+----------+----------------+----------------------------------------+------------------------------------------------------------+
| Name    | Exists | Up  | Reachable | Disks OK | Load avg.      | Units                                  | Notes                                                      |
+---------+--------+-----+-----------+----------+----------------+----------------------------------------+------------------------------------------------------------+
| machine | Yes    | Yes | Yes       | No       | 0.00 0.00 0.00 | proc-sys-fs-binfmt_misc.mount [failed] | volume ‘vol-096cbe0647ee88eae’ not attached to ‘/dev/xvdf’ |
|         |        |     |           |          |                |                                        | volume ‘vol-096cbe0647ee88eae’ no longer exists            |
+---------+--------+-----+-----------+----------+----------------+----------------------------------------+------------------------------------------------------------+
Non machines resources state:
+--------------------+--------+
| Name               | Exists |
+--------------------+--------+
| data_volume        | No     |
| my-key-pair        | Yes    |
| ssh-security-group | Yes    |
+--------------------+--------+

The only thing that I can add is a message like this

data_volume.......> Volume VOLUME_ID is missing!

Before the check tables

Copy link
Member

Choose a reason for hiding this comment

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

I see, yeah seems the existent warnings are fine already.

@@ -141,6 +141,10 @@ def create(self, defn, check, allow_reboot, allow_recreate):
states=['available', 'in-use'])
self.state = self.UP

def check(self):
Copy link
Member

Choose a reason for hiding this comment

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

hm isn't the method name _check ?

Copy link
Member

Choose a reason for hiding this comment

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

nevermind, checked again, this should work as well.

@@ -506,6 +506,8 @@ def create_after(self, resources, defn):

def attach_volume(self, device, volume_id):
volume = nixops.ec2_utils.get_volume_by_id(self.connect(), volume_id)
if not volume:
raise Exception("volume {0} doesn't exist".format(volume_id))
Copy link
Member

Choose a reason for hiding this comment

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

Maybe you can suggest running nixops check here to reconcile the state with the real-world state.

@benhamad
Copy link
Contributor Author

Ping @rbvermaa

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

Successfully merging this pull request may close these issues.

Attatched volumes don't get marked as missing after check.
2 participants