Commit 7258df21 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Revert "cyclades: Fix bug when deleting instances"

This reverts commit 8331c929facc5849b98e0fb945d047a4f4504b3a. Before
this commit is applied we must extend DeleteInstance method of
GanetiRAPIClient to support the 'depends' attribute.
parent 837b9878
......@@ -43,7 +43,7 @@ from synnefo.logic import utils
from synnefo import quotas
from synnefo.api.util import release_resource
from synnefo.util.mac2eui64 import mac2eui64
from synnefo.logic.rapi import GanetiApiError, JOB_STATUS_FINALIZED
from synnefo.logic.rapi import GanetiApiError
from logging import getLogger
log = getLogger(__name__)
......@@ -567,16 +567,8 @@ def create_instance(vm, nics, flavor, image):
def delete_instance(vm):
depends = []
if ((vm.backendopcode == "OP_INSTANCE_CREATE") and
(vm.backendjobid is not None) and
(vm.backendjobstatus not in JOB_STATUS_FINALIZED) and
(job_is_still_running(vm, vm.backendjobid))):
depends = [[job, ["success", "error", "canceled"]] for job in depends]
with pooled_rapi_client(vm) as client:
return client.DeleteInstance(vm.backend_vm_id, dry_run=settings.TEST,
return client.DeleteInstance(vm.backend_vm_id, dry_run=settings.TEST)
def reboot_instance(vm, reboot_type):
......@@ -643,17 +635,6 @@ def get_instance_console(vm):
return console
def job_is_still_running(vm, job_id):
"""Check if a Ganeti job still running."""
with pooled_rapi_client(vm) as client:
job_status = client.GetJobStatus(job_id)
if job_status is None:
return False
if job_status in JOB_STATUS_FINALIZED:
return False
return True
def get_instance_info(vm):
with pooled_rapi_client(vm) as client:
return client.GetInstance(vm.backend_vm_id)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment