Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. def _validate_power_state(self, node_uuid, power_state):
  2. # Validate that power state is set within timeout
  3. if power_state == 'rebooting':
  4. power_state = 'power on'
  5. start = timeutils.utcnow()
  6. while timeutils.delta_seconds(
  7. start, timeutils.utcnow()) < self.power_timeout:
  8. resp, node = self.client.show_node(node_uuid)
  9. self.assertEqual(200, resp.status)
  10. if node['power_state'] == power_state:
  11. return False
  12. message = ('Failed to set power state within '
  13. 'the required time: %s sec.' % self.power_timeout)
  14. raise exceptions.TimeoutException(message)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement