Deploy a RHEV environment

De SeRoM - Wiki
Aller à : navigation, rechercher

Introduction

Note

Note

This following document cover the version 3.0 of RHEV.

Install the RHEV Manager

Install

 yum remove classpathx-jav
 yum update
 yum install rhevm rhevm-reports

Configure

Setup the RHEV Manager

 rhevm-setup

Setup the Data Ware House

 rhevm-dwh-setup

Setup the reports

 rhevm-reports-setup

Join the AD Domain:

 rhevm-manage-domains -action=add -domain=ad.example.com -user=RHEVAdmin -interactive

Set a Mac Pool Range for VMs:

 rhevm-config -s MacPoolRanges=52:54:00:56:05:01-52:54:00:56:05:05

You can also set other parameters. To get the list of all parameters:

 rhevm-config -a

Don't forget to restart jbossas daemon after that:

 /etc/init.d/jbossas restart

Install the prereq's to access to the RHEV Manager Web UI

Windows IE is required to browse the Admin Web UI.

  • Install .NET Framework 4. The installer is located in C:\rhevm\dotNetFx40_Client_x86_x64.exe
  • Configure IE ESC to off
  • Add the RHEVM CA CERT to IE

Spice will install by itself the first time you start a console.

Spice on RHEL:

 yum install spice-xpi

Install the RHEV Hypervisor

Install

  1. Boot from the Hypervisor iso
    • In the lab: It can be PXE booted
    • In real life: The ISO is located in /usr/share/rhev-hypervisor/ and is provided by the RPM package: rhev-hypervisor
  2. Select Install Hypervisor in the install boot menu
    • In the LAB: rhevh
  3. Specify the boot disk
  4. Specify the install disk
  5. Specify the admin password.

Configure

At the end of the installation, the machine reboot. Once rebooted you will face a ncurse menu. Via this menu you are able to configure:

  • The Network
  • The link to the RHEV Manager
  • Enable ssh with password

Automate

This installation and configuration is possible to be automated like with Kickstart files. For more info about this see RHEV Hypervisor Installation Guide

Upgrade

Two way to proceed:

  1. With the boot ISO of the new version: At the boot prompt typ upgrade in place of install.
  2. Remotely from the RHEV Manager: Upgrade the rhev-hypervisor package, then from the Manager interface you will receive a update alert that allow you to launch the upgrade remotely.

Install hypervisor on a default RHEL

First subscribe to the right channel on RHN: rhel-x86_64-rhev-mgmt-agent-6. (or in our lab get the right local repo)

Then install vdms:

 yum install vdsm

Create the RHEV Resouce

A good reference: http://www.ovirt.org/Quick_Start_Guide

Data center

Create a new Data center in DataCenter Tab > New. In the pop-up box provide:

  • Name
  • Description
  • Storage Type
  • Compatibility

Cluster

Create a new Cluster in Cluster Tab > New. In the pop-up box provide:

  • DataCenter
  • Name
  • Description
  • CPU Family Name
  • Compatibility
  • Mem Optimization
  • Migration Policy

Once the cluster created, you can approve host to be part of the cluster.

To remove a host from a cluster, you need to first put it into Maintenance mode.

Storage Domain

Prepare Storage

NFS

Create your export in /etc/exports

 /exports/isos    <RHEV-HypervisorS>(rw)
 exportfs -r

Ensure that the rights on the exported directory is correct:

 chown vdsm:kvm /exports/isos
 chmod g+s /exports/isos

iSCSI

refer to the RHEL Storage Admin Guide

Create Storage Domain

Create a new Domain in Storage Tab > New Domain. In the pop-up box provide:

  • Name
  • DataCenter
  • Domain function [iso/data/export]
  • Use host
  • ... The rest depend on what storage type (NFS, iSCSI of FC)

Then activate it from the Storage Tab > Data Center, select your Data Center and then press Activate button.

Populate a ISO domain

To Be Continued

Install a new virtual Server/Desktop running RHEL

Create the VM

