Revision bbae3e45
b/snf-cyclades-app/synnefo/api/servers.py | ||
---|---|---|
733 | 733 |
# buildInProgress (409), |
734 | 734 |
# overLimit (413) |
735 | 735 |
|
736 |
reboot_type = args.get("type") |
|
737 |
if reboot_type is None: |
|
738 |
raise faults.BadRequest("Missing 'type' attribute.") |
|
739 |
elif reboot_type not in ["SOFT", "HARD"]: |
|
736 |
reboot_type = args.get("type", "SOFT") |
|
737 |
if reboot_type not in ["SOFT", "HARD"]: |
|
740 | 738 |
raise faults.BadRequest("Invalid 'type' attribute.") |
741 | 739 |
vm = servers.reboot(vm, reboot_type=reboot_type) |
742 | 740 |
return HttpResponse(status=202) |
b/snf-cyclades-app/synnefo/logic/backend.py | ||
---|---|---|
572 | 572 |
|
573 | 573 |
def reboot_instance(vm, reboot_type): |
574 | 574 |
assert reboot_type in ('soft', 'hard') |
575 |
kwargs = {"instance": vm.backend_vm_id, |
|
576 |
"reboot_type": "hard"} |
|
577 |
# XXX: Currently shutdown_timeout parameter is not supported from the |
|
578 |
# Ganeti RAPI. Until supported, we will fallback for both reboot types |
|
579 |
# to the default shutdown timeout of Ganeti (120s). Note that reboot |
|
580 |
# type of Ganeti job must be always hard. The 'soft' and 'hard' type |
|
581 |
# of OS API is different from the one in Ganeti, and maps to |
|
582 |
# 'shutdown_timeout'. |
|
583 |
#if reboot_type == "hard": |
|
584 |
# kwargs["shutdown_timeout"] = 0 |
|
585 |
if settings.TEST: |
|
586 |
kwargs["dry_run"] = True |
|
575 | 587 |
with pooled_rapi_client(vm) as client: |
576 |
return client.RebootInstance(vm.backend_vm_id, reboot_type, |
|
577 |
dry_run=settings.TEST) |
|
588 |
return client.RebootInstance(**kwargs) |
|
578 | 589 |
|
579 | 590 |
|
580 | 591 |
def startup_instance(vm): |
b/snf-cyclades-app/synnefo/ui/static/snf/js/models.js | ||
---|---|---|
1438 | 1438 |
case 'reboot': |
1439 | 1439 |
this.__make_api_call(this.get_action_url(), // vm actions url |
1440 | 1440 |
"create", // create so that sync later uses POST to make the call |
1441 |
{reboot:{type:"HARD"}}, // payload
|
|
1441 |
{reboot:{}}, // payload |
|
1442 | 1442 |
function() { |
1443 | 1443 |
// set state after successful call |
1444 | 1444 |
self.state("REBOOT"); |
Also available in: Unified diff