Created
November 25, 2018 23:06
-
-
Save vitali2y/80dd7f603898bd5dc81273092e412b34 to your computer and use it in GitHub Desktop.
Creating, running, and destroying a Ubuntu 16.04 minimal cloud image KVM under Linux Mint 18.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... in steps below: |
Deleting a virtual machine:
evergreen ~ # virsh list --all
Id Name State
----------------------------------------------------
- ubuntu-16.04-amd64 shut off
- ubuntu-16.04-node1 shut off
- ubuntu-16.04-node2 shut off
evergreen ~ # virsh dumpxml --domain ubuntu-16.04-node1 | grep 'source file'
<source file='/home/vit/prjs/~...~/node1/ubuntu-16.04-amd64.img'/>
<source file='/home/vit/prjs/~...~/node1/config.img'/>
evergreen ~ # ls -la /home/vit/prjs/~...~/node1/ubuntu-16.04-amd64.img /home/vit/prjs/~...~/node1/config.img
-rw-rw-r-- 1 libvirt-qemu kvm 374784 Dec 5 23:50 /home/vit/prjs/~...~/node1/config.img
-rw-r--r-- 1 root root 10546774016 Feb 1 02:00 /home/vit/prjs/~...~/node1/ubuntu-16.04-amd64.img
evergreen ~ # virsh undefine --domain ubuntu-16.04-node1
Domain ubuntu-16.04-node1 has been undefined
evergreen ~ # virsh list --all
Id Name State
----------------------------------------------------
- ubuntu-16.04-amd64 shut off
- ubuntu-16.04-node2 shut off
evergreen ~ #
Try to ignore that cmd, and go ahead.
…On Wed, Aug 28, 2019 at 6:21 PM NCLI ***@***.***> wrote:
I know these are just intended as notes for you, but I'm having trouble
with this exact process. When I try to run $ virsh change-media
ubuntu-16.04-amd64 hda --eject --config, I get an error: error: failed to
get domain 'ubuntu-16.04-amd64'
error: Domain not found: no domain with matching name 'ubuntu-16.04-amd64'
Do you have any idea what I might be doing wrong?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/80dd7f603898bd5dc81273092e412b34?email_source=notifications&email_token=AAKE256YA22D6YVHHOHL4PLQG2JXFA5CNFSM4IRKDD5KYY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFXYHA#gistcomment-3010672>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAKE253QFUI5AHTOR62HMVDQG2JXFANCNFSM4IRKDD5A>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ sudo apt install qemu-kvm libvirt-bin virtinst bridge-utils cloud-image-utils
$ wget http://cloud-images.ubuntu.com/minimal/releases/xenial/release/ubuntu-16.04-minimal-cloudimg-amd64-disk1.img
$ qemu-img convert -O qcow2 ubuntu-16.04-minimal-cloudimg-amd64-disk1.img ubuntu-16.04-minimal-cloudimg-amd64-disk1.qcow2
$ qemu-img resize ubuntu-16.04-minimal-cloudimg-amd64-disk1.qcow2 +8G
$ qemu-img create -f qcow2 -b ubuntu-16.04-minimal-cloudimg-amd64-disk1.qcow2 ubuntu-16.04-amd64.img
$ cat config
$ cloud-localds config.img config
$ cat ./virt-install.sh
$ sudo virsh change-media ubuntu-16.04-amd64 hda --eject --config
$ sudo virsh -c qemu:///system list --all
$ sudo virsh net-autostart default
$ sudo virsh net-start default
$ sudo ./virt-install.sh
$ sudo virsh shutdown ubuntu-16.04-amd64 --mode acpi
$ sudo virsh start ubuntu-16.04-amd64
$ sudo virsh console ubuntu-16.04-amd64
$ sudo virsh shutdown ubuntu-16.04-amd64 --mode acpi
$ sudo virsh undefine ubuntu-16.04-amd64