Go on Virtual Machines > from there click New Server or New Desktop button depending of what you wan to create. In the pop-up box provide:

  • Data Center
  • Host Cluster
  • Name
  • Description
  • Memory Size
  • Number of Cores and CPU Sockets
  • Operating system

Further option can also be set in this pop-up box:

  • A Template (that woulb be the base for this VM)
  • Console type (but you should keep Spice because it rocks)
  • High Availability & SLA
  • plus few others...

Add Disks and NICs

You should also add Virtual Disk and a Virtual NIC:

For both keep VirtIO (ParaVirt for performance). But for the disk you have to give:

  • a Size
  • from which Storage Domain
  • and the format [PreAllocated|ThinProvision]

For the NIC, a MAC is requested if you didn't provided a Range to the RHEV Manager.

Install VirtIO driver on Windows

Get the iso of the Windows drivers and put them on the ISO Domain:

 yum install virtio-win
 cp /usr/share/rhev-guet-tools-iso/*.iso /exports/iso/xxxxxxxx-xxxx-xxxx-xxxxxxxx/iamges/11111111-1111-1111-11111111/

Start the Windows with the attached Floppy virtio-win.vfd. Once booted, load the VirtIO driver from A:\adm64\Win7\viostor.inf.

Create Snapshot and restore VM from Snapshots

Create a Snapshot

  1. Shut the machine down
  2. Go on Virtual Machines > Select your machine
  3. In sub tab Snapshots click create. In the popup box provide:
    • Description

Create Templates and deploy new VMs from those

Clean a Guest (running RHEL)

Remove all references to the specific hadware, network configurations, ssh keys, ...

 rm -rf /etc/udev/rules.d/*-persistent-*.rules
 sed -i '/^HWADDR=/d' /etc/sysconfig/network-scripts/ifcfg-*
 rm -rf /etc/ssh/moduli /etc/ssh/ssh_host_* /root/.ssh/*
 sed -i 's/HOSTNAME=.*/HOSTNAME=localhost.localdomain/' /etc/sysconfig/network
 rm -rf /etc/sysconfig/rhn/systemid

Create the Template

Go on Virtual Machines > Select the reference machine, then click Make Template button. In the pop-up box provide:

  • Name
  • Description
  • Host Cluster
  • Storage Domain

Create Pool of VMs

Go on Pools > then click New button. In the pop-up box provide:

  • Data Center
  • Host Cluster
  • Name
  • Description
  • The number of VMs
  • The Base Template
  • Pool Type [Automatic|Manual]

The Memory, the Cores, the CPUs and the OS will inherit from the Template, but you can adapt it.

Manager Users and rights

Before trying to manager users, fist check that your Manager is well connected to the AD or the IPA.

Create new Roles

Click on Configure on the top of the page. A pop-up box comes up. In this box Roles tab > then click New Button. In the second pop-up box provide:

  • Name
  • Description
  • Account type [Admin|User]
  • The different rights you want to provide to the role.

Provide role to users

Click on Configure on the top of the page. A pop-up box comes up. In this box System Permission tab > then search after the users.

Select the users and assigne them a role and validate it by Ok.

Provide rights to users

When users have role, you can give them access to the objects (VM, VMs, Pool, Host, Cluster, Storage Domain, Template, users or the entire system).

For that, in the <Object> tab > Permissions sub-tab > Click Add button and from there chose the users who will have rights on this object.

Doing Search

Result-Type: [Criteria...] [sortby sort_spec]
  • result-type = Vms, Datacenter, Hosts, Events, Clusters, Storage, or Template
  • Criteria = <property> <operator> <value>
    • property
    • operator: =,!=,>,<,>=,<=
    • value

Examples:

 Hosts:VMs.status = up
 Vms: test
 Vms sortby uptime desc
 Events: severit > normalsortby time 

Add tags

Create a tag

Click a <resource> tab, then Click Tags tab. Select the node (the firstone will be at root level) and click New. In the pop-up box provide:

  • Name
  • Description

Create a sosreport

