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

Functions

def convert_to_storage_image
 Changes type of the given Image.
def create
 Creates dummy SystemImage for future upload.
def delete
 Deletes specified SystemImage.
def download
 Downloads specified SystemImage file to CM storage and makes it available in CC1 system to start VM with.
def download_ec2
 Downloads specified SystemImage to CM via EC2.
def edit
 Updates attributes of the specified SystemImage.
def get_by_id
def get_disk_controllers
def get_filesystems
def get_list
 Returns SystemImages with specified access (and from specific Group if group_id is specified).
def get_network_devices
def get_video_devices
def set_group
 Method sets specified Image access type as group (belonging to specified Group) (only for sys and cd images - from private or public to group)
def set_private
 Marks SystemImage as private.

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.system_image.convert_to_storage_image (   caller_id,
  system_image_id 
)

Changes type of the given Image.

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)
system_image_id(POST int) ID of an Image to change type of

Definition at line 336 of file system_image.py.

def src.cm.views.user.system_image.create (   caller_id,
  name,
  description,
  size,
  disk_controller,
  network_device,
  platform,
  video_device 
)

Creates dummy SystemImage for future upload.

Returns the id of the newly created SystemImage. SystemImage is only created in database, there's no physical entity representing it.

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)
size(POST int)
disk_controller(POST int)
network_device(POST)
platform(POST)
video_device(POST)
Returns
HttpResponse with JSON content:
  • response: response status,
  • data: (dict) {'system_image_id': SystemImage.id}
Exceptions
CMException('image_create')

Definition at line 66 of file system_image.py.

def src.cm.views.user.system_image.delete (   caller_id,
  system_image_ids 
)

Deletes specified SystemImage.

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)
system_image_ids(POST list(int)) id of the SystemImage to delete

Definition at line 218 of file system_image.py.

def src.cm.views.user.system_image.download (   caller_id,
  name,
  description,
  path,
  disk_controller,
  network_device,
  platform,
  video_device 
)

Downloads specified SystemImage file to CM storage and makes it available in CC1 system to start VM with.

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 image to download
disk_controller(POST)
network_device(POST)
platform(POST)
video_device(POST)
Exceptions
CMException('image_not_found')
CMException('image_create')

Definition at line 139 of file system_image.py.

def src.cm.views.user.system_image.download_ec2 (   caller_id,
  system_image_id,
  path 
)

Downloads specified SystemImage to CM via EC2.

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)
system_image_id(POST int)
path(POST string) HTTP or FTP path to SystemImage
Exceptions
CMException('image_not_found')
CMException('image_create')

Definition at line 98 of file system_image.py.

def src.cm.views.user.system_image.edit (   caller_id,
  system_image_id,
  name = None,
  description = None,
  disk_controller = None,
  video_device = None,
  network_device = None,
  platform = None 
)

Updates attributes of the specified SystemImage.

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)
system_image_id(POST int) id of the SystemImage to edit
name(POST string) SystemImage new name (optional)
description(POST string) SystemImage new description (optional)
disk_controller(POST) SystemImage new controller (optional)
video_device(POST) SystemImage new video device (optional)
network_device(POST) SystemImage new network device (optional)
platform(POST) (optional)

Definition at line 255 of file system_image.py.

def src.cm.views.user.system_image.get_by_id (   caller_id,
  system_image_id,
  groups 
)
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)
groups(POST list(int)) list of Groups ids, required for group access
system_image_id(POST int) id of the requested Image
Returns
HttpResponse with JSON content:
  • response: response status,
  • data: (dict) SystemImage.dict property of the requested SystemImage

Definition at line 206 of file system_image.py.

def src.cm.views.user.system_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)) id and name for each disk controller

Definition at line 382 of file system_image.py.

def src.cm.views.user.system_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 352 of file system_image.py.

def src.cm.views.user.system_image.get_list (   caller_id,
  access,
  group_id = None 
)

Returns SystemImages with specified access (and from specific Group if group_id is specified).

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)
access(POST) one of common.hardware.image_access
group_id(POST list(int)) list of Groups ids, required for group access
Returns
HttpResponse with JSON content:
  • response: response status,
  • data: (list(dict)) list of the images from CM

Definition at line 181 of file system_image.py.

def src.cm.views.user.system_image.get_network_devices (   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 372 of file system_image.py.

def src.cm.views.user.system_image.get_video_devices (   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 362 of file system_image.py.

def src.cm.views.user.system_image.set_group (   caller_id,
  system_image_id,
  group_id 
)

Method sets specified Image access type as group (belonging to specified Group) (only for sys and cd images - from private or public to group)

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)
group_id(POST int) id of the Group Image should belong to
system_image_id(POST int)
Returns
HttpResponse with JSON content:
  • response: response status,
  • data: (None)

Definition at line 312 of file system_image.py.

def src.cm.views.user.system_image.set_private (   caller_id,
  system_image_id,
  leader_groups 
)

Marks SystemImage as private.

The caller needs to be:

  • either the owner of the SystemImage
  • or the leader of the group to which SystemImage belongs
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)
system_image_id(POST int) id of the Image to set private
leader_groups(POST list(int)) ids of the group where the caller is leader, requierd if Image's access type is group

Definition at line 287 of file system_image.py.