1

Using CentOS 5 with KVM.

I have downloaded this KVM applicance, and when unzipped it is just a .img file. No xml file supplied.

I can start the guest with

 /usr/libexec/qemu-kvm -hda /data/kvm/slash.img -m 512

and it works.

Now I would like to make a config file for the guest.

The problem is when I do

# virsh -c qemu:///system list
 Id Name                 State
----------------------------------

# 

I don't see the guest as expected.

Does anyone know what is wrong?

Louise Hoffman
  • 476
  • 2
  • 6
  • 12

3 Answers3

3

You can get an example of .xml file here:
http://libvirt.org/drvqemu.html#xmlconfig

You modify it according to your needs.
Here you can all formats about xml format:
http://libvirt.org/format.html

About seeing all the virtual machines, try with

virsh list --all

So you can see all the installed virtual machines and not only those running.

PiL
  • 1,599
  • 8
  • 6
  • Also make sure you're running `virsh list` as the same user that you're running the KVM guest process under. – nedm Jun 20 '10 at 02:29
2

You need to tell virsh about your KDE image.This is accomplished by either importing an existing XML file that's customized according to your needs or generating one

Method 1. Create and customize the XML: get a copy from somewhere else or download the one specified in the previous answer, and place it in in a temporary place. My case /home/user/centos.xml (my case centos.img, yours IMAGENAME.img); qcow or qcow2 will work as well

Import (create) it into virsh

virsh create /home/user/centos.xml

Once imported in libvirt with virsh in can be found in /etc/libvirsh/qemu/


Method 2. Generate a new XML by "installing" the existing image

virt-install --connect qemu:///system --name centos --ram 256 --disk path=/var/lib/libvirt/images/base-centos.img --bridge=virbr0 --vnc --vncport=5901 --accelerate --os-type=linux --cdrom /dev/cdrom 

where path= location of your image

stop force the previous command

virsh destroy centos

Look for cenots in virsh

virsh list --all

     Id Name                 State
----------------------------------
  - centos               shut off

Start the new VM

[root@ libvirt]# virsh start centos
Domain centos started

[root@ libvirt]# virsh list 
 Id Name                 State
----------------------------------
  1 centos               running
Patel95
  • 466
  • 4
  • 7
0

you might need to run this with qemu+ssh://

dyasny
  • 18,802
  • 6
  • 49
  • 64