On Sun, Feb 25, 2007 at 10:34:15AM +0200, Avi Kivity wrote:
> Avi Kivity wrote:
> >Daniel P. Berrange wrote:
> >  
> >>FYI, as of libvirt 0.2.0  and virt-manager 0.3.1 there is now 
> >>(experimental!)
> >>support for managing virtual machines running under QEMU or KVM 
> >>virtualization
> >>platforms, as well as the existing Xen support.
> >>
> >>  
> >>    
> >
> >Great; as I see it hit FC6-updates I'll give it a shot.
> 
> How is one supposed to use it?  I tried entering 'qemu://' and 'kvm://' 
> in the 'other hypervisor' thingy, but that didn't work.

The virt-manager in Fedora Core 6 hasn't been updated to the newest 
0.3.1 release yet - only the underling libvirt has been pushed to FC6
thus far. What follows is an example illustrating use of the low level 
'virsh' command. First we create an XML file describing the VM we want
to create, then create a file to serve as a disk image. Then we start
virsh connecting to the QEMU hypervisor, define the domain, start it
and dump the runtime info & XML. Finally it connects to the VNC port
to access the console

 $ cat > newvm.xml <<EOF
 <domain type='qemu'>
   <name>Fedora</name>
   <uuid>c7a5fdbdcdaf9455926ad65c16db1809</uuid>
   <os>
     <type>hvm</type>
     <boot dev='cdrom'/>
   </os>
   <memory>219200</memory>
   <vcpu>2</vcpu>
   <devices>
     <disk type='file' device='disk'>
       <source file='/home/berrange/fedora.img'/>
       <target dev='hda'/>
     </disk>
     <disk type='file' device='cdrom'>
       <source file='/home/berrange/boot.iso'/>
       <target dev='hdc'/>
     </disk>
     <interface type='user'>
       <mac address='00:16:3e:62:a5:08'/>
     </interface>
     <graphics type='vnc' port='5900'/>
   </devices>
 </domain>
 EOF
 $ dd if=/dev/zero of=/home/berrange/fedora.img bs=1M seek=5000 count=0
 $ virsh --connect qemu:///session
 Welcome to virsh, the virtualization interactive terminal.

 Type:  'help' for help with commands
        'quit' to quit

 virsh > define /home/berrange/qemu.xml
 Domain Fedora defined from /home/berrange/qemu.xml

 virsh > list --all
  Id Name                 State
 ----------------------------------
   - Fedora               shut off

 virsh > start Fedora
 Domain Fedora started

 virsh > list
  Id Name                 State
 ----------------------------------
   4 Fedora               running

 virsh > dominfo Fedora
 Id:             4
 Name:           Fedora
 UUID:           c7a5fdbd-cdaf-9455-926a-d65c16db1809
 State:          running
 CPU(s):         2
 CPU time:       0.0s
 Max memory:     219200 kB
 Used memory:    219200 kB

 virsh > dumpxml Fedora
 <domain type='qemu' id='4'>
   <name>Fedora</name>
   <uuid>c7a5fdbd-cdaf-9455-926a-d65c16db1809</uuid>
   <memory>219200</memory>
   <currentMemory>219200</currentMemory>
   <vcpu>2</vcpu>
   <os>
     <type arch='i686' machine='pc'>hvm</type>
     <boot dev='cdrom'/>
   </os>
   <devices>
     <emulator>/usr/bin/qemu</emulator>
     <disk type='file' device='cdrom'>
       <source file='/home/berrange/boot.iso'/>
       <target dev='hdc'/>
       <readonly/>
     </disk>
     <disk type='file' device='disk'>
       <source file='/home/berrange/fedora.img'/>
       <target dev='hda'/>
     </disk>
     <interface type='user'>
     </interface>
     <graphics type='vnc' port='5900'/>
   </devices>
 </domain>

 virsh > quit

 $ vncviewer :0

 VNC Viewer Free Edition 4.1.2 for X - built 
 ...


The above illustrates creating a QEMU domain. The use of KVM is
completely identical - still use  qemu:///session as the hypervisor
URL. The change is in the XML file describing the guest VM - in the
top level '<domain>' attribute use type='kvm' instead of type='qemu'.
You can also use type='kqemu' if desired. NB you can create 'qemu'
guests as an user, but if you want to create kvm/kqemu guests you
must either be root, or chown the device nod.e

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to