KVM - Creating and managing VM's with ODACLI - English

        Before, the use of KVM in ODA Bare metal was not simplified, it was necessary to make some adjustments and even network reboot was involved in the old process, but I tell you that this is over. Since version 19.8, Oracle has added several resources for managing virtual machines, from creating machines to managing the network (vnetworks), all through ODACLI.

        In this post we will execute the following commands:

        1 - odacli create-vmstorage
        2 - odacli create-vcpupool 
        3 - odacli create-vnetwork
        4 - odacli create-vdisk
        5 - odacli create-vm

        All of these procedures were performed on an ODA X8M (Patch 19.9), so it does not apply directly to the ODA X8 HA, before performing this procedure on an ODA HA, I ask you to consult the official documentation.

        First we will prepare the storage area, we must create a place where the boot disks and vdisk of virtual machines will be stored:

[root@odax8accerte ~]# odacli create-vmstorage -dg DATA -n VMSTORAGE1 -s 500G

df -h 

/dev/asm/vmstorage1-78              500G  2G  497G  70% /u05/app/sharedrepo/vmstorage1

        There, vmstorage created, let's go to the POOL CPU.

        We can create the POOL CPU in 2 ways, whether they are of the vm or bare metal type, as the name says, we will create the vm type, the bare metal type is exclusive for database, but this is the subject for another post. Follow the documentation.

        Attach the BM CPU pool to databases. Bare metal CPU pools can be assigned to multiple databases.
        Attach VM CPU pool VM guest machines. VM CPU pools can be assigned to multiple VMs.

        Now we are going to create a cpu pool, remembering that it is created in “cores”, below we will create with 8 cores, being able to use up to 16 VCPU’s.

[root@odax8accerte ~]# odacli create-cpupool -c 8 -n POOL8CORES -vm

        Completed cpu pool, now we to go for the network part. In the old way of configuring the KVM it was possible to use the btbond1 card as a brigde now it is no longer allowed, just as a vlan:

[root@odax8accerte ~]# odacli create-vnetwork --name VNET1 --bridge VNET1 --type bridged --interface btbond1 --ip 10.1.1.130  --gateway 10.1.1.1 --netmask 255.255.255.0
DCS-10045:Validation error encountered: Cannot create a bridged vNetwork using the public interface btbond1.

        However, you can use the second btbond2 card to create a bridge, which by the way, will be the one we will use in our tests. A very important detail ... Do not use the same subnet as btbond1 to create this vnetwork, on the virtual machine you can use any available subnet, but to create the vnetwork choose a different subnet than btbond1. Another detail, any configuration you have on BTBOND2 will be ELIMINATED when creating the vnetwork.

[root@odax8accerte ~]# odacli create-vnetwork --name VNET1 --bridge VNET1 --type bridged --interface btbond2 --ip 10.1.1.130  --gateway 10.1.1.1 --netmask 255.255.255.0

        We are almost there, now we just need to create a vdisk that is optional, remember again that it is not the boot disk, it is a secondary disk of 300GB that we will attach to our machine.

[root@odax8accerte ~]# odacli list-vmstorages
Name                  Disk group       Volume name      Volume device                   Size        Mount Point                          Created                  Updated                
--------------------  ---------------  ---------------  ------------------------------  ----------  -----------------------------------  -----------------------  -----------------------
VMSTORAGE1            DATA             VMSTORAGE1       /dev/asm/vmstorage1-78          500.00 GB   /u05/app/sharedrepo/vmstorage1       2021-02-02 01:00:59 BRT  2021-02-02 01:00:59 BRT

[root@odax8accerte ~]# odacli create-vdisk -n VDISK1 -sh -s 300G -vms VMSTORAGE1

Job details                                                      
----------------------------------------------------------------
                     ID:  1b6a8361-3a80-4c66-ad7a-fe93f4f7c247
            Description:  VM disk VDISK1 creation
                 Status:  Created
                Created:  February 2, 2021 4:54:34 AM BRT
                Message:  

Task Name                                Start Time                          End Time                            Status    
---------------------------------------- ----------------------------------- ----------------------------------- ----------

        Now let's review everything before creating the virtual machine.

VMSTORAGE:

[root@odax8accerte ~]# odacli list-vmstorages
Name                  Disk group       Volume name      Volume device                   Size        Mount Point                          Created                  Updated                
--------------------  ---------------  ---------------  ------------------------------  ----------  -----------------------------------  -----------------------  -----------------------
VMSTORAGE1            DATA             VMSTORAGE1       /dev/asm/vmstorage1-78          500.00 GB   /u05/app/sharedrepo/vmstorage1       2021-02-02 01:00:59 BRT  2021-02-02 01:00:59 BRT

CPU POOL:

[root@odax8accerte ~]# odacli list-cpupools
Name                  Type   Configured on              Cores  Associated resources            Created                  Updated                
--------------------  -----  -------------------------  -----  ------------------------------  -----------------------  -----------------------
POOL8CORES            VM     odax8accerte               8      NONE                            2021-02-02 04:14:35 BRT  2021-02-02 04:14:35 BRT

VNETWORKS:

[root@odax8accerte ~]# odacli list-vnetworks
Name                  Type             Interface        Bridge                Uniform   Created                  Updated                
--------------------  ---------------  ---------------  --------------------  --------  -----------------------  -----------------------
VNET1                 Bridged          btbond2          VNET1                 NO        2021-02-02 04:40:02 BRT  2021-02-02 04:40:02 BRT

VDISK:

