Commit 4c11f5b4 by Máhonfai Bálint

Add filename field to disk export

parent 86c7b4e9
Pipeline #1390 passed with stage
in 0 seconds
......@@ -824,6 +824,7 @@ class VmCreateDiskForm(OperationForm):
class VmDiskExportForm(OperationForm):
exported_name = forms.CharField(max_length=100, label=_('Filename'))
disk_format = forms.ChoiceField(
choices=Disk.EXPORT_FORMATS,
label=_('Format'))
......@@ -850,7 +851,9 @@ class VmDiskExportForm(OperationForm):
HTML(_("<label>Disk:</label> %s") % escape(self.disk)),
css_class="form-group",
),
Field('disk'), Field('disk_format')
Field('disk'),
Field('exported_name'),
Field('disk_format')
)
return helper
......
......@@ -497,9 +497,7 @@ class Disk(TimeStampedModel):
disk.save()
return disk
def export(self, disk_format, upload_link, task):
exported_name = self.name if self.name != '' else self.filename
def export(self, exported_name, disk_format, upload_link, task):
queue_name = self.get_remote_queue_name('storage', priority='slow')
remote = storage_tasks.export_disk.apply_async(
kwargs={
......
......@@ -389,10 +389,10 @@ class ExportDiskOperation(InstanceOperation):
except NoStoreException:
raise PermissionDenied
def _operation(self, user, disk, disk_format, task):
def _operation(self, user, disk, exported_name, disk_format, task):
store = Store(user)
upload_link = store.request_upload('/')
disk.export(disk_format, upload_link, task)
disk.export(exported_name, disk_format, upload_link, task)
@register_operation
......
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 sign in to comment