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

SYSTEM_IMAGE Model VM type image's class. More...

Inherits Image.

Public Member Functions

def copy_to_node
 Copy vm image from storage to node.
def copy_to_storage
 Copy vm image from node images pool to selected image on storage.
def create
def dict
def has_access
def network_device_name
 Method filters NETWORK_DEVICES list to find network device name by the network_device id with is assigned to this Image.
def video_device_name
 Method filters VIDEO_DEVICES list to find video device name by the video_device id that is assigned to this Image.

Static Public Member Functions

def admin_get
 Getter, which should be called by admin.
def get
 Method returns requested VMImage, provided specified User actually has right to access it:

Public Attributes

 access

Static Public Attributes

tuple network_device = models.IntegerField(default=network_devices['virtio'])
tuple platform = models.IntegerField()
tuple video_device = models.IntegerField(default=video_devices['cirrus'])

Detailed Description

SYSTEM_IMAGE Model VM type image's class.

System image is one of the Images type. SystemImage class extends src.cm.models.image.Image class. By default virtual machine boots from copy of the stored VM image. At the VM's creation moment it's required to choose one VM image

We can distinguish:

  • public images
  • private images
  • group images

VM images are mutable while VM is running. When closing VM, the copy of the image that virtual machine is running from may be saved to private images' pool.

Despite the ability of VM images to store data it's not their purpose. It is far more convenient and recommended to store data on Storage Images (StorageImages).

Definition at line 60 of file system_image.py.

Member Function Documentation

def src.cm.models.system_image.SystemImage.admin_get (   sys_image_id)
static

Getter, which should be called by admin.

It doesn't check Image's ownership.

    @param sys_img_id <i>(\c int)</i> primary index of the <i>(\c VMImage)</i>

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

    @exception CMException('image_get')

Definition at line 166 of file system_image.py.

def src.cm.models.system_image.SystemImage.copy_to_node (   self,
  vm 
)

Copy vm image from storage to node.

Exceptions
CMException('vm_create')

Definition at line 233 of file system_image.py.

def src.cm.models.system_image.SystemImage.copy_to_storage (   self,
  vm,
  image 
)

Copy vm image from node images pool to selected image on storage.

Image entity should be createt before calling this function

Definition at line 251 of file system_image.py.

def src.cm.models.system_image.SystemImage.create (   cls,
  name,
  description,
  user,
  platform,
  disk_controller,
  network_device,
  video_device 
)

Definition at line 68 of file system_image.py.

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

Definition at line 90 of file system_image.py.

def src.cm.models.system_image.SystemImage.get (   user_id,
  sys_image_id,
  groups = None 
)
static

Method returns requested VMImage, provided specified User actually has right to access it:

  • either as it's owner,
  • or as member of a Group VMImage belongs to.
Parameters
user_id(int) User for whom VMImage should be obtained
sys_image_id(int) id of the requested VMImage
groups(list(int)) ids of the Groups that User belongs to (optional, None by default)
Returns
(Image) requested VMImage instance, provided specified User actually has right to access it
Exceptions
CMException('image_get')no such VMImage

Definition at line 139 of file system_image.py.

def src.cm.models.system_image.SystemImage.has_access (   self,
  user_id,
  groups = None 
)
Parameters
user_id(int) id of the User to check for right to access
groups(list(int)) id if the Groups User belongs to; required if Image's access type is 'group'
Returns
(bool) True, if specified User or listed Groups have right to access this Image. Otherwise exception is thrown.
Exceptions
CMException('system_image_permission')neither User nor listed Groups have right to access this Image.

Definition at line 188 of file system_image.py.

def src.cm.models.system_image.SystemImage.network_device_name (   self)

Method filters NETWORK_DEVICES list to find network device name by the network_device id with is assigned to this Image.

Returns
(string) name of this Image's network device, if such a network device exists.

Definition at line 221 of file system_image.py.

def src.cm.models.system_image.SystemImage.video_device_name (   self)

Method filters VIDEO_DEVICES list to find video device name by the video_device id that is assigned to this Image.

Returns
(string) name of this Image's the video device, if such a video device exists. otherwise 'vga'

Definition at line 206 of file system_image.py.

Member Data Documentation

src.cm.models.system_image.SystemImage.access

Definition at line 190 of file system_image.py.

tuple src.cm.models.system_image.SystemImage.network_device = models.IntegerField(default=network_devices['virtio'])
static

Definition at line 64 of file system_image.py.

tuple src.cm.models.system_image.SystemImage.platform = models.IntegerField()
static

Definition at line 61 of file system_image.py.

tuple src.cm.models.system_image.SystemImage.video_device = models.IntegerField(default=video_devices['cirrus'])
static

Definition at line 65 of file system_image.py.


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