Monday, January 26, 2015

ODA X4-2 -- Cloning in Virtualized Platform , oakcli -- Oracle VM Server

I have checked a lot of documents and could not see a document that specifies the exact method for cloning an existing VM guest to a new VM guest. The need has arised in an EBS 12.2 project in which we are using Virtualized Oracle Database Appliance X4-2 for hosting our EBS nodes.
After checking the docs; I have conclude that, we can follow the method for restoring backups of VM guest for our cloning purposes..
Note that: Using VM manager is not supported on ODA. Also we dont have snapshot option for oakcli in ODA X4-2..

Here is the action plan:

cd to the shared_repo_path/VirtualMachines/yourexistingvm
tar -cvzf shared_repo_path/VirtualMachines/yourexistingvm.tgz ./*
oakcli import vmtemplate thenewone -files shared_repo/VirtualMachines/yourexistingvm.tgz -repo yoursharedreponame
oakcli clone vm thenewmachine -vmtemplate thenewone -repo yoursharedreponame

Note that: As this will be a clone of our existing vm machine; the ip address and hostname of it will be the same as the existing machine. That's why , we need to shutdown the existing machine, then open up this clone and change the hostnames accordingly.. (this has to be done in order to prevent an ip and hostname conflict)
That is ;
shutdown the existing vm.
open the new clone vm
change the hostname and ip address of new clone vm
reboot the new clone vm
start the existing vm

That 's it.. You will have a cloned Oracle VM if you follow this procedure..

On the other hand; what I did was a little different than this.
I just created a vm machine from an already imported VM template and then copied the image disk of the existing VM machine into the VM directory of this newly created Virtual machine, edited the vm.cfg accordingly and done.! ...

Note that : while performing tar or copy operations , the source /existing vm must be shutdown..

Hope you ll find it useful..

16 comments :

  1. Erman, After creating an end-user VM from a template, how do you add extra disk space to the VM? E.g. how to present a LUN to the VM (running Linux guest OS)? This is so that fdisk can find and format it, then mount as an ext3 file system as per standard Linux procedure?

    Also is there a way to set this in the template so that I don't have to repeat creating the same filesystem in each of 20 VM's I'm going to create from the same template? oakcli configure template has memory and cpu options etc but nothing for disk.

    Thanks,

    ReplyDelete
  2. 1)This command creates a virtual disk named sdisk1 in the repo2 shared repository with a size of 1 gigabyte and the ability to be shared by virtual machines:

    oakcli create vdisk sdisk1 -repo repo2 -size 1G -type shared

    -->Attach a Virtual Disk to a Virtual Machine
    This command attaches the virtual disk named sdisk1, as created in Example 11, to the virtual machine named myol6u_test in the repo2 shared repository, as created in Example 8:

    oakcli modify vm myo16u_test -attachvdisk sdisk1


    2)
    Once you add the disk to your vm, you can create a template from that vm, and you can create vm machines using your newly created template.
    Following document will help you on creating template from a vm guest.
    ODAVP: How to create a VM template from a Guest VM (Doc ID 1668933.1)

    If you have more questions; please ask them from my forum. I only give tech support from my forum normally..
    Open a new thread for every single question.
    http://ermanarslan.blogspot.com.tr/p/forum.html

    ReplyDelete
  3. a new update in this context:
    If your Appliance version is not r12, then you will need to add the vdisk manually, as you will no option like oakcli create vdisk and also you will no option like using Oracle VM Manager..
    You need to follow this document to add a vdisk :
    OVM 2.x: How to Create Virtual Disk without Oracle VM Manager (Doc ID 1951279.1)

    ReplyDelete
  4. On r12, oda x5-2 , I created two vdisk to be attached to vm, I can see them when I issue,
    Oakcli show vm myvm , but I do not see them inside the linux command line when I issue, df -h .

    any ideas ?

    ReplyDelete
  5. please copy & paste the oakcli show vm myvm command output here.

    ReplyDelete
  6. It is normal bytheway. A newly created disk wont be mounted so it wont be seen in df output.
    You may create a partition on it , put a filesystem on it or make it an LVM and then mount it to a directory.
    Once it is mounted, you will be able to see it in df command output.

    Example:
    so you will have to use fdisk -l to find the disk name .
    then again using fdisk you may create a partition (you may or may not)
    and then you can continue with mkfs.ext3 command to format it. (this filesystem may change according to your needs)
    Once all the above is done, you may create a directory and mount your partition to that directory.
    Only after that , it will be seen in df output.

    ReplyDelete
  7. Hi Erman
    this really great job, thanks for your doc about ODA with EBS.
    I need your help :
    1- did you try it with RAC ?
    2- how to achive HA for apps tier ? if its down from node 0 it will came up from node 1.
    3- cloning : how to clone the DB, its migrated with ODA_BASE (2 VM db), so we can create a new ODA_BASE? for cloning from PROD to TEST.

    ReplyDelete
  8. Hi ahmed,
    1- No - i didnt try it with RAC.
    2- The configuration you want is a active passive cluster. HA Cluster software can do that. For example : IBM HACMP. The key for using such a configuration is using one service name rather than the hostnames. These two app servers should see the same disks through a shared disk device, so if one of the servers is down, the other one could reach its sources, its name(service_name). The thing that will drive this is the clustering software.. Check the clustering softwares available for your OS.. But such a configuration will not be supported by Oracle probably. I suggest you to deploy an active-active cluster and put a load balancer in front of your application servers.
    3 - You can create additional vms in the ODA_BASE, in parallel to the servers running in ODA_BASE. But I dont think you can clone ODA_BASE. I dont think it is supported.

    ReplyDelete
  9. Hi Erman,

    Need your advice for can not see/create repo with error OAKERR 6004. Please advice

    ReplyDelete
  10. Hi,

    Please open an issue in my forum and send me all the versions ODA machine, software along with a screenshot of the failing command and the related log files.
    http://ermanarslan.blogspot.com.tr/p/forum.html

    ReplyDelete
  11. Hi Erman,

    When you say "... copied the image disk of the existing VM machine into the VM directory of this newly created Virtual machine" - did you do it by 'dd' or other method? Can you share?


    Thanks,

    Jonathan

    ReplyDelete
  12. Hi Crossing, I really copied it. :) I did not used dd or other method there. It is just a copy of a file.

    ReplyDelete
    Replies
    1. You wrote “I just created a vm machine from an already imported VM template and then copied the image disk of the existing VM machine into the VM directory of this newly created Virtual machine, edited the vm.cfg accordingly and done.!”

      - I suppose you didn’t have any ‘same UUID conflict' issues?

      - I guess I can use rsync to copy over a 100GB “u01.img” and modify the vm.cfg to get the same result?

      - Or shall I include this u01.img image file in the vmtemplate? Let's say the existing VM's hostname is vm1. From dom0:

      ls -l /OVS/Repositories/devrepo/.ACFS/snaps/vm1/VirtualMachines/vm1/ shows the System.img and u01.img files:

      System.img
      u01.img -> 100 GB
      vm.cfg

      Shall I incldue the u01.img file in the template or copy it separately like you did?

      Delete
  13. Please enumerate your questions next time...

    I suppose you didn’t have any ‘same UUID conflict' issues?
    *No UUID conflict issues. These are just files.

    I guess I can use rsync to copy over a 100GB “u01.img” and modify the vm.cfg to get the same result?
    *Yes, anything that copies a file , works here.

    Or shall I include this u01.img image file in the vmtemplate? Let's say the existing VM's hostname is vm1. From dom0:
    *You can.

    Shall I include the u01.img file in the template or copy it separately like you did?
    *You choose, both would work.

    ReplyDelete
  14. Thanks You , this post is very helpful

    ReplyDelete