Installing VMmanager on the server with running virtual machines

From ISPWiki
Jump to: navigation, search
Hierarchy: VMmanager KVM -> VMmanager KVM setup and configuration

This article describes how to install VMmanager on a server with running virtual machines, and use it as cluster node.


Source data

The vm1 virtual machine is up and running on the server.

[root@dasha ~]# virsh list --all
 ID    Name                           Status
 1     vm1                            running

All the information is kept in the storage uest_images_dir.

[root@dasha ~]# virsh vol-list guest_images_dir 
Name                    Path                                 
vm1                  /guest_images/vm1


We need to install VMmanager on the server. VMmanager should manage the existing virtual machine vm1.

Installing VMmanager

Follow the steps in the article VMmanager installation guide.

Preliminary configuration

  • After you have installed VMmanager, log in to the panel as admin. root user does not have all required functions.
En 1vminst.png
  • As virtual machines are running on the server where VMmanager is installed, connect this server as a cluster node.
En 2vminst.png
En 3vminst.png
  • When adding a cluster node, the File storage will be automatically created, type - File system (you may add a custom storage, if needed), that is already connected to it. The directory is located in /vm. Take a note of the disk format, qcow2 is created by default, but in our example raw was used. Delete the storage that was created automatically and create a new one in the raw format.
En 8vminst.png

Later you can convert the storage format into qcow2.

  • Create a user who will own the virtual machines.
  • Install required OS templates. The most popular templates can be found in the list, however you can create a custom one or connect your repository with OS templates.
  • Add available IP addresses in the module IP address management (all of the IP addresses assigned to virtual machines).

Defining configuration of existing virtual machines

If virtual machine was created long ago and you don't know how much resources were allocated to that machine, you can find the information in its xml description.

List of all the virtual machines

[root@dasha ~]# virsh list --all
 ID    Name                          Status
 2     vm1                           running 

Stop the vm1 virtual machine.

[root@dasha ~]# virsh destroy vm1
Domain vm1 destroyed 
[root@dasha ~]# virsh list --all
 ID    Name                         Status
 -     vm1                          disabled

View its description (it may vary depending on how the virtual machine was created).

[root@dasha ~]# virsh dumpxml vm1
<domain type='kvm' id='2'>
  <name>vm1</name> --- Name
  <memory unit='KiB'>1048576</memory> --- 1048576 KiB, i.e. 1024 MiB of RAM is allocated
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu> --- The number of virtual processes available to the virtual machine
    <type arch='x86_64' machine='rhel6.5.0'>hvm</type> --- CentOS x86_64 is installed on the virtual machine
    <bootmenu enable='yes'/>
<graphics type='vnc' port='5900' autoport='yes' listen='' keymap='ru' password='123'> --- VNC password (sometimes it is not provided)
      <listen type='address' address=''/>

How to learn the main disk size

[root@dasha ~]# virsh vol-info vm1 --pool guest_images_dir
Name:         vm1
Type:         file
Total: 50,00 GiB
Allocated: 50,00 GiB

Creating a virtual machine in VMmanager

Create a virtual machine providing the values that you got earlier.

  • Enter a unique name.
  • Specify the IP address of the existing virtual machine in the corresponding field.
En 4vminst.png

The new virtual machine with specified parameters and IP address will be created.

En 5vminst.png

The new virtual machine is up and running.

[root@dasha ~]# virsh list --all
 ID    Name                          Status
 4     vm2                            running
 -     vm1                            disabled

The image of the new virtual machine is located in

[root@dasha ~]# virsh vol-list
 File Name               Path                                 
 vm2                  /vm/vm2

Disable the newly created virtual machine in VMmanager.

En 6vminst.png

Change that image into the image of your old virtual machine.

[root@dasha ~]# dd if=/guest_images/vm1 of=/vm/vm2

Activate the virtual machine in VMmanager.

En 7vminst.png

Check all the settings, files, etc. of the virtual machine.

Possible issues

qemu-kvm: -drive file=/vm/vm2,if=none,id=drive-virtio-disk0,format=qcow2: could not open disk image /vm/vm2: Invalid argument

If the virtual machine is not started after you have changed the image, and the above error message is displayed, the storage format of the old machine might not match the format of the new one. You should re-create the storage in VMmanager and use the correct format. Then re-create the virtual machine in VMmanager on the new storage.

Virtual machine is up and running, but is not pinged

Log into the virtual machine through VNC (VMmanager --- Virtual machines --- the button VNC).

En 9vminst.png

Check the output of the ifconfig command. If the IP address was not assigned to the eth0 interface, locate the correct IP address, gateway and network mask in /etc/sysconfig/network-scripts/ifcfg-eth0.