Currently, if an image download is interrupted or fails, a partial file
is left in the image directory and a subsequent kvm-install-vm create
command will blissfully use the partial image, which then silently fails
to create the guest.
Instead, name the files with the '.part' file extension while the file
download is in progress, then pivot to the real image name after the
download is complete. Use the wget '--continue' option to resume
partial downloads so we don't have to restart the download from the
beginning.
Add the -l and -L options to the kvm-install-vm remove command to
specify the paths to the images and guest files. Those options are
required if they were given in the previous kvm-install-vm create
command, otherwise the remove will fail to remove the items created with
the custom paths.
Fix the handling of flags in the remove subcommand. Add the missing
shift operator so the guest name is properly detected. Use the internal
destroy_vm when overritting a guest during the kvm-install-vm create
command, since we should not perform the shift in that code path.
This commit fixes the error when a flag is given to the remove command.
$ kvm-install-vm remove -v test01
Please specify a single host to remove.
Run 'kvm-install-vm help remove' for usage.
Currently the eject command hard-codes device name 'hda' to eject the CI
CDROM image. However the device name depends on the distribution of the
kvm host system.
Fortunately, the 'virsh change-media' command can alternately use the
path of the image instead of the device name, so use that instead of the
hard-coded device name 'hda' to eject the CDROM image.
The cloud-init iso file can be created as a read-only file, which causes
the `rm` program to prompt the user to confirm remove. Use the rm force
option to override this prompt and remove the file.
Example output before this commit:
$ kvm-install-vm create test01
- Copying cloud image (CentOS-7-x86_64-GenericCloud.qcow2) ... OK
- Generating ISO for cloud-init ... OK
- Creating storage pool ... OK
- Installing the domain ... OK
- Enabling autostart ... OK
- Cleaning up cloud-init files ... rm: remove write-protected regular file 'test01-cidata.iso'? (hangs here)
Having seperate directories makes it easier to work multiple images and vms.
This change keeps the current image storage location as ~/virt/images but
moves the domains under the ~/virt/vms directory.
Also adds the -L switch to customize the VM storage location.
* Add check for bridge status file and assume it's a layer 2 bridge if it doesn't exist
* Move known_hosts check inside if condition
* Formatting
* Initial commit for custom runcmd support
* Add r as supported option
* Add option for graphics type
* Quotes
* No autoport with this version of virt-install
* Add listen
* Add option to customize additional user
* Custom port support for graphical console
* Fix typos
* Add verbosity to help
* Fix README text
* Unnecessary quotes
* Add workaround for VNC port number
* Load IMAGEDIR for bats tests, increase sleep before hostname resolution test, fix DISKDIR used by attach-disk function
* Make VM name unique to avoid issues with stale libvirt-nss hostname resolution
* Only set VMNAME if it's not already set
* Missing quote
* Export VMNAME
* Increase sleep to 45 seconds
* Add centos user to ssh command
* Fix description of attach-disk
* Change user-data to multipart MIME archive to allow inclusion of a shell script instead of additional runcmd items fs
* Fix boundary
* Remove comment line I never filled in
* Fix typo
* Fix typo and missing colon
* Add autostart option
* Handle output of autostart
* Redirect
* Use outputn
* Add -a to valid options
- In certain cases, the directory can exist when the domain is not defined.
When calling the 'remove' subfunction, it will now delete the directory as
expected, even if the domain doesn't exist.