Sun Microsystems, Inc.  Oracle System Handbook - ISO 7.0 May 2018 Internal/Partner Edition
   Home | Current Systems | Former STK Products | EOL Systems | Components | General Info | Search | Feedback

Asset ID: 1-71-1668933.1
Update Date:2017-10-27
Keywords:

Solution Type  Technical Instruction Sure

Solution  1668933.1 :   ODAVP: How to create a VM template from a Guest VM  


Related Items
  • Oracle Database Appliance Software
  •  
  • Oracle Database Appliance
  •  
Related Categories
  • PLA-Support>Eng Systems>Exadata/ODA/SSC>Oracle Database Appliance>DB: ODA_EST
  •  




In this Document
Goal
Solution
 How to create a VM template from a Guest VM
 VM Guest running from local storage repository
 1. Stop the VM running on local repository
 2. Check in which local repository your vm is running
 3. Package the current VM as a template.tgz file
 4. Import it as a vmtemplate 
 4. Remove the source vm template
 VM Guest running from shared storage repository
 1. Stop the VM running on shared repository
 2. Check in which local repository your vm is running
 3. Package the current VM as a template.tgz file
 4. Import it as a vmtemplate in a shared repo
 5. Remove the source vm template
References


Applies to:

Oracle Database Appliance Software - Version 2.5.0.0 and later
Oracle Database Appliance - Version All Versions and later
Information in this document applies to any platform.

Goal

The purpose of this article is to illustrate how to create a VM template from a Guest VM running on Oracle Database Appliance Virtualized Platform. 

Solution

How to create a VM template from a Guest VM

 

VM Guest running from local storage repository

1. Stop the VM running on local repository

In order to keep consistency on the VM files you must stop the Virtual Machine. From ODA_BASE domain issue the following command:

oakcli stop vm <vm_name> [-force]

example:
# oakcli stop vm ol6u4a4
2. Check in which local repository your vm is running

From ODA_BASE issuing the following comand:

oakcli show vm <vm_name>

example:
# oakcli show vm ol6u4a4
Resource: ol6u4a4
    AutoStart       :    restore        
    CPUPriority     :    100            
    Disks           :    |file:/OVS/Repositories/odarepo1/Vi
                         rtualMachines/ol6u4a4/492b094155e84
                         a5887b16813e09e4362.img,xvda,w|
    Domain          :    XEN_PVM        
    ExpectedState   :    offline        
    FailOver        :    false          
    IsSharedRepo    :    false          
    Keyboard        :    en-us          
    MaxMemory       :    2048           
    MaxVcpu         :    2              
    Memory          :    2048           
    Mouse           :    OS_DEFAULT     
    Name            :    ol6u4a4        
    Networks        :
    NodeNum         :    0              
    NodeNumStart    :    0              
    OS              :    OL_5           
    PrefNodeNum     :    0              
    PrivateIP       :    None           
    ProcessorCap    :    100            
    RepoName        :    odarepo1       
    State           :    Offline        
    SysExpectedStat :    Offline        
    TemplateName    :    otml_ol6u4a4   
    Vcpu            :    2              
    cpupool         :    default-unpinned-pool
    vncport         :    0

3. Package the current VM as a template.tgz file

From the dom-0 related to the local repository where your VM is running, you need to package the VM as tgz file issuing the following command (note as the package file is created on the same Guest VM folder):

tar cvfzS /OVS/Repositories/<local_repo_name>/VirtualMachines/<vm_name>/<vm_name>.tgz -C /OVS/Repositories/<local repo name>/VirtualMachines/<vm_name> .           

example:
# tar cvfzS /OVS/Repositories/odarepo1/VirtualMachines/ol6u4a4/ol6u4a4.tgz -C /OVS/Repositories/odarepo1/VirtualMachines/ol6u4a4 .      
4. Import it as a vmtemplate 

Having the VM package you can now import on the local repository, from ODA_BASE:

oakcli import vmtemplate <vmtemplatename> -files /OVS/Repositories/sharedrepo/<local_repo_name>/VirtualMachines/<vm_name>/<vm_template_name>.tgz -repo <repo_name>

example:
# oakcli import vmtemplate ol6u4a4_shared -files /OVS/Repositories/odarepo1/VirtualMachines/ol6u4a4/ol6u4a4.tgz -repo odarepo1
4. Remove the source vm template

Having the VM template imported, you can now remove the source file, from dom0:

rm /OVS/Repositories/sharedrepo/<local_repo_name>/VirtualMachines/<vm_name>/<image files>

example:
# rm /OVS/Repositories/odarepo1/VirtualMachines/ol6u4a4/ol6u4a4.tgz

 

VM Guest running from shared storage repository

1. Stop the VM running on shared repository

