cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
src.cm.views.user.storage_image Namespace Reference

Functions

def attach
 Attaches selected StorageImage to specified VM.
def convert_to_system_image
 Converts StorageImage to SystemImage so that it may be selected as os container when creating new VM.
def create
 Creates new StorageImage.
def delete
 Deletes given StorageImage from CM storage space.
def detach
 Detaches specified StorageImage from specified VM.
def download
 Downloads specified StorageImage.
def edit
 Sets Image's new attributes.
def get_by_id
def get_disk_controllers
def get_filesystems
def get_list
 Returns StorageImages.

Detailed Description

Note
All functions here are decorated by src.cm.utils.decorators.user_log. It's recommended to read src.cm.utils.decorators.user_log docs before using functions below.
Author
Tomek Sośnicki tom.s.nosp@m.osni.nosp@m.cki@g.nosp@m.mail.nosp@m..com
Miłosz Zdybał milos.nosp@m.z.zd.nosp@m.ybal@.nosp@m.ifj..nosp@m.edu.p.nosp@m.l
Maciej Nabożny mn@mn.nosp@m.aboz.nosp@m.ny.pl

Function Documentation

def src.cm.views.user.storage_image.attach (   caller_id,
  storage_image_id,
  vm_id 
)

Attaches selected StorageImage to specified VM.

Such a disk may be mounted to VM so that data generated by VM could be stored on it. VM also has access to data already stored on that attached StorageImage.

Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
storage_image_id(POST int) id of a StorageImage block device - Disk Volume Image
vm_id(POST int) id of the VM which StorageImage should be attached to

Definition at line 220 of file storage_image.py.

def src.cm.views.user.storage_image.convert_to_system_image (   caller_id,
  storage_image_id,
  platform,
  disk_controller,
  network_device,
  video_device 
)

Converts StorageImage to SystemImage so that it may be selected as os container when creating new VM.

Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
storage_image_id(POST int)
platform(POST)
disk_controller(POST)
network_device(POST)
video_device(POST)

Definition at line 270 of file storage_image.py.

def src.cm.views.user.storage_image.create (   caller_id,
  name,
  description,
  filesystem,
  size,
  disk_controller 
)

Creates new StorageImage.

Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
name(POST string)
description(POST string)
filesystem(POST int) id of the filesystem. Supported filesystems are common.hardware.disk_filesystems
size(POST int) size of the SystemImage to create [MB]
disk_controller(POST)
Returns
HttpResponse with JSON content:
  • response: response status,
  • data: (dict) StorageImage.dict property of newly created StorageImage

Definition at line 59 of file storage_image.py.

def src.cm.views.user.storage_image.delete (   caller_id,
  storage_image_ids 
)

Deletes given StorageImage from CM storage space.

Such an StorageImage can in no way be restored. It's also deleted from database.

Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
storage_image_ids(POST list(int)) id of the StorageImage to delete

Definition at line 158 of file storage_image.py.

def src.cm.views.user.storage_image.detach (   caller_id,
  storage_image_id,
  vm_id 
)

Detaches specified StorageImage from specified VM.

Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
vm_id(POST int) id of the VM StorageImage should be detached from
storage_image_id(POST int) id of the StorageImage to detach

Definition at line 245 of file storage_image.py.

def src.cm.views.user.storage_image.download (   caller_id,
  name,
  description,
  path,
  disk_controller 
)

Downloads specified StorageImage.

Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
name(POST string)
description(POST string)
path(POST string) HTTP or FTP path to StorageImage to download
disk_controller(POST)

Definition at line 89 of file storage_image.py.

def src.cm.views.user.storage_image.edit (   caller_id,
  storage_image_id,
  name = None,
  description = None,
  disk_controller = None 
)

Sets Image's new attributes.

Those should be get by src.cm.manager.image.get_by_id().

Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
storage_image_id(POST int) id of the Image to edit
name(POST string) new Image name
description(POST string) new Image description
disk_controller(POST) new Image controller optional

Definition at line 192 of file storage_image.py.

def src.cm.views.user.storage_image.get_by_id (   caller_id,
  storage_image_id 
)
Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
storage_image_id(POST int) id of the requested StorageImage
Returns
HttpResponse with JSON content:
  • response: response status,
  • data: (dict) StorageImage.dict property of the requested StorageImage

Definition at line 145 of file storage_image.py.

def src.cm.views.user.storage_image.get_disk_controllers (   caller_id)
Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
Returns
HttpResponse with JSON content:
  • response: response status,
  • data: (list(dict)) keys: id, name, live_attach

Definition at line 300 of file storage_image.py.

def src.cm.views.user.storage_image.get_filesystems (   caller_id)
Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
Returns
HttpResponse with JSON content:

Definition at line 290 of file storage_image.py.

def src.cm.views.user.storage_image.get_list (   caller_id)

Returns StorageImages.

Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
Returns
HttpResponse with JSON content:
  • response: response status,
  • data: (list(dict)) StorageImage.dict property of each unlocked caller's StorageImage

Definition at line 131 of file storage_image.py.