Skip to content
/ vm Public

a command line utility that provides a high-level interface to create and manage virtual machines

License

Notifications You must be signed in to change notification settings

subpop/vm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

vm is a command line utility that provides a high-level interface to create and manage virtual machines through libvirt.

It supports creation and deletion of domains and snapshots, connecting to serial and SSH terminals, downloading and converting templates from vagrantup.com and builder.libguestfs.org, and importing locally downloading images.

Installation

go get -u github.com/subpop/vm/cmd/vm

Distribution

vm includes a Makefile to aid distributions in packaging. The default target will build vm along with shell completion data and a man page. The Makefile includes an install target to install the binary and data into distribution-appropriate locations. To override the installation directory (commonly referred to as the DESTDIR), set the DESTDIR variable when running the install target:

[link@localhost vm]$ make
go build ./cmd/vm
go run ./cmd/vm --generate-fish-completion > vm.fish
go run ./cmd/vm --generate-bash-completion > vm.bash
go run ./cmd/vm --generate-man-page > vm.1
gzip -k vm.1
[link@localhost vm]$ make DESTDIR=_inst install
install -D -m755 -t _inst//usr/local/bin vm
install -D -m644 -t _inst//usr/local/share/man/man1 vm.1.gz
install -D -m644 -t _inst//usr/local/share/fish/completions vm.fish
install -d _inst//usr/local/share/bash-completion/completions
install -m644 -T vm.bash _inst//usr/local/share/bash-completion/completions/vm
[link@localhost vm]$

Usage

Download a base image:

vm image get https://dl.fedoraproject.org/pub/fedora/linux/releases/31/Cloud/x86_64/images/Fedora-Cloud-Base-31-1.9.x86_64.qcow2

Download and convert a Vagrant ".box":

vm image get https://dl.fedoraproject.org/pub/fedora/linux/releases/31/Cloud/x86_64/images/Fedora-Cloud-Base-Vagrant-31-1.9.x86_64.vagrant-libvirt.box

Create a domain backed by that image:

vm create Fedora-Cloud-Base-31-1.9.x86_64 --name my-f31

Create a domain without defining it:

vm create Fedora-Cloud-Base-31-1.9.x86_64 --transient

List active domains:

vm list

Start a created domain:

vm up my-f31

Connect to an existing domain over SSH:

vm connect -m ssh -u vagrant my-f31 -i ~/.ssh/cloud_user_rsa

Connect to an existing domain over VirtIO PTY:

vm connect -m console my-f31

Take a snapshot:

vm snapshot create my-f31 --name fresh_install

Revert to snapshot:

vm snapshot revert my-f31 --snapshot fresh_install

About

a command line utility that provides a high-level interface to create and manage virtual machines

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published