Revision c397dbce snf-cyclades-app/synnefo/logic/backend.py
b/snf-cyclades-app/synnefo/logic/backend.py | ||
---|---|---|
683 | 683 |
return client.CreateInstance(**kw) |
684 | 684 |
|
685 | 685 |
|
686 |
def delete_instance(vm): |
|
686 |
def delete_instance(vm, shutdown_timeout=None):
|
|
687 | 687 |
with pooled_rapi_client(vm) as client: |
688 |
return client.DeleteInstance(vm.backend_vm_id, dry_run=settings.TEST) |
|
688 |
return client.DeleteInstance(vm.backend_vm_id, |
|
689 |
shutdown_timeout=shutdown_timeout, |
|
690 |
dry_run=settings.TEST) |
|
689 | 691 |
|
690 | 692 |
|
691 |
def reboot_instance(vm, reboot_type): |
|
693 |
def reboot_instance(vm, reboot_type, shutdown_timeout=None):
|
|
692 | 694 |
assert reboot_type in ('soft', 'hard') |
693 | 695 |
# Note that reboot type of Ganeti job must be always hard. The 'soft' and |
694 | 696 |
# 'hard' type of OS API is different from the one in Ganeti, and maps to |
... | ... | |
698 | 700 |
# 'shutdown_timeout' parameter is only support from snf-ganeti>=2.8.2 and |
699 | 701 |
# Ganeti > 2.10. In other versions this parameter will be ignored and |
700 | 702 |
# we will fallback to default timeout of Ganeti (120s). |
703 |
if shutdown_timeout is not None: |
|
704 |
kwargs["shutdown_timeout"] = shutdown_timeout |
|
701 | 705 |
if reboot_type == "hard": |
702 | 706 |
kwargs["shutdown_timeout"] = 0 |
703 | 707 |
if settings.TEST: |
... | ... | |
711 | 715 |
return client.StartupInstance(vm.backend_vm_id, dry_run=settings.TEST) |
712 | 716 |
|
713 | 717 |
|
714 |
def shutdown_instance(vm): |
|
718 |
def shutdown_instance(vm, shutdown_timeout=None):
|
|
715 | 719 |
with pooled_rapi_client(vm) as client: |
716 |
return client.ShutdownInstance(vm.backend_vm_id, dry_run=settings.TEST) |
|
720 |
return client.ShutdownInstance(vm.backend_vm_id, |
|
721 |
timeout=shutdown_timeout, |
|
722 |
dry_run=settings.TEST) |
|
717 | 723 |
|
718 | 724 |
|
719 | 725 |
def resize_instance(vm, vcpus, memory): |
Also available in: Unified diff