Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. diff --git a/gui/failover/forms.py b/gui/failover/forms.py
  2. index 4c45ad1..aa2ab14 100644
  3. --- a/gui/failover/forms.py
  4. +++ b/gui/failover/forms.py
  5. @@ -54,9 +54,24 @@ class FailoverForm(ModelForm):
  6. pass
  7. if imported:
  8. os.system('/usr/local/bin/python /usr/local/sbin/fenced force')
  9. - notifier().start("ix-devd")
  10. return obj
  11.  
  12. + def done(self, *args, **kwargs):
  13. + s = notifier().failover_rpc()
  14. + if self.instance.master is True:
  15. + try:
  16. + s.run_sql("UPDATE system_failover SET master = %s", ["0"])
  17. + except:
  18. + # this will get journalled
  19. + pass
  20. + else:
  21. + try:
  22. + s.run_sql("UPDATE system_failover SET master = %s", ["1"])
  23. + except:
  24. + # this will get journalled
  25. + pass
  26. + super(FailoverForm, self).done(*args, **kwargs)
  27. + notifier().start("ix-devd")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement