Thursday 6 September 2012

boot.properties restarting WLS without prompts. Booting OVM guests automatically

I know there are write ups everywhere.  I’m responsible for a couple of them too.  I generally write things up when I’m having to actually do some consulting – hence the barrage of emails.

I want my WLS servers to start automatically and I conscious of constantly putting passwords around in /etc/init.d files to get things starting.  Imagine what is going to happen when a password needs to change…  Arrgghh.

So, when looking up this problem on https://support.oracle.com the entry was handy, but not complete.  Here is my attempt:

goto your domains root dir, something like below

/u01/app/oracle/Oracle/Middleware/user_projects/domains/mydomain

cd servers and get a listing

This will tell you the servers that you have installed on this machine:

drwxr-x--- 7 oracle oinstall 4096 Jun  6 16:52 91BSSV
drwxrwxrwx 7 oracle oinstall 4096 May 25 14:11 AdminServer
drwxrwxrwx 3 oracle root     4096 Aug  1 21:27 domain_bak
drwxr-x--- 7 oracle oinstall 4096 Jun 15 09:37 JDE91_BSSV_DV
drwxrwxrwx 8 oracle oinstall 4096 May 25 17:17 JDE91DV
drwxr-x--- 8 oracle oinstall 4096 Aug  1 20:05 JDE91DV_OAM
drwxr-x--- 7 oracle oinstall 4096 Aug  1 18:42 JDE91DVSSO
drwxrwxrwx 3 oracle oinstall 4096 May 25 14:43 myserver

So, you have the opportunity of not entering a password when starting any of these..  you need to go into the SERVERNAME/security dir and create a boot.properties file

When u first create it, you enter the following

username=weblogic

password=your_wls_password

The first time the server starts with this information, it’ll encrypt the entries – so you do not have to mess with them again.  Then – you’ll also be able to do all of your weblogic ini.d’s without entering credentials.  Phew, that is a relief.

But I now have another problem at another level.  I want my VM’s to restart when my OVM host restarts…  How am I going to get this done.

image

See below I’ve kindly offered oracle the intel that they need to get this functionality into the product.  How ‘bout a check box to say “autostart”?  I bet VMWare does it!

So, this is what we need to do:

https://forums.oracle.com/forums/thread.jspa?messageID=2241442

for now, Oracle VM does not do auto restart vm. but you can employ the xen built-in mechanism.

This is on your OVM host machine

[root@MYRSVMH5D ~]# service xendomains status
[root@MYRSVMH5D ~]# ins:                                   [  OK  ]

1) make sure service xendomains is started.
chkconfig xendomains on

[root@MYRSVMH5D ~]# chkconfig --list xendomains
xendomains      0:off   1:off   2:off   3:on    4:on    5:on    6:off

You’d remember this from a previous post – your level definitions.

Code    Information
0    Halt
1    Single-User mode
2    Multi-user mode console logins only (without networking)
3    Multi-User mode, console logins only
4    Not used/User-definable
5    Multi-User mode, with display manager as well as console logins (X11)
6    Reboot

In my example, we are good to go.  xendomains is starting automatically.  So, now all I need is the symlink to the vm.cfg in /etc/xen/auto to get them starting auto!  Nice.

2) make a link in /etc/xen/auto/ to the vm.cfg


Note that this is a bit messy, because of the crazy names in the virtual machine dirs…

in dir /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines

drwx------ 2 root root 3896 Apr 12 10:37 0004fb00000600001a1a2aeeb16bdb13
drwx------ 2 root root 3896 May  2 19:01 0004fb00000600001efbd53119c02772
drwx------ 2 root root 3896 Apr 11 21:20 0004fb000006000033640d175785768c
drwx------ 2 root root 3896 Aug 14 10:20 0004fb00000600003c194abb88f4d98f
drwx------ 2 root root 3896 Apr 12 10:43 0004fb000006000046b4d76fefb4f810
drwx------ 2 root root 3896 May 30 12:49 0004fb000006000052e2fefa48d85144
drwx------ 2 root root 3896 Apr 12 10:39 0004fb0000060000551f25a281e74b7e
drwx------ 2 root root 3896 Apr 12 10:36 0004fb000006000059953908390579ec
drwx------ 2 root root 3896 Apr 12 10:35 0004fb000006000088f6d611554a2d1c
drwx------ 2 root root 3896 Apr 12 10:41 0004fb000006000092018bb8ea1f02ca
drwx------ 2 root root 3896 Aug 14 11:27 0004fb0000060000921cad8357279178
drwx------ 2 root root 3896 Apr 12 10:38 0004fb000006000097f91be6085ea277
drwx------ 2 root root 3896 May 24 19:59 0004fb0000060000b9eb8c9ebed064bd
drwx------ 2 root root 3896 Apr 12 10:36 0004fb0000060000bcf3ee0f0ec3db82
drwx------ 2 root root 3896 May 20 19:48 0004fb0000060000ed81741bfc2fc727
drwx------ 2 root root 3896 Jul  2 11:30 0004fb0000060000f45d2aa20cdf6c44
drwx------ 2 root root 3896 Apr 12 10:38 0004fb0000060000fd1500d07f440918

So, I execute the following to find the simple machine name, telling me what is what…  Then I can calso create the sym links easier

find . -name vm.cfg -exec grep -i -H OVM_Simple_name {} \;

