cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
src.cm.models.iso_image.IsoImage Class Reference

image Model Class for CD Images More...

Inherits Image.

Public Member Functions

def attach
 Attaches this StorageImage to specified VM.
def check_attached
def create
def detach
 Requests Libvirt to detach from given VM this StorageImage.
def dict
def has_access

Static Public Member Functions

def admin_get
 Getter, which should be called by admin.
def get
 Method returns image id if it belongs to user user_id (and optionally to listed groups, if any given)

Public Attributes

 access
 disk_dev
 vm

Detailed Description

image Model Class for CD Images

CD type Image is one of the Images type. CDImage class extends src.cm.models.image.Image class. CD Images are meant to be downloaded by user from some external source and attached to VMs so that VMs may boot from them. Such Images are immutable.

Definition at line 40 of file iso_image.py.

Member Function Documentation

def src.cm.models.iso_image.IsoImage.admin_get (   iso_image_id)
static

Getter, which should be called by admin.

It doesn't check Image's ownership.

    @param iso_image_id <i>(\c int)</i> primary index of the <i>(\c cdImage)</i>

    @returns <i>(\c StorageImage)</i> instance of <i>(\c StorageImage)</i> based on primary index provided

    @exception CMException('image_get')

Definition at line 119 of file iso_image.py.

def src.cm.models.iso_image.IsoImage.attach (   self,
  vm 
)

Attaches this StorageImage to specified VM.

It searches for first free device and if there's any, tries to attach this to it via Libvirt. Further it updates DB information.

Parameters
vm(VM) instance of the existing VM
Exceptions
CMException('storage_image_attach')no free device found or cannot attach StorageImage

Definition at line 161 of file iso_image.py.

def src.cm.models.iso_image.IsoImage.check_attached (   self)

Definition at line 146 of file iso_image.py.

def src.cm.models.iso_image.IsoImage.create (   cls,
  name,
  description,
  user,
  disk_dev,
  disk_controller 
)

Definition at line 233 of file iso_image.py.

def src.cm.models.iso_image.IsoImage.detach (   self,
  vm 
)

Requests Libvirt to detach from given VM this StorageImage.

Parameters
vm(VM) VM from which StorageImage should be detached.
Exceptions
CMException('storage_image_detach')cannot detach StorageImage

Definition at line 207 of file iso_image.py.

def src.cm.models.iso_image.IsoImage.dict (   self)
Returns
(dict) image's data
fields:
  • id
  • user_id (int)
  • name
  • platform
  • description
  • creation_date

Definition at line 54 of file iso_image.py.

def src.cm.models.iso_image.IsoImage.get (   user_id,
  iso_image_id 
)
static

Method returns image id if it belongs to user user_id (and optionally to listed groups, if any given)

Parameters
user_id(int)
iso_image_id(int)
Returns
(Image) image with id given
Exceptions
CMException('image_get')

Definition at line 93 of file iso_image.py.

def src.cm.models.iso_image.IsoImage.has_access (   self,
  user_id 
)
Parameters
user_id(int)
Returns
(bool) True, if user user_id (and optionally listed groups) has access to this image. Otherwise exception is thrown.
Exceptions
CMException('iso_image_permission')

Definition at line 140 of file iso_image.py.

Member Data Documentation

src.cm.models.iso_image.IsoImage.access

Definition at line 142 of file iso_image.py.

src.cm.models.iso_image.IsoImage.disk_dev

Definition at line 193 of file iso_image.py.

src.cm.models.iso_image.IsoImage.vm

Definition at line 194 of file iso_image.py.


The documentation for this class was generated from the following file: