ctys-cloning-vms

April, 2010



.

NAME

ctys-cloning-vms - Cloning of VMs


General

This document describes the automated change and configuration mainly provided by ctys-createConfVM(1). ctys-cloneVM(1) is used for the creation of cloned VMs.

Preparations

The first step is the creation of a source VM. Which could be automated by ctys-createConfVM(1). This tool is used for ctys-cloneVM(1) too in order to set new unique values for a cloned VM. Specific attributes such as the activation/deactivation for the inventory scanning by '#*#MAGICID-IGNORE' could be set by ctys-attribute(1) .

Once this step is completed, any VM could be used as a template for the creation of additinal VMs. Therefore the virtual disk and the machine configuration data are seperated, thus the majority of the number of the machine parameters could be altered by either using configuration utilities or by an ordinary ASC-II editor.

Receipts

Supported features

The configuration could be proceeded in two basic variants:

  1. QEMU/KVM, Xen
    The complete duplication and configuration could be proceeded by the utility ctys-createConfVM(1). The GuestOS has to be setup by common procedures in a second step.

  2. VBOX, VMW
    The VM has to be setup by the native OEM tools and could be registered for ctys by post creation of configuration files and collecting these into the registry. The GuestOS has to be setup by common procedures in a second step.

Template Creation

The required template for the automated cloning could be any present VM. Thus an initial VM has to be present for the apllication of ctys-cloneVM(1) . The creation of the initial VM is described in detail within the hypervisor specific subsections.

Create a Template-VM
The following call could be used either for the complete creation of a template VM with the option --create-image or for creation of the inventory data only by usage of the option --create-image.

The following call creates a dummy VM with a small dummy-image in case of Xen.
  
  MAC=00:11:22:33:44:55 \
  IP=12.12.12.12 \
  TCP=gecko \
  HDDBOOTIMAGE_INST_SIZE=128M \
  HDDBOOTIMAGE_INST_BLOCKSIZE=32M \
  HDDBOOTIMAGE_INST_BLOCKCOUNT=4 \
  ctys-createConfVM \
    -t XEN \
    --label=tst02 \
    --auto-all \
    --create-image
  

Adapt a Template-VM
The provided features for the modification of existing VMs vary by actual hypervisors and contained OS. Some attributes may require simpl changes only, e.g. the number of reserved CPUs, whereas others like the change of the size of the storage may require the support of the hypervisor as well as the support of the embedded guest OS and the applied filesystems.

Create defaults file from the Source-VM
The following call of ctys-createConfVM(1) creates the defaults file, which is used for pre-assignment of values from the source machine for the cloned machine. Some basic machine related IDs are required to be altered by command line assignment.
  
  MAC=00:11:22:33:44:55 \
  ctys-createConfVM \
    -t XEN \
    --label=tst02 \
    --defaults-file-create \
    --auto-all \
    --no-create-image \
    --no-save-para-kernel
  

Common Clone Call

Therefore the following call could be executed.

  
  ctys-cloneVM \
    -t xen \
    --label=tst02clone \
    --label-old=tst02 \
    --target-directory=/mntn/vmpool/vmpool05/xen/test/tst-ctys-call \
    --ip=14.14.14.14 \
    --mac=44:44:44:44:44:44 \
    --tcp=abc \
    --uuid=123412341234 \
    --vm-state=DISABLED \
    -f
  

This creates a complete clone, which just requires additional native configuration within the GuestOS.

QEMU/KVM

Create a Test-VM
The following call creates a dummy VM with a small dummy-image.
  
  MAC=00:11:22:33:44:55 \
  IP=12.12.12.12 \
  TCP=gecko \
  HDDBOOTIMAGE_INST_SIZE=128M \
  HDDBOOTIMAGE_INST_BLOCKSIZE=32M \
  HDDBOOTIMAGE_INST_BLOCKCOUNT=4 \
  ctys-createConfVM \
    -t QEMU \
    --label=tst02 \
    --auto-all \
    --create-image
  
Create defaults file from the Source-VM
The following call of ctys-createConfVM(1) creates the defaults file, which is used for pre-assignment of values from the source machine for the cloned machine. Some basic machine related IDs are required to be altered by command line assignment.
  
  MAC=00:11:22:33:44:55 \
  ctys-createConfVM \
    -t QEMU \
    --label=tst02 \
    --defaults-file-create \
    --auto-all \
    --no-create-image \
    --no-save-para-kernel
  
Clone the Source-VM
The following call actually cloned the source VM.
  
  ctys-cloneVM \
    -t QEMU \
    --label=tst02clone \
    --label-old=tst02 \
    --target-directory=/mntn/vmpool/vmpool05/kvm/test/tst-ctys-call \
    --ip=14.14.14.14 \
    --mac=44:44:44:44:44:44 \
    --tcp=abc \
    --uuid=123412341234 \
    --vm-state=DISABLED \
    -f
  

VBOX

Create a Test-VM

The initial creation is for now supported by the native OEM tools only. The following call starts a remote user interface of the graphical VirtualBox frontend.
  
  ctys \
    -t cli \
    -a label=l:VBOX,cmd:VirtualBox \
    myUser@myHost
  
The following call of ctys-createConfVM creates extended configuration information for the ctys inventory.
  
  MAC=00:11:22:33:44:55 \
  IP=12.12.12.12 \
  TCP=gecko \
  HDDBOOTIMAGE_INST_SIZE=128M \
  HDDBOOTIMAGE_INST_BLOCKSIZE=32M \
  HDDBOOTIMAGE_INST_BLOCKCOUNT=4 \
  ctys-createConfVM \
    -t VBOX \
    --label=tst02 \
    --auto-all \
    --no-create-image
  
