libvirt.py 711 B

1234567891011121314151617181920212223242526272829303132
  1. """mock libvirt module
  2. WARNING: you did not import real libvirt module
  3. This is needed, because we don't currently ship libvirt-python for templates.
  4. The module contains libvirtError and openReadOnly() function, which
  5. does nothing and raises the aforementioned exception. More functions can be
  6. added as needed.
  7. """
  8. class libvirtError(Exception):
  9. pass
  10. class virConnect:
  11. pass
  12. class virDomain:
  13. pass
  14. def openReadOnly(*args, **kwargs):
  15. raise libvirtError('mock module, always raises')
  16. def registerErrorHandler(f, ctx):
  17. pass
  18. VIR_DOMAIN_BLOCKED = 2
  19. VIR_DOMAIN_RUNNING = 1
  20. VIR_DOMAIN_PAUSED = 3
  21. VIR_DOMAIN_SHUTDOWN = 4
  22. VIR_DOMAIN_SHUTOFF = 5
  23. VIR_DOMAIN_CRASHED = 6
  24. VIR_DOMAIN_PMSUSPENDED = 7