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

Functions

def attach_vnc
 Attaches VNC redirection to VM.
def create
 Creates virtual machines.
def destroy
 This function only destroys VM.
def detach_vnc
 Detaches VNC redirection from VM.
def edit
 Updates VM's attributes.
def get_by_id
 Returns requested caller's VM.
def get_list
 Returns caller's VMs.
def reset
 Safely restarts selected callers VMs.
def save_and_shutdown
 Calls VM.save_and_shutdown() on specified VM.

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
Maciej Nabożny di.di.nosp@m.jo@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

Function Documentation

def src.cm.views.user.vm.attach_vnc (   caller_id,
  vm_id 
)

Attaches VNC redirection to 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 to have attached VM redirection

Definition at line 217 of file vm.py.

def src.cm.views.user.vm.create (   caller_id,
  name,
  description,
  image_id,
  template_id,
  public_ip_id,
  iso_list,
  disk_list,
  vnc,
  groups,
  count = 1,
  user_data = None,
  ssh_key = None,
  ssh_username = None 
)

Creates virtual machines.

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)
image_id(POST int)
template_id(POST int)
public_ip_id(POST int)
iso_list(POST list(int)) ISOs' ids
disk_list(POST list(int))
vnc(POST)
count(POST)
groups(POST)
user_data(POST) data accessible via ec2ctx
ssh_key(POST)
ssh_username(POST)
Returns
as returned by src.cm.views.utils.vm.create()

Definition at line 61 of file vm.py.

def src.cm.views.user.vm.destroy (   caller_id,
  vm_ids 
)

This function only destroys VM.

All the cleanup (removing disk, saving, rescuing resources, ...) is done by hook through contextualization.update_vm method (yeah, intuitive).

Simple sequence diagram:

CLM CM CTX Node (HOOK)
.
Destroy -->destroy
| | (LV.destroy)
| |------------------------->HookScript
. . |
. . ctx.update_vm<--|
. . | |
. . |------------->cp
. . |------------->rm
. . update_resources
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_ids(POST list) list of virtual machines' ids
Returns
HttpResponse with JSON content:
  • response: response status,
  • data: (list(dict)) VM.destroy() retval

Definition at line 106 of file vm.py.

def src.cm.views.user.vm.detach_vnc (   caller_id,
  vm_id 
)

Detaches VNC redirection from 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 to have detached VM redirection

Definition at line 235 of file vm.py.

def src.cm.views.user.vm.edit (   caller_id,
  vm_id,
  name = None,
  description = None 
)

Updates VM's attributes.

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 to edit
name(POST string)
description(POST string)
Returns
HttpResponse with JSON content:

Definition at line 200 of file vm.py.

def src.cm.views.user.vm.get_by_id (   caller_id,
  vm_id 
)

Returns requested caller's 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 requested VM
Returns
HttpResponse with JSON content:
  • response: response status,
  • data: (dict) VM.dict property of the requested VM

Definition at line 160 of file vm.py.

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

Returns caller's VMs.

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)) VM.dict property of all caller's VMs

Definition at line 142 of file vm.py.

def src.cm.views.user.vm.reset (   caller_id,
  vm_ids 
)

Safely restarts selected callers VMs.

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_ids(POST list(int)) ids of the VMs to restart
Returns
HttpResponse with JSON content:

Definition at line 178 of file vm.py.

def src.cm.views.user.vm.save_and_shutdown (   caller_id,
  vm_id,
  name,
  description 
)

Calls VM.save_and_shutdown() on 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 to save and shutdown.
name(POST string) name of the new SystemImage VM should be saved to
description(POST string) description of the new SystemImage VM should be saved to

Definition at line 124 of file vm.py.