Create defaults file from the Source-VM
The following call of ctys-createConfVM(1) creates the defaults file, which is used for pre-assignment of values from the source machine for the cloned machine. Some basic machine related IDs are required to be altered by command line assignment.
  
  MAC=00:11:22:33:44:55 \
  ctys-createConfVM \
    -t VBOX \
    --label=tst02 \
    --defaults-file-create \
    --auto-all \
    --no-create-image \
    --no-save-para-kernel
  
Clone the Source-VM
The following call actually cloned the source VM.
  
  ctys-cloneVM \
    -t VBOX \
    --label=tst02clone \
    --label-old=tst02 \
    --target-directory=/mntn/vmpool/vmpool05/vbox/test/tst-ctys-call \
    --ip=14.14.14.14 \
    --mac=44:44:44:44:44:44 \
    --tcp=abc \
    --uuid=123412341234 \
    --vm-state=DISABLED \
    -f
  

VMW

ffs.

XEN

ffs.

Display and modify attributes

The following examples demonstrate how to modify specific attributes within the various supported hypervisor configuration files.

  1. List XEN configuration file:
      ctys-attribute --list tst02clone.conf
    

  2. List CTYS configuration file:
      ctys-attribute --list tst02clone.ctys
    

  3. Replace all values of an attribute in XEN configuration file:
      ctys-attribute \
        --attribute-name='kernelbase' \
        --attribute-replace=ALL  \
        --attribute-value-new="'/nboot1'"  \
        tst02clone.conf
    

  4. Replace a string in all values of an attribute in XEN configuration file:
      ctys-attribute \
        --attribute-name='kernelbase' \
        --attribute-replace=ALL \
        --attribute-value-new="'/nboot1'" \
        --attribute-value-old="'/boot'" \
        tst02clone.conf
    

  5. Replace string in FIRST value of an attribute in XEN configuration file:
      ctys-attribute \
        --attribute-name='kernelbase' \
        --attribute-replace=FIRST \
        --attribute-value-new="'/nboot1'" \
        --attribute-value-old="'/boot'" \
        tst02clone.conf
    

  6. Replace string in LAST value of an attribute in XEN configuration file:
      ctys-attribute \
        --attribute-name='kernelbase' \
        --attribute-replace=FIRST \
        --attribute-value-new="'/nboot1'" \
        --attribute-value-old="'/boot'" \
        tst02clone.conf
    

  7. Replace string in 2. value of an attribute in CTYS configuration file:
      ctys-attribute \
        --attribute-name='kernelbase' \
        --attribute-replace=FIRST \
        --attribute-value-new="'/nboot1'" \
        --attribute-value-old="'/boot'" \
        tst02clone.conf
    

  8. Replace all values of an attribute in CTYS configuration file:
      ctys-attribute \
        --attribute-name='WRAPPERCALL' \
        --attribute-replace=ALL  \
        --attribute-value-new="'123'"  \
        tst02clone.ctys
    

  9. Create a new attribute key without a value assignment in CTYS configuration file:
      ctys-attribute \
        --attribute-create=TOP \
        --attribute-name='#*#MAGICID-IGNORE' \
        --attribute-keyonly \
        tst02clone.ctys
    

  10. Delete an attribute key without a value assignment in CTYS configuration file:
      ctys-attribute \
        --attribute-delete=FIRST \
        --attribute-name='#*#MAGICID-IGNORE' \
        --attribute-keyonly \
        tst02clone.ctys
    

  11. Create new attribute value assignment in CTYS configuration file:
      ctys-attribute \
        --attribute-create=TOP \
        --attribute-name='NEWATTR' \
        --attribute-value-new="'123'"  \
        tst02clone.ctys
    

  12. Create new attribute value assignment in CTYS configuration file:
      ctys-attribute \
        --attribute-create=BOTTOM \
        --attribute-name='NEWATTR' \
        --attribute-value-new="'123'"  \
        tst02clone.ctys
    

  13. Create new attribute value assignment in CTYS configuration file:
      ctys-attribute \
        --attribute-create=15 \
        --attribute-name='NEWATTR' \
        --attribute-value-new="'123'"  \
        tst02clone.ctys
    

  14. Delete first occurance of an attribute in CTYS configuration file:
      ctys-attribute \
        --attribute-delete \
        --attribute-name='NEWATTR' \
        tst02clone.ctys
    
    or
      ctys-attribute \
        --attribute-delete=1 \
        --attribute-name='NEWATTR' \
        tst02clone.ctys
    

  15. Delete ALL occurances of an attribute in CTYS configuration file:
      ctys-attribute \
        --attribute-delete=ALL \
        --attribute-name='NEWATTR' \
        tst02clone.ctys
    




SEE ALSO

UserManual , CommandReference , HowTo

ctys-attribute(1) , ctys-cloneVM(1) , ctys-createConfVM(1) , ctys-convertVM(1)




AUTHOR

Arno-Can Uestuensoez <https://arnocan.wordpress.com/>
<https://unifiedsessionsmanager.sourceforge.io/>
<https://github.com/unifiedsessionsmanager>




COPYRIGHT

Copyright (C) 2008, 2009, 2010, 2011, 2020 Ingenieurbuero Arno-Can Uestuensoez

For BASE package following licenses apply,

This document is part of the DOC package,

For additional information refer to enclosed Releasenotes and License files.