the equivalent command of sosreport for RHEV is:

 rhevm-log-collector collect

Create Report

Create tab > select Ad How Report > select Topics or Domains.

Select the shape.

Add a second RHEV Hypervisor

Install a Hypervisor on our Manager

Attention

Attention

This is not the best idea. This is only a lab purpose. Actually, in production, do not use the RHEV Manager as Hypervisor node at all.

 yum install vdsm
 wget http://my-repository.example.com/pub/rhel6/dvd/Packages/perl-Net-Telnet-3.03-11.el6.noarch.rpm \
     -O /tmp/perl-Net-Telnet-3.03-11.el6.noarch.rpm
 yum install /tmp/perl-Net-Telnet-3.03-11.el6.noarch.rpm
 yum install vdsm

Add the hostname of RHEV-Maganger into the /etc/hosts to be sure the hypervisor can resolve it:

 <RHEV-M IP>    <RHEV-M Name><fqdn> <RHEV-M Name>
 chkconfig NetworkManager off
 /etc/init.d/NetworkManager stop

Performance tune

Tune on hypervisor

Tuned

Install

 yum install tuned
 /etc/init.d/tuned start
 chkconfig tuned on

usage

list the profile:

 tuned-adm list

change your profile:

 tuned-adm profile throughput-performance

To create your own profile, create a new directory into /etc/tune-profiles/ and edit it.

KSM

The identical memory between guests is not replicated. It is what we call KSM. And you can modify the management policy.

 vim /etc/ksmtuned.conf
 /etc/init.d/ksmtuned restart

Backup / Restore RHEV Manager

Backup

DataBase

 for DB in rhevm rhevm_history rhevmreports; do
     pg_dump -C -E UTF8 --column-inserts --disable-dollar-quoting --disable-triggers -U postgres --format=p \
             -f /usr/share/rhevm/db-backups/dump_${DB}_$(date "+%Y%m%d_%R").sql ${DB}
 done

Config files

Do a tar archive of all config files:

 tar -cf /root/rhev-config.tar /etc/jbossas/jbossas.conf /etc/rhevm/ /etc/yum/pluginconf.d/versionlock.list \
     /etc/pki/rhevm/ /etc/jbossas/rhevm-slimmed/ /usr/share/rhevm-reports-server/buildomatic \
     /usr/share/rhevm/conf/iptables.example /usr/share/rhevm/kerberos/ /usr/share/rhevm/dbscripts/create_db.sh.log \
     /usr/share/rhevm/rhevm.ear/rhevmanager.war/ExternalConfig.txt /usr/share/rhevm/rhevm.ear/rhevmanager.war/ServerParameters.js \
     /usr/share/rhevm-reports/reports-3.0.1-9/resources/organizations/rhevmreports/Resources/JDBC/data_sources/rhevm.xml \
     /usr/share/rhevm-reports/reports-3.0.1-9/users/rhevmreports/rhevm-002dadmin.xml \
     /usr/share/rhevm-reports-server/buildomatic/default_master.properties /usr/share/rhevm-reports-server/buildomatic/install.xml \
     /usr/share/rhevm-reports-server/buildomatic/setup.xml /root/.pgpass /root/.rnd

You can find the entire list of config files you need to back up in the Adminstration guide - Chapter 15

Write a RESP API script

List the VM that have a name that look like *rhel*:

 curl -k -X GET \
 -u 'RHEVAdmin@ad.example.com:RedHat1!' \
 -H 'Accept: application/xml' \
 https://rhevm-pod5.example.com:8443/api/vms?search=*rhel*
 curl -k -X PUT \
 -u 'RHEVAdmin@ad.example.com:RedHat1!' \
 -H 'Accept: application/xml' \
 -H 'Content-Type: application/xml' \
 -d '<vm><description>API Example</Description</vm>' \
 https://rhevm-pod5.example.com:8443/api/vms/9c60ab7b-dc6b-4f6a-a7e4-e21cfc6da241

VDSM Hooks

You can add scripts into the sub directory of /usr/libexec/vdsm/hooks/.