Commit 9bc075e4 by Karsa Zoltán István

disk download datastore

parent 01dd477c
......@@ -5,8 +5,7 @@
{% if d.ci_disk %} <i class="fa fa-cloud-upload"></i>
{% endif %}
{{ d.name }} (#{{ d.id }}) - {{ d.size|filesize }}
{{ d.name }} (<i class="fa fa-database"></i> {{ d.datastore.name }} #{{ d.id }}) - {{ d.size|filesize }}
<span class="operation-wrapper pull-right">
{% if d.is_exportable %}
......
......@@ -470,7 +470,7 @@ class Disk(TimeStampedModel):
return disk
@classmethod
def download(cls, url, task, user=None, resize = None, **params):
def download(cls, url, task, user=None, resize = None, datastore = None, **params):
"""Create disk object and download data from url synchronusly.
:param url: image url to download.
......@@ -488,7 +488,9 @@ class Disk(TimeStampedModel):
params.setdefault('name', url.split('/')[-1])
params.setdefault('type', 'iso')
params.setdefault('size', None)
disk = cls.__create(params=params, user=user)
if not datastore:
datastore = DataStore.objects.filter(name='default').get().name
disk = cls.__create(params=params, user=user, datastore=datastore)
queue_name = disk.get_remote_queue_name('storage', priority='slow')
remote = storage_tasks.download.apply_async(
kwargs={'url': url, 'parent_id': task.request.id,
......
......@@ -366,7 +366,7 @@ class DownloadDiskOperation(InstanceOperation):
concurrency_check = False # warning!!!
def _operation(self, user, url, task, activity, datastore, name=None):
disk = Disk.download(url=url, name=name, task=task)
disk = Disk.download(url=url, name=name, task=task, datastore=datastore.name)
devnums = list(ascii_lowercase)
for d in self.instance.disks.all():
devnums.remove(d.dev_num)
......
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