./0004fb000006000088f6d611554a2d1c/vm.cfg:OVM_simple_name = 'E1DEV2'
./0004fb00000600003c194abb88f4d98f/vm.cfg:OVM_simple_name = 'E1BSS'
./0004fb0000060000551f25a281e74b7e/vm.cfg:OVM_simple_name = 'E1DB'
./0004fb000006000092018bb8ea1f02ca/vm.cfg:OVM_simple_name = 'E1ENT'
./0004fb000006000046b4d76fefb4f810/vm.cfg:OVM_simple_name = 'E1WEB'
./0004fb000006000059953908390579ec/vm.cfg:OVM_simple_name = 'E1DEP'
./0004fb0000060000bcf3ee0f0ec3db82/vm.cfg:OVM_simple_name = 'E1DEV'
./0004fb00000600001efbd53119c02772/vm.cfg:OVM_simple_name = 'JDEDEP2'
./0004fb000006000033640d175785768c/vm.cfg:OVM_simple_name = 'MYRSDB05'
./0004fb0000060000fd1500d07f440918/vm.cfg:OVM_simple_name = 'Thingy'
./0004fb00000600001a1a2aeeb16bdb13/vm.cfg:OVM_simple_name = 'cvdvdb'
./0004fb000006000097f91be6085ea277/vm.cfg:OVM_simple_name = 'myrdba'
./0004fb0000060000ed81741bfc2fc727/vm.cfg:OVM_simple_name = 'e1ent2'
./0004fb0000060000b9eb8c9ebed064bd/vm.cfg:OVM_simple_name = 'e1web2'
./0004fb000006000052e2fefa48d85144/vm.cfg:OVM_simple_name = 'e1oid'
./0004fb0000060000f45d2aa20cdf6c44/vm.cfg:OVM_simple_name = 'MYREM12C'
./0004fb0000060000921cad8357279178/vm.cfg:OVM_simple_name = 'e1sec'

ok, how about we get that command to create the symbolic links?  easy too!  Well, maybe no so easy…  Use the following command to generate the sym links and use proper names for them.  Execute the results!

find . -name vm.cfg -exec grep -i -H OVM_Simple_name {} \; |awk -F: '{printf("ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/%s %s\n",$1,$2)}' | awk '{printf("%s %s %s /etc/xen/auto/%s\n", $1, $2, $3, $6)}' | sed "s/'//g"

[root@MYRSVMH5D VirtualMachines]# find . -name vm.cfg -exec grep -i -H OVM_Simple_name {} \; |awk -F: '{printf("ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/%s %s\n",$1,$2)}' | awk '{printf("%s %s %s /etc/xen/auto/%s\n", $1, $2, $3, $6)}' | sed "s/'//g"
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb000006000088f6d611554a2d1c/vm.cfg /etc/xen/auto/E1DEV2
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb00000600003c194abb88f4d98f/vm.cfg /etc/xen/auto/E1BSS
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb0000060000551f25a281e74b7e/vm.cfg /etc/xen/auto/E1DB
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb000006000092018bb8ea1f02ca/vm.cfg /etc/xen/auto/E1ENT
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb000006000046b4d76fefb4f810/vm.cfg /etc/xen/auto/E1WEB
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb000006000059953908390579ec/vm.cfg /etc/xen/auto/E1DEP
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb0000060000bcf3ee0f0ec3db82/vm.cfg /etc/xen/auto/E1DEV
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb00000600001efbd53119c02772/vm.cfg /etc/xen/auto/JDEDEP2
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb000006000033640d175785768c/vm.cfg /etc/xen/auto/MYRSDB05
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb0000060000fd1500d07f440918/vm.cfg /etc/xen/auto/Thingy
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb00000600001a1a2aeeb16bdb13/vm.cfg /etc/xen/auto/cvdvdb
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb000006000097f91be6085ea277/vm.cfg /etc/xen/auto/myrdba
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb0000060000ed81741bfc2fc727/vm.cfg /etc/xen/auto/e1ent2
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb0000060000b9eb8c9ebed064bd/vm.cfg /etc/xen/auto/e1web2
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb000006000052e2fefa48d85144/vm.cfg /etc/xen/auto/e1oid
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb0000060000f45d2aa20cdf6c44/vm.cfg /etc/xen/auto/MYREM12C
ln -s /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb0000060000921cad8357279178/vm.cfg /etc/xen/auto/e1sec

As you see we are done.  I then delete the machines that I do not care to autostart

[root@MYRSVMH5D VirtualMachines]# ls -l  /etc/xen/auto
total 68
lrwxrwxrwx 1 root root 108 Sep  6 10:39 cvdvdb -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb00000600001a1a2aeeb16bdb13/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 E1BSS -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb00000600003c194abb88f4d98f/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 E1DB -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb0000060000551f25a281e74b7e/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 E1DEP -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb000006000059953908390579ec/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 E1DEV -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb0000060000bcf3ee0f0ec3db82/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 E1DEV2 -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb000006000088f6d611554a2d1c/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 E1ENT -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb000006000092018bb8ea1f02ca/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 e1ent2 -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb0000060000ed81741bfc2fc727/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 e1oid -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb000006000052e2fefa48d85144/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 e1sec -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb0000060000921cad8357279178/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 E1WEB -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb000006000046b4d76fefb4f810/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 e1web2 -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb0000060000b9eb8c9ebed064bd/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 JDEDEP2 -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb00000600001efbd53119c02772/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 myrdba -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb000006000097f91be6085ea277/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 MYREM12C -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb0000060000f45d2aa20cdf6c44/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 MYRSDB05 -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb000006000033640d175785768c/vm.cfg
lrwxrwxrwx 1 root root 108 Sep  6 10:39 Thingy -> /OVS/Repositories/0004fb00000300005dbf9d7f41f5d4c1/VirtualMachines/./0004fb0000060000fd1500d07f440918/vm.cfg

No comments: