Commit 746b4b08 by Máhonfai Bálint

Switch disk import to SSH

parent 239f9e7b
...@@ -477,7 +477,7 @@ class Disk(TimeStampedModel): ...@@ -477,7 +477,7 @@ class Disk(TimeStampedModel):
return disk return disk
@classmethod @classmethod
def import_disk(cls, user, name, download_link, task): def import_disk(cls, user, name, download_link, port, task):
params = {'name': name, params = {'name': name,
'type': 'qcow2-norm'} 'type': 'qcow2-norm'}
disk = cls.__create(user=user, params=params) disk = cls.__create(user=user, params=params)
...@@ -486,7 +486,7 @@ class Disk(TimeStampedModel): ...@@ -486,7 +486,7 @@ class Disk(TimeStampedModel):
kwargs={ kwargs={
"disk_desc": disk.get_disk_desc(), "disk_desc": disk.get_disk_desc(),
"url": download_link, "url": download_link,
"task": task.request.id "port": port
}, },
queue=queue_name queue=queue_name
) )
......
...@@ -352,7 +352,6 @@ class ImportDiskOperation(InstanceOperation): ...@@ -352,7 +352,6 @@ class ImportDiskOperation(InstanceOperation):
'from the user store. The disk image has to be in the ' 'from the user store. The disk image has to be in the '
'root directory of the store.') 'root directory of the store.')
abortable = True abortable = True
has_percentage = True
required_perms = ('storage.import_disk',) required_perms = ('storage.import_disk',)
accept_states = ('STOPPED', 'PENDING', 'RUNNING') accept_states = ('STOPPED', 'PENDING', 'RUNNING')
async_queue = 'localhost.man.slow' async_queue = 'localhost.man.slow'
...@@ -366,8 +365,8 @@ class ImportDiskOperation(InstanceOperation): ...@@ -366,8 +365,8 @@ class ImportDiskOperation(InstanceOperation):
def _operation(self, user, name, disk_path, task): def _operation(self, user, name, disk_path, task):
store = Store(user) store = Store(user)
download_link = store.request_download(disk_path) download_link, port = store.request_ssh_download(disk_path)
disk = Disk.import_disk(user, name, download_link, task) disk = Disk.import_disk(user, name, download_link, port, task)
self.instance.disks.add(disk) self.instance.disks.add(disk)
......
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