X
  • KVM
    July 6, 2017

KVM Guest VM storage devices on ODA

Ruggero Citton
Product Development Architect

Article Table of Contents

Storage Pool -- The Overview

A storage pool is a file, directory, or storage device managed by libvirt  for the purpose of providing storage to guest virtual machines. Although the storage pool is a virtual container it is limited by two factors: maximum size allowed by qemu-kvm and the size of the disk on the host physical machine.

libvirt uses a directory-based storage pool, the /var/lib/libvirt/images/ directory, as the default storage pool. This default storage pool can be changed.  In the case of ODA, the following is recommended.

For example, here are 4 different storage pools (aka Guest VM repositories) using the virsh pool-list command.

# virsh pool-list
Name                 State      Autostart
-----------------------------------------
kvm_repo1            active     yes      
kvm_repo2            active     yes      
kvm_repo3            active     yes      
kvm_repo4            active     yes    

We can obtain storage pool information details by using the virsh pool-info <storage-pool> command.

# virsh pool-info kvm_repo1
Name:           kvm_repo1
UUID:           d2e44017-7137-efa2-1da9-db63cdd754fa
State:          running
Persistent:     yes
Autostart:      yes
Capacity:       200.00 GiB
Allocation:     5.08 GiB
Available:      194.92 GiB

Volumes

Storage pools are divided into storage volumes. Storage volumes are an abstraction of physical partitions, LVM logical volumes, file-based disk images and other storage types handled by libvirt. Storage volumes are presented to guest virtual machines as local storage devices regardless of the underlying hardware.

For example, here are the details of the storage pool "kvm_repo1" content. In this case 3 storage volumes are belong the same guest virtual machine (OL-6U8) as local storage devices

# virsh vol-list --pool kvm_repo1
Name                            Path                                   
------------------------------- ---------    
OL-6U8.qcow2           /kvm_repos/kvm_repo1/OL-6U8.qcow2
OL-6U8_storage0.qcow2  /kvm_repos/kvm_repo1/OL-6U8_storage0.qcow2
OL-6U8_storage1.qcow2  /kvm_repos/kvm_repo1/OL-6U8_storage1.qcow2

We can view the storage volume information details issuing:

# virsh vol-info --pool kvm_repo1 OL-DB_6U8.qcow2
Name:           OL-DB_6U8.qcow2
Type:           file
Capacity:       512.00 GiB
Allocation:     7.10 GiB

How to Create a KVM Storage Pool on ODA - Detailed Steps

On ODA we will create KVM storage pools using the shared storage on the ODA X6-2S/X6-2M/X6-2L.  By default the shared storage disk group DATA is designed to store Databases. To use this shared storage with KVM, we will define new ACFS (Oracle Automatic Storage Management Cluster File System) file system to store guest VM volumes (disk image files).

The Steps

1. Create your ACFS volume (as grid user)
asmca -silent -createVolume -volumeName <ASM volume name> -volumeDiskGroup <ASM disk group name for the volume> -volumeSizeGB <ASM volume size in GB> -sysAsmPassword <sys asm password>

example:

[grid@odaL ~]$ asmca -silent -createVolume -volumeName kvm_repo5 -volumeDiskGroup DATA -volumeSizeGB 100 -sysAsmPassword welcome1

Volumes fetched successfully. Check /u01/app/grid/cfgtoollogs/asmca/asmca-170526AM012426.log for details.

2. Verify your volume creation (as grid user)
asmcmd volinfo -G <diskgroup> <ASM volume name> | grep -oE '/dev/asm/.*'

example:

[grid@odaL ~]$ asmcmd volinfo -G DATA kvm_repo5 | grep -oE '/dev/asm/.*'
/dev/asm/kvm_repo5-208

3. Create the ACFS filesystem (as grid user)
asmca -silent -createACFS -acfsVolumeDevice <volume_device> -acfsMountPoint <mount point>
example (note as the acfsVolumeDevice is the output of previous command '/dev/asm/kvm_repo5-208') :

[grid@odaL ~]$ asmca -silent -createACFS -acfsVolumeDevice /dev/asm/kvm_repo5-208 -acfsMountPoint /kvm_repos/kvm_repo5

ASM Cluster File System created on /dev/asm/kvm_repo5-208 successfully. Run the generated ACFS registration script /u01/app/grid/cfgtoollogs/asmca/scripts/acfs_script.sh as privileged user to register the ACFS with Grid Infrastructure and to mount the ACFS. The ACFS registration script needs to be run only on this node: odaL.

4. Run the generated ACFS registration script as privileged user
/u01/app/grid/cfgtoollogs/asmca/scripts/acfs_script.sh
example:

[root@odaL ~]# /u01/app/grid/cfgtoollogs/asmca/scripts/acfs_script.sh
ACFS file system /kvm_repos/kvm_repo5 is mounted on node
odaL

5. Create the KVM pool (as root user)
virsh pool-define-as <poolname> --type dir --target <path>

example:

[root@odaL ~]# virsh pool-define-as kvm_repo5 --type dir --target /kvm_repos/kvm_repo5
Pool kvm_repo5 defined

6. Start the pool (as root user)
virsh pool-start <poolname>
example:

[root@odaL ~] # virsh pool-start kvm_repo5
Pool kvm_repo5 started

7. Setup the autostart (as root user)
virsh pool-autostart <poolname>
example:

[root@odaL ~]# virsh pool-autostart kvm_repo5
Pool kvm_repo5 marked as autostarted

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.