<s> from __future__ import print_function , unicode_literals <EOL> import os <EOL> import shutil <EOL> import datetime <EOL> VM_DISKS_TO_SAVE_NAME = '<STR_LIT>' <EOL> VM_DISKS_TO_SAVE_DEFAULT_VALUE = [ ] <EOL> VM_STORAGE_DIR_NAME = "<STR_LIT>" <EOL> VM_STORAGE_DIR_DEFAULT_VALUE = "<STR_LIT>" <EOL> VM_DISKS_TO_PREPARE_NAME = '<STR_LIT>' <EOL> VM_DISKS_TO_PREPARE_DEFAULT_VALUE = { } <EOL> class VirtualMachineManager ( object ) : <EOL> def __init__ ( self , cfg_manager ) : <EOL> self . _cfg = cfg_manager <EOL> self . vm_disks = cfg_manager . get_value ( VM_DISKS_TO_SAVE_NAME , VM_DISKS_TO_SAVE_DEFAULT_VALUE ) <EOL> self . vm_store_dir = cfg_manager . get_value ( VM_STORAGE_DIR_NAME , VM_STORAGE_DIR_DEFAULT_VALUE ) <EOL> self . vm_prepare = cfg_manager . get_value ( VM_DISKS_TO_PREPARE_NAME , VM_DISKS_TO_PREPARE_DEFAULT_VALUE ) <EOL> def launch_vm ( self ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def kill_vm ( self ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def is_alive_vm ( self ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def store_image_vm ( self ) : <EOL> """<STR_LIT>""" <EOL> identifier = datetime . datetime . now ( ) . strftime ( "<STR_LIT>" ) <EOL> for disk in self . vm_disks : <EOL> dst = os . sep . join ( self . vm_storage_dir , '<STR_LIT>' % ( identifier , disk . replace ( '<STR_LIT:/>' , '<STR_LIT:_>' ) . replace ( os . sep , '<STR_LIT:_>' ) ) ) <EOL> self . _copy_file ( disk , dst ) <EOL> def prepare_vm ( self ) : <EOL> """<STR_LIT>""" <EOL> for disk in self . vm_prepare : <EOL> src = self . vm_prepare [ disk ] <EOL> self . _copy_file ( src , disk ) <EOL> def _copy_file ( self , src , dst ) : <EOL> """<STR_LIT>""" <EOL> shutil . copy ( src , dst ) </s>
