Commit 1367c67d authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Revert "cyclades: Invalidate snapshots when job fails"

This reverts commit 0d1b405d that has
been accidentally pushed remotely.
parent 0d1b405d
......@@ -26,7 +26,6 @@ from synnefo import quotas
from synnefo.api.util import release_resource
from synnefo.util.mac2eui64 import mac2eui64
from synnefo.logic import rapi
from synnefo import volume
from logging import getLogger
log = getLogger(__name__)
......@@ -584,13 +583,7 @@ def adopt_instance_disk(server, gnt_disk):
def update_snapshot(snap_id, user_id, job_id, job_status, etime):
"""Update a snapshot based on result of a Ganeti job."""
if job_status in rapi.JOB_STATUS_FINALIZED:
if (job_status == rapi.JOB_STATUS_SUCCESS):
status = "AVAILABLE"
else:
status = "ERROR"
log.debug("Updating status of snapshot '%s' to '%s'", snap_id, status)
volume.util.update_snapshot_status(snap_id, user_id, status=status)
return
@transaction.commit_on_success
......
......@@ -424,7 +424,6 @@ class PlanktonBackend(object):
images = []
for (location, metadata, permissions) in _images:
print metadata
location = Location(*location.split("/", 2))
images.append(image_to_dict(location, metadata, permissions))
......@@ -487,14 +486,6 @@ class PlanktonBackend(object):
def delete_snapshot(self, snapshot_uuid):
self.backend.delete_by_uuid(self.user, snapshot_uuid)
@handle_pithos_backend
def update_status(self, image_uuid, status):
"""Update status of snapshot"""
location, _ = self._get_raw_metadata(image_uuid)
properties = {"status": status.upper()}
self._update_metadata(image_uuid, location, properties, replace=False)
return self._get_image(image_uuid)
def create_url(account, container, name):
"""Create a Pithos URL from the object info"""
......
......@@ -103,8 +103,3 @@ def volume_to_links(volume_id):
def snapshot_to_links(snapshot_id):
href = join_urls(SNAPSHOTS_URL, str(snapshot_id))
return [{"rel": rel, "href": href} for rel in ("self", "bookmark")]
def update_snapshot_status(snapshot_id, user_id, status):
with backend.PlanktonBackend(user_id) as b:
return b.update_status(snapshot_id, status=status)
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