From 7a8c2ac54376bf3580605ed3ac73e6007b659871 Mon Sep 17 00:00:00 2001 From: Bálint Máhonfai <mbalint314@gmail.com> Date: Tue, 12 Nov 2019 09:55:36 +0100 Subject: [PATCH] Use the store to upload exported disk --- circle/vm/operations.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/circle/vm/operations.py b/circle/vm/operations.py index a9bdbfa..7df6cb7 100644 --- a/circle/vm/operations.py +++ b/circle/vm/operations.py @@ -360,8 +360,18 @@ class ExportDiskOperation(InstanceOperation): accept_states = ('STOPPED',) async_queue = 'localhost.man.slow' - def _operation(self, disk, format): - disk.export(format) + def check_auth(self, user): + super(ExportDiskOperation, self).check_auth(user) + try: + Store(user) + except NoStoreException: + raise PermissionDenied + + def _operation(self, user, disk, format): + store = Store(user) + store.new_folder('/export') + upload_link = store.request_upload('/export') + disk.export(format, upload_link) @register_operation -- libgit2 0.26.0