OndrejHome / fast-vm

'fast-vm' is a script for defining VMs from images provided in thin LVM pool.
GNU General Public License v3.0
22 stars 14 forks source link

How can I export my instance as image ? #35

Closed tedwon closed 6 years ago

tedwon commented 6 years ago

Hello Ondrej,

Thank you so much for fast-vm!

I have a question on usage.

I started one instance and installed and configured some applications. And want to make this as an image similarly snapshot.

I checked out fast-vm --help, I can see "/usr/bin/fast-vm export_image ImageName <xz|gz>". But it looks I can export image I imported.

How can I do this ? Kindly let me know ?

Many Thanks, Ted Won

OndrejHome commented 6 years ago

Hi Ted (@tedwon), thank you for using fast-vm!

In understand that you have imported some image, then created a VM (with number) and made changes in this VM. If this is not true please correct me.

fast-vm can for now export only images amd not VMs. There is a way how to change the VM content so it can be later exported - fast-vm create imageName base command will create a VM that will use the image disk directly. So if you use this "base VM" to make changes to image you can then export it with fast-vm export_image command.

Please let me know if this helps you. If not I can imagine having either function for exportin VMs directly (like export_vm_image) or to have function to overwrite image with content from one of the VMs so the regular 'export_image' can be used. If you have any preference for these methods please let me know.

tedwon commented 6 years ago

Hi @OndrejHome Thank you so much for your reply. I'll try that with fast-vm create imageName base. And I'll back. 👍

tedwon commented 6 years ago

@OndrejHome Thank you so much!! 👍

Now I can do what I need. :-)

Below is summary note from you.

basically the approach is:

  1. fast-vm import_image someImage ...
  2. fast-vm create someImage base
  3. run the VM manually via virsh or virt-manager
    virsh --connect qemu:///system start someImage

    Ex:

    virsh --connect qemu:///system start fastvm-rhel-7.4
    virsh list --all
  4. connect base image
    vm virsh console fastvm-rhel-7.4
  5. add ip address
    ip a add 192.168.xx.10/24 dev eth0
    ip route add default via 192.168.xx.1 dev eth0
    echo 'nameserver 192.168.xx.1' >> /etc/resolv.conf
    ping google.com
  6. do custom changes
  7. once finished with changes, stop the base VM
  8. create VMs as ussuall with fast-vm create someImage 21