KVM virt-template-clone
Clone VM machine based on templates
Download:
Download package_virt-template-clone.tar.gz.
Install:
Download and untar: tar -xzf package_virt-template-clone.tar.gz
Untar it and each tar untar to specific directory:
- usr-local-etc-virt-template-clone.tar.gz to /usr/local/etc
- var-local-virt-template-clone.tar.gz to /var/local
- usr-local-sbin-virt-template-clone.dir.tar.gz to /usr/local/sbin
mkdir -p /usr/local/etc/ && \ tar -xzf usr-local-etc-virt-template-clone.tar.gz -C /usr/local/etc/ && \ mkdir -p /var/local/ && \ tar -xzf var-local-virt-template-clone.tar.gz -C /var/local/ && \ mkdir -p /usr/local/sbin/ && \ tar -xzf usr-local-sbin-virt-template-clone.dir.tar.gz -C /usr/local/sbin/ && \ ln -s /usr/local/sbin/virt-template-clone.dir/virt-template-clone /usr/local/sbin/virt-template-cloneOptional (if you want to use it seperately):
ln -s /usr/local/sbin/virt-template-clone.dir/lib/virt-post-install/lib/terminal-colors/terminal-colors.bash /usr/local/sbin/virt-template-clone/terminal-colors.bash ln -s /usr/local/sbin/virt-template-clone.dir/lib/virt-post-install/lib/xmllib/xmlfile.bash /usr/local/sbin/virt-template-clone/xmlfile.bash ln -s /usr/local/sbin/virt-template-clone.dir/lib/virt-post-install/virt-post-install /usr/local/sbin/virt-template-clone/virt-post-install
Configure:
/usr/local/etc/virt-template-clone/virt-post-install/default.module.conf
VPI_MODULES
= array of used modules (change if you want)/usr/local/etc/virt-template-clone/virt-post-install/default.ban_vgs.conf
VPI_BAN_VGS
= vg names array prohibited to use by script (fill your VGs), filling it is not necessary but it is recommended./usr/local/etc/virt-template-clone/templates/
File '*.template' is accepted. Create new or modify test1.template.VTI_TEMPLATE_FROM
- Domain name or ending by '.xml' domain xml file.VTI_TEMPLATE_FROM_DIST
- Ditribution name (centos, debian) see/usr/local/sbin/virt-template-clone.dir/lib/virt-post-install/virt-post-install -h
VTI_TEMPLATE_PREPARE_LV
- Create LV volume if needed (if VTI_TEMPLATE_FROM is LVM based) - yes/no.VTI_TEMPLATE_PREPARE_VG_NAME
- VG name for thne new LV(s)VTI_TEMPLATE_PREPARE_LV_PLUS_SIZE
- Created LV size = VTI_TEMPLATE_FROM LV size + VTI_TEMPLATE_PREPARE_LV_PLUS_SIZE (in bytes).VTI_TEMPLATE_DISK
- File name template for the new image file. The #name# is replaced by new VM name (if more images exists a number is appended).VTI_TEMPLATE_VPI_module_conf
- Module.conf for virt-post-installVTI_TEMPLATE_MAC
- virt-clone-random (the first character is 'v') - virt-clone random (empty)
- A MAC template (detected by ':' as the 3rd character) - will be prompted to fill
- A MAC counter file, the file format: 6 numbers 0-255 one per line.
Optional:
/usr/local/etc/terminal-colors.templates
Define a new templates for module ps1set.(Default template can be set in module.conf by VPI_PS1SET_DEFAULT_TEMPLATE
)
You can see video.