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

Functions

def convert_to_system_image
 Converts specified StorageImage to SystemImage.
def copy
 Copy selected StorageImage to user's StorageImages.
def delete
 Sets StorageImage state as locked.
def download
 Downloads specified StorateImage from remote path.
def edit
 Updates Image's attributes.
def get_by_id
 Fetch requested StorageImage.
def get_list
 Fetch all StorageImages except those that are locked.
def revoke
 Revokes image from the virtual machine.

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.admin_cm.storage_image.convert_to_system_image (   caller_id,
  storage_image_id 
)

Converts specified StorageImage to SystemImage.

After convertion it's not available as StorageImage anymore. File is moved and StorageImage entry is removed from database.

Note
The cm.utils.decorators.admin_cm_log decorator performs CMAdmin authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.admin_cm_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
admin_password(POST string)
storage_image_id(POST int) ID of an StorageImage to convert

Definition at line 168 of file storage_image.py.

def src.cm.views.admin_cm.storage_image.copy (   caller_id,
  src_image_id,
  dest_user_id 
)

Copy selected StorageImage to user's StorageImages.

Note
The cm.utils.decorators.admin_cm_log decorator performs CMAdmin authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.admin_cm_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
admin_password(POST string)
src_image_id(POST int)
dest_user_id(POST int)

Definition at line 192 of file storage_image.py.

def src.cm.views.admin_cm.storage_image.delete (   caller_id,
  storage_image_id 
)

Sets StorageImage state as locked.

Note
The cm.utils.decorators.admin_cm_log decorator performs CMAdmin authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.admin_cm_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
admin_password(POST string)
storage_image_id(POST) id of the Image to delete
Todo:
Should rather delete StorageImage and set its state to 'deleted'.

Definition at line 119 of file storage_image.py.

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

Downloads specified StorateImage from remote path.

Note
The cm.utils.decorators.admin_cm_log decorator performs CMAdmin authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.admin_cm_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
admin_password(POST string)
description(POST string)
name(POST string) how to name newly downloaded storage image
path(POST string) HTTP or FTP path to download StorageImage.
disk_dev(POST)
disk_controller(POST)

Definition at line 55 of file storage_image.py.

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

Updates Image's attributes.

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

Definition at line 138 of file storage_image.py.

def src.cm.views.admin_cm.storage_image.get_by_id (   caller_id,
  storage_image_id 
)

Fetch requested StorageImage.

Note
The cm.utils.decorators.admin_cm_log decorator performs CMAdmin authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.admin_cm_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
admin_password(POST string)
storage_image_id(POST int) id of the requested StorageImage
Returns
HttpResponse with JSON content:
  • response: response status,
  • data: (dict) StorageImages.dict property for requested StorageImage

Definition at line 105 of file storage_image.py.

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

Fetch all StorageImages except those that are locked.

Note
The cm.utils.decorators.admin_cm_log decorator performs CMAdmin authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.admin_cm_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
admin_password(POST string)
Returns
HttpResponse with JSON content:
  • response: response status,
  • data: (list(dict)) StorageImages.dict property for each StorageImages.

Definition at line 89 of file storage_image.py.

def src.cm.views.admin_cm.storage_image.revoke (   caller_id,
  storage_image_id 
)

Revokes image from the virtual machine.

For administrator use, works in "force" mode.

Note
The cm.utils.decorators.admin_cm_log decorator performs CMAdmin authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.admin_cm_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
admin_password(POST string)
storage_image_id(int) ID of an StorageImage to revoke

Definition at line 215 of file storage_image.py.