[libvirt-users] How to create a guest os from existing disk image file

Rajiv Rajaian rajiv.care at gmail.com
Thu Jul 15 10:30:47 UTC 2010


Hi
I have configured KVM with Fedora Core 13 by enabling the KVM virtualization
option while installing OS.
I have successfully created the guest OS by using the virt-install API

/usr/sbin/virt-install --name centos5 --ram 512 --disk
path=/var/lib/libvirt/images/
centos.img,size=5 --network network:default --accelerate --vnc -c
/tmp/CentOS-5.3-i386-bin-DVD.iso

I am able to login to the guest OS using the virt-viewer command using vnc
Now i want to the guest os from the existing configured disk
/var/lib/libvirt/images/centos.img.. What modifications should be done with
my configuration file ??
Pleas help me to solve this.

[root at kvmcluster ~]# virsh dumpxml centos5
<domain type='qemu' id='2'>
  <name>centos5</name>
  <uuid>cabfad09-ff8b-e1ca-051a-6729e301f6a1</uuid>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='i686' machine='fedora-13'>hvm</type>
    <boot dev='cdrom'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>destroy</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/centos.img'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu'/>
      <source file='/tmp/CentOS-5.3-i386-bin-DVD.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01'
function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:bf:32:c2'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04'
function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/2'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes' keymap='en-us'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02'
function='0x0'/>
    </video>
  </devices>
  <seclabel type='dynamic' model='selinux'>
    <label>system_u:system_r:svirt_t:s0:c370,c413</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c370,c413</imagelabel>
  </seclabel>
</domain>




Thanks/Regards.
Rajiv.R
Project Associate.
CARE. MIT
Anna University Chennai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20100715/b84197de/attachment.htm>


More information about the libvirt-users mailing list