[root@odax8accerte ~]# odacli list-vdisks
Name                  VM storage            Size        Shared      Sparse      Created                  Updated                
--------------------  --------------------  ----------  ----------  ----------  -----------------------  -----------------------
VDISK1                VMSTORAGE1            300.00 GB   YES         NO          2021-02-02 05:02:26 BRT  2021-02-02 05:02:26 BRT

        Okay, now let's go to the creation of the virtual machine.

[root@odax8accerte ~]# odacli create-vm -n VMTESTE1 -cp POOL8CORES -vc 8 -m 32G -vms VMSTORAGE1 -s 50G -vd VDISK1 -vn VNET1 -src /u01/V1003434-01.iso

Explicando o Comando:

-n VMTESTE1 ---> VM name.

-cp POOL8CORES ---> 8-core CPU pool that we created earlier.

-vc 8 ---> quantity of VCPU's

-m 32G ---> VM memory.

-vms VMSTORAGE1 --> Storage area that we created previously with 500GB, remember?

-s 50G ---> boot disk size.

-vd VDISK1 ---> 300GB disk that we created earlier ... this is not the boot disk.

-vn VNET1 ---> vnetwork that virtual machines will use.

-src /u01/V1003434-01.iso ---> BOOT ISO.


Job details                                                      
----------------------------------------------------------------
                     ID:  d4c1efa1-8d15-48a7-92b3-0cd620c78968
            Description:  VM VMTESTE1 creation
                 Status:  Created
                Created:  February 2, 2021 10:56:02 PM BRT
                Message:  

Task Name                                Start Time                          End Time                            Status    
---------------------------------------- ----------------------------------- ----------------------------------- ----------


[root@odax8accerte ~]# odacli describe-job -i d4c1efa1-8d15-48a7-92b3-0cd620c78968

Job details                                                      
----------------------------------------------------------------
                     ID:  d4c1efa1-8d15-48a7-92b3-0cd620c78968
            Description:  VM VMTESTE1 creation
                 Status:  Success
                Created:  February 2, 2021 10:56:02 PM BRT
                Message:  

Task Name                                Start Time                          End Time                            Status    
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Validate dependency resources            February 2, 2021 10:56:02 PM BRT    February 2, 2021 10:56:02 PM BRT    Success   
Validate resource allocations            February 2, 2021 10:56:02 PM BRT    February 2, 2021 10:56:02 PM BRT    Success   
Allocate resources                       February 2, 2021 10:56:02 PM BRT    February 2, 2021 10:56:02 PM BRT    Success   
Provision new VM                         February 2, 2021 10:56:02 PM BRT    February 2, 2021 10:56:06 PM BRT    Success   
Add VM to Clusterware                    February 2, 2021 10:56:06 PM BRT    February 2, 2021 10:56:08 PM BRT    Success   
Save configuration in ACFS               February 2, 2021 10:56:08 PM BRT    February 2, 2021 10:56:08 PM BRT    Success   
Save live VM configuration in ACFS       February 2, 2021 10:56:08 PM BRT    February 2, 2021 10:56:08 PM BRT    Success   
Create VM metadata                       February 2, 2021 10:56:08 PM BRT    February 2, 2021 10:56:08 PM BRT    Success   
Persist metadata                         February 2, 2021 10:56:08 PM BRT    February 2, 2021 10:56:08 PM BRT    Success   

[root@odax8accerte ~]# odacli describe-vm -n VMTESTE1
VM details                                                                      
--------------------------------------------------------------------------------
                       ID:  6d6a6ed1-ef70-474e-9a92-d0d129e78a96
                     Name:  VMTESTE1
                  Created:  2021-02-02 22:56:08 BRT
                  Updated:  2021-02-02 22:56:08 BRT
               VM Storage:  VMSTORAGE1
              Description:  NONE
                  VM size:  50.00 GB
                   Source:  V1003434-01.iso
                  OS Type:  NONE
               OS Variant:  NONE
        Graphics settings:  vnc,listen=0.0.0.0
             Display Port:  :0

 Status                   
--------------------------
             Current node:  odax8accerte
            Current state:  ONLINE
             Target state:  ONLINE

 Parameters               
--------------------------
           Preferred node:  NONE
              Boot option:  NONE
               Auto start:  YES
                Fail over:  NO

                            Config                     Live                     
                            -------------------------  -------------------------
                   Memory:  32.00 GB                   32.00 GB                 
               Max Memory:  32.00 GB                   32.00 GB                 
               vCPU count:  8                          8                        
           Max vCPU count:  8                          8                        
                 CPU Pool:  POOL8CORES                 POOL8CORES               
        Effective CPU set:  0-7,32-39                  0-7,32-39                
                    vCPUs:  0:0-7,32-39                0:0-7,32-39              
                            1:0-7,32-39                1:0-7,32-39              
                            2:0-7,32-39                2:0-7,32-39              
                            3:0-7,32-39                3:0-7,32-39              
                            4:0-7,32-39                4:0-7,32-39              
                            5:0-7,32-39                5:0-7,32-39              
                            6:0-7,32-39                6:0-7,32-39              
                            7:0-7,32-39                7:0-7,32-39              
                   vDisks:  VDISK1:vdb                 VDISK1:vdb               
                vNetworks:  VNET1:52:54:00:ce:25:22    VNET1:52:54:00:ce:25:22  

        VM successfully created, let's go to access.

        When executing the "describe" of the machine, some properties will be listed, among them the "display port". The access to the VM is done via VNC, you can use any ip to connect to the interface of either btbond1 or btbond2, in our case the port is at 0 then with the ip of any of the interfaces we will be able to access the VM.

enter image description here

enter image description here

enter image description here

enter image description here

Ok guys, from now on it's up to you lol.

Diogo Fernandes

Linkedin

Postagens mais visitadas deste blog

Migrando VM'S do ODA/OVM para ODA/KVM.

Ksplice no Exadata