In order to keep consistency on the VM files you must stop the Virtual Machine. From ODA_BASE domain issue the following command:

oakcli stop vm <vm_name> [-force]

example:
# oakcli stop vm ol6u4a4
2. Check in which local repository your vm is running

From ODA_BASE issuing the following comand:

oakcli show vm <vm_name>

example:
# oakcli show vm ol6u4a4
Resource: ol6u4a4
    AutoStart       :    restore        
    CPUPriority     :    100            
    Disks           :    |file:/OVS/Repositories/srepo1/Vi
                         rtualMachines/ol6u4a4/492b094155e84
                         a5887b16813e09e4362.img,xvda,w|
    Domain          :    XEN_PVM        
    ExpectedState   :    offline        
    FailOver        :    false          
    IsSharedRepo    :    false          
    Keyboard        :    en-us          
    MaxMemory       :    2048           
    MaxVcpu         :    2              
    Memory          :    2048           
    Mouse           :    OS_DEFAULT     
    Name            :    ol6u4a4        
    Networks        :
    NodeNum         :    0              
    NodeNumStart    :    0              
    OS              :    OL_5           
    PrefNodeNum     :    0              
    PrivateIP       :    None           
    ProcessorCap    :    100            
    RepoName        :    srepo1     
    State           :    Offline        
    SysExpectedStat :    Offline        
    TemplateName    :    otml_ol6u4a4   
    Vcpu            :    2              
    cpupool         :    default-unpinned-pool
    vncport         :    0

3. Package the current VM as a template.tgz file

From ODA_BASE, you need to package the VM as tgz file issuing the following command (note as the package file is created on the same Guest VM folder):

tar cvfzS /u01/app/sharedrepo/<shared_repo_name>/<vm_name>.tgz -C /u01/app/sharedrepo/<shared_repo_name>/.ACFS/snaps/<vm_name>/VirtualMachines/<vm_name> .           

example:
# tar cvfzS /u01/app/sharedrepo/srepo1/ol6u4a4.tgz -C /u01/app/sharedrepo/srepo1/.ACFS/snaps/ol6u4a4/VirtualMachines/ol6u4a4 .      
Note: in case your Guest VM is using VDisks, you need take care for them as well and include into the tgz file create above.

Example: Let's suppose you guest VM is using a VDisk such : "oakvdk_disk01_srepo1".
That file will be under:

/u01/app/sharedrepo/<shared_repo_name>/.ACFS/snaps/oakvdk_<vdisk_name>/VirtualDisks/<vdisk_name>

in example:
/u01/app/sharedrepo/srepo1/.ACFS/snaps/oakvdk_disk01/VirtualDisks/oakvdk_disk01

then the archive creation command will be:

tar cvfzS /u01/app/sharedrepo/<shared_repo_name>/<vm_name>.tgz -C /u01/app/sharedrepo/<shared_repo_name>/.ACFS/snaps/VirtualMachines/<vm_name> . -C /u01/app/sharedrepo/<shared_repo_name>/.ACFS/snaps/oakvdk_<vdisk_name>/VirtualDisks .

example:
# tar cvfzS /u01/app/sharedrepo/<shared_repo_name>/ol6u4a4.tgz -C /u01/app/sharedrepo/srepo1/.ACFS/snaps/OL6U6/VirtualMachines/ol6u4a4 . -C /u01/app/sharedrepo/srepo1/.ACFS/snaps/oakvdk_disk01/VirtualDisks .

4. Import it as a vmtemplate in a shared repo

Having the VM package you can now import on the shared repository, from ODA_BASE:

oakcli import vmtemplate <vmtemplatename> -files /OVS/Repositories/sharedrepo/<shared_repo_name>/VirtualMachines/<vm_name>/<vm_template_name>.tgz -repo <repo_name> -node <0|1>

example:
# oakcli import vmtemplate ol6u4a4_newt -files /OVS/Repositories/sharedrepo/srepo1/ol6u4a4.tgz -repo srepo1 -node 0
Note: if your Guest VM was using VDisks, "oakcli show vm <vmname> will show them under "Disk" and not anymore under "VDisk"
5. Remove the source vm template

Having the VM template imported, you can now remove the source file, from ODA_BASE:

rm /u01/app/sharedrepo/<shared_repo_name>/<vm_name>.tgz

example:
# rm /u01/app/sharedrepo/<shared_repo_name>/ol6u4a4.tgz

 

References

<NOTE:1524138.1> - ODAVP: How To Create a Fully-Virtualized Guests (HVM) from an OS ISO image
<NOTE:1633166.1> - ODAVP: HowTo backup/restore your VM Guest
<NOTE:1601860.1> - ODAVP: How to move a VM from local to a shared repository

Attachments
This solution has no attachment
  Copyright © 2018 Oracle, Inc.  All rights reserved.
 Feedback