public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Riccardo Veraldi <Riccardo.Veraldi@cnaf.infn.it>
Cc: kvm@vger.kernel.org
Subject: Re: how to convert manual vm to libvirtd management
Date: Thu, 9 Apr 2009 19:14:44 +0100	[thread overview]
Message-ID: <20090409181444.GB32537@redhat.com> (raw)
In-Reply-To: <49DE2A0A.2060209@cnaf.infn.it>

On Thu, Apr 09, 2009 at 07:02:02PM +0200, Riccardo Veraldi wrote:
> Hello,
> I have always created my VM under kvm manually starting them from a .sh 
> script:
> 
> for example machine called  abbone
> 
> 
> # abbone.sh
> screen qemu-kvm -nographic -hda ./abbone.img -m 512 -net 
> nic,model=e1000,macaddr=00:16:3e:05:00:07 -net tap -name abbone -vnc :0
> 
> 
> I use screen so that I am hook to the serial console and it is so easy 
> to manager machien via serial console.
> 
> But now I havea problem. I vould like to use virsh to manager my virtual 
> machines.
> 
> now I installed all my VM MANUALLY vithout using virt-install so I do 
> not have the proper virtual machine
> XML descriptor files in /etc/libvirt/qemu
> 
> without a XML description is not possible to start, shutdown, destroy 
> virtual machines via virsh or virt-manager tool.
> 
> so How can I create an XML file with all the options of the above command ?

There is a referenece for possible XML options here:

  http://libvirt.org/formatdomain.html

And some specific XML examples for QEMU:

  http://libvirt.org/drvqemu.html

> 
> actually with the above command a proper tapN interface is created upon 
> VM startup via /etc/qemu-ifup script

When using libvirt, there's no need for a ifup script, since libvirt
will create the TAP device and add it to the bridge for you.

There is a introduction to networking with libvirt here:

http://wiki.libvirt.org/page/Networking

To help you get started, to replicate your example config here:

 qemu-kvm -nographic -hda ./abbone.img -m 512 -net
  nic,model=e1000,macaddr=00:16:3e:05:00:07 -net tap -name abbone -vnc :0

You would want to create an XML doc that looks like this:

   <domain type='kvm'>
     <name>abbone</name>
     <memory>524288</memory>
     <devices>
        <emulator>/usr/bin/qemu-kvm</emulator>
        <disk type='file' device='disk'>
           <source file='/path/to/abbone.img'/>
           <target dev='hda' bus='ide'/>
        </disk>
        <interface type='bridge'>
           <source bridge='br0'/>
           <mac address='00:16:3e:05:00:07'/>
           <model type='e1000'/>
        </interface>
     </devices>
  </domain>


DOn't forget to change 'br0' to whatever bridge you are using, and
set the correct path to your abbone.img disk image

One thing that's confusing is that you have set '-nographic' and '-vnc'
which doesn't make sense. Either you want graphics or you dont !

If you want VNC graphics, then in the <devices> section of the XML
also add

    <graphics type='vnc' port='5900'/>

Then load the config into libvirt using

      virsh define /path/to/config.xml

And you can start it with

      virsh start


If you have more libvirt questions, you might wish to ask on the libvirt
mailing list

  http://www.redhat.com/mailman/listinfo/libvir-list

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

      reply	other threads:[~2009-04-09 18:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-09 17:02 how to convert manual vm to libvirtd management Riccardo Veraldi
2009-04-09 18:14 ` Daniel P. Berrange [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090409181444.GB32537@redhat.com \
    --to=berrange@redhat.com \
    --cc=Riccardo.Veraldi@cnaf.infn.it \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox