Equivalente KVM de EC2 AMI

I'm building a piece of software that needs to spin up KVM guests dynamically from a script. I'm hoping that KVM offers an 'AMI' like functionality so that I can spin up new guests without having to go through the entire OS install process.

I've read a little about the 'migrate' functionality but its doesn't sound quite right.

I would really like to be able to build up a guest, imagen it, and then be able to spin up los clones of that image over and over.

preguntado el 30 de enero de 12 a las 19:01

What's wrong with copying the hard disk image file that you are using with the first VM to a new file that is then used in conjunction with another VM? -

That is exactly what I've done. When I asked the question, I was too much of a noob to even know what to ask :) -

1 Respuestas

Just in case the answer to this can be helpful to anyone else who is trying to create analogies between EC2 and KVM here you go.

With KVM, when you start up a guest you specify a disk image file (guestos.img). To reuse that same "image" with another guest all you have to do is shutdown the original guest, copy it's image (and probably rename for clarity's sake) and then start a new guest that points to the copied image. Voila!

Here's some code for giggles:

// Shutdown the image
virsh shutdown vm-name

// Copy the image
cp image-file-name.img copy-file-name.img

// Export the old XML definition file with:
virsh dumpxml vm-name > copy-vm-def.xml

// Edit the copy-vm-def.xml to point to copied image file and choose new vm name
// Then, create the new guest
virsh create copy-vm-def.xml

Respondido 08 Feb 12, 23:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.