LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-25-2018, 03:49 PM   #1
ninikos
Member
 
Registered: Dec 2012
Posts: 57

Rep: Reputation: 30
Smile [ANN] Introducing vms - more qemu virtual machines !


Hallo,

I am introducing vms.

vms is a little system for managing qemu virtual machines. It is written in bash. Two main utilities are provided; vms and rc.vms.

vms is for running as a normal user eg. joe. It is used to create and manage virtual machines using simple commands like this

Code:
vms create vm1
vms conf vm1 disk0 '~/.vms/vm1/disk.img'
vms list
vms info vm1
vms start vm1
vms stop vm1
rc.vms is to be used by root for controlling a set of predefined virtual machines. Starting vm1 during boot can be done like this

Code:
echo 'joe vm1' >> /etc/rc.d/rc.vms.conf
/etc/rc.d/rc.vms start
The code is hosted here https://bitbucket.org/yotis/vms
See README.md and the man pages vms(1), vms.conf(5), rc.vms.conf(8), rc.vms.conf(5), vms-tutorial for more information.

A ready to install slackware package is here vms-0.2.1-noarch-1did.tgz (!!updated!!!)

vms HOW TO: https://docs.slackware.com/howtos:emulators:vms

I am using this for quite some time now. It has grown from using custom scripts inspired by Alien Bob's qemu posts and scripts. I have been running with this various linux distros, BSD's, minix, MacOS, windows etc. It has also been used with pci-stub and vfio-pci passthrough for having available hardware in the vm, such as pci graphics and audio cards or the whole usb bridge. See https://bitbucket.org/yotis/vms/src/...sbin/vfio-bind

I find it useful, maybe it will be for others useful too. Any feedback and contribution is more than welcome

I will also submit a SlackBuild to slackbuilds.org.

Last edited by ninikos; 08-30-2018 at 08:51 AM. Reason: updated package link with vms-0.2.1
 
Old 08-26-2018, 09:27 AM   #2
TommyC7
Member
 
Registered: Mar 2012
Distribution: Slackware, CentOS, OpenBSD, FreeBSD
Posts: 502

Rep: Reputation: Disabled
What differentiates vms from virsh/libvirt?
 
Old 08-26-2018, 10:20 AM   #3
ninikos
Member
 
Registered: Dec 2012
Posts: 57

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by TommyC7 View Post
What differentiates vms from virsh/libvirt?
Well, I am by no means expert on libvirt. First of all, vms is very small. The slackware package is around 10K. It also has minimal dependencies. Namely bash, qemu, socat, vde2, tigervnc. Being very simple and written in bash, it can be easily understood and customized.

The main utility vms supports a very simple interface.
Code:
$ vms
Usage:
vms create <vm_name> [vm_template]
vms list
vms info <vm_name>
vms status <vm_name>
vms start <vm_name>
vms kill <vm_name>
vms stop <vm_name> [timeout]
vms restart <vm_name> [timeout]
vms log <vm_name>
vms monitor <vm_name>
vms serial <vm_name>
vms vnc <vm_name>
vms uses a simple configuration file ~/.vms/vms.conf for configuring the virtual machines per user that declares one bash associative array for each virtual machine. Much simpler than dealing with XML configuration files that the managing tools are messing around with your edits. A complete working minimal vms.conf example would be like this.

Code:
#!/bin/bash

APATH=/path/to/storage

declare -A avm
avm[name]=avm
avm[uuid]='xxxxxxxx-ffff-ffff-ffff-ffffffffffff'
avm[arch]=x86_64
avm[mem]=2048
avm[smp]=2
avm[disk0]="$APATH/avm-disk0.img"
avm[bootcd]="$APATH/install-dvd.iso"
I started using a set of scripts based on alienbob's qemu and vde scripts. This was in 2012-2013. Back then, I wanted to run virtual machines with pci passthrough for graphics cards. IIRC I tried to do this with CentOS, ubuntu, debian, .. None of them could do it. The main problem was that specific kernels and packages where needed for this to work. That was one of the reasons I tried slackware and it is the only system I use now. I could only do pci passthrough with slackware64-14.0, only with the scripts and custom kernels. libvirt was giving me a lot of problems and pci passthrough was not working with it at the time. So, after a lot of copying and evolving those scripts, vms was created, at first as an easy fast way to create a virtual machine and manage a set of them in one file easily.

I will upload soon a 0.1.2 version that has some manpages, with some more examples and documentation how to use it.

Last edited by ninikos; 08-26-2018 at 10:22 AM. Reason: Typo in code
 
Old 08-26-2018, 12:08 PM   #4
ninikos
Member
 
Registered: Dec 2012
Posts: 57

Original Poster
Rep: Reputation: 30
I just uploaded another package, vms-0.1.2, it has man pages for vms and vms.conf. In there there are some more examples. See the first post for download link.
 
Old 08-26-2018, 05:16 PM   #5
slacksam
Member
 
Registered: Oct 2012
Location: Germany
Distribution: Slackware, Salix, Manjaro, Arch
Posts: 152

Rep: Reputation: 22
Thanks for sharing your scripts.

I installed vms-0.1.2-noarch-1did.tgz and read the man pages first. Then I created $HOME/.vms/vms.conf (file is attached) and ran "vms create vslack01" and got an error message that it can't find '/var/lib/vms/vm.sh'. I found '/var/lib/vms/vm.sh.new' instead, so I renamed it. When I started that command again, it complained that
Quote:
vslack01 already exists
But the directory $HOME/.vms/vslack01/ was empty so I copied the script manually with
Code:
cp /var/lib/vms/vm.sh $HOME/.vms/vslack01/vslack01.sh
The command "vms create vslack01" created a new array named vslack01 into vms.conf so I deleted it since I already created it before running that command.

Now when I do
Code:
vms start vslack01
I get the message
Code:
starting vslack01 ...qemu-system-x86_64: -device virtio-net-pci,netdev=nd1,mac=52:54:00:12:34:65: drive with bus=0, unit=0 (index=0) exists
 error!
qemu error 1
I tried to comment out the line which define the network interface in my vms.conf but then I got the same error message
Code:
starting vslack01 ...qemu-system-x86_64: -boot once=d: drive with bus=0, unit=0 (index=0) exists
 error!
qemu error 1
So I guess the settings in vms.conf are not the reason for the error message.

Any idea what else it could be?
Attached Files
File Type: txt vms.conf.txt (754 Bytes, 6 views)
 
Old 08-26-2018, 06:31 PM   #6
ninikos
Member
 
Registered: Dec 2012
Posts: 57

Original Poster
Rep: Reputation: 30
Thank you for testing

About /var/lib/vms/vm.sh.new, it is indeed a packaging issue, I forgot to add a line to doinst.sh, it will be ok with the next package.
The easiest way to start is by
Code:
$ vms create vmslack01
You do this or you create the files by hand like this and then add the first lines by hand in ~/.vms/vms.conf
Code:
mkdir ~/.vms/vmslack01/ 
cp /var/lib/vms/vm.sh ~/.vms/vmslack01/vmslack01.sh
I just tried your config. I created the image files, so I did not touch vslack01 config at all and it works just fine. Are you sure your .qcow2 and .iso files exist?

What qemu version are you using? I am using here 2.9.0. From the error message you get I think it tries to attach a disk device where another one is already attached. Can you try modifing the disk like this?

Code:
vslack01[disk0]="$VMSTORE/Slackware_14.2_avahi.qcow2,index=1"
or

Code:
vslack01[disk0]="$VMSTORE/Slackware_14.2_avahi,if=virtio"
Also, can you post the output of vms info vslack01 ?
 
Old 08-26-2018, 06:40 PM   #7
ninikos
Member
 
Registered: Dec 2012
Posts: 57

Original Poster
Rep: Reputation: 30
Also qemu monitor console is to be used like this

Code:
vslack01[monitor]=yes
and then you can attach to it using

Code:
vms monitor vslack01
 
Old 08-26-2018, 06:58 PM   #8
slacksam
Member
 
Registered: Oct 2012
Location: Germany
Distribution: Slackware, Salix, Manjaro, Arch
Posts: 152

Rep: Reputation: 22
Thanks for the quick reply.
Quote:
Originally Posted by ninikos View Post
What qemu version are you using?
Using Qemu version 2.12.0 here.

Adding
Code:
,index=1
or
Code:
,if=virtio
made no difference.

Quote:
Originally Posted by ninikos View Post
Also qemu monitor console is to be used like this

Code:
vslack01[monitor]=yes
and then you can attach to it using
This made it work.
Thanks!
 
Old 08-26-2018, 07:01 PM   #9
ninikos
Member
 
Registered: Dec 2012
Posts: 57

Original Poster
Rep: Reputation: 30
I have uploaded vms-0.1.2-noarch-2did.tgz package that fixes the /var/lib/vms/vm.sh related errors when using 'vms create vslack01'.
 
Old 08-27-2018, 10:42 AM   #10
ninikos
Member
 
Registered: Dec 2012
Posts: 57

Original Poster
Rep: Reputation: 30
I have uploaded vms-0.1.3-noarch-1did.tgz package.

It has better documentation. See the first post for links to the man pages. Install it like this

Code:
upgradepkg --install-new vms-0.1.3-noarch-1did.tgz
slackpkg new-config

Last edited by ninikos; 08-27-2018 at 12:34 PM.
 
Old 08-28-2018, 10:31 AM   #11
ninikos
Member
 
Registered: Dec 2012
Posts: 57

Original Poster
Rep: Reputation: 30
And here is another package for vms 0.2.0, get it there

vms-0.2.0-noarch-1did.tgz

There is a tutorial `man vms-tutorial` and updated man pages.
A new option is introduced 'vms conf' for editing ~/.vms/vms.conf.
Code:
vms create vm1
vms conf vm1 cpu host
cms conf vm1 kvm yes
cms conf mv1 mem 2048
vms conf vm1 disk0 '~/.vms/vm1/disk0.img'
vms conf vm1 disk1 '"$A_VARB_IN_VMS_CONF/another/disk1.img"'
vms conf vm1 extra0 "'-usb -device usb-mouse -k en_us'"
vms conf vm1 extra1 "'-device vfio-pci,host=04:00.0,romfile=gfx-card-bios.rom'"
 
Old 08-29-2018, 06:33 PM   #12
bifferos
Member
 
Registered: Jul 2009
Posts: 122

Rep: Reputation: 34
I think this would be better posted in the generic Linux forum. Granted it comes with Slackware packages but it won't be rocket science to get it working with other distros.

It reminds me of something I put together a while back: http://www.biffer.talktalk.net/PyQemu/?showpage=true. I can't believe that was 12 years ago... :-(
 
Old 08-30-2018, 08:32 AM   #13
ninikos
Member
 
Registered: Dec 2012
Posts: 57

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by bifferos View Post
I think this would be better posted in the generic Linux forum. Granted it comes with Slackware packages but it won't be rocket science to get it working with other distros.
Well, I think the vms command will work with very little effort. Some path adjustments maybe are needed for the init script. Even if I am using this for two years now, I haven't tested it with any other distributions. Maybe this will be an excuse to try nested kvm.

Quote:
Originally Posted by bifferos
It reminds me of something I put together a while back: http://www.biffer.talktalk.net/PyQemu/?showpage=true. I can't believe that was 12 years ago... :-(
I was very temped to write this in python. Python dictionaries are much more easy to work with than bash associative arrays. The main reasons that I left it in bash until now are that bash can be very easily customized and as it is, it has minimal dependencies.
 
Old 08-30-2018, 08:40 AM   #14
ninikos
Member
 
Registered: Dec 2012
Posts: 57

Original Poster
Rep: Reputation: 30
vms 0.2.1

I have uploaded vms-0.2.1-noarch-1did.tgz

It has many little fixes, some performance improvements, much more polished and tested examples and man pages and saner output to the user. I think this is the most polished version so far. If you tried any of the previous ones, please try again.

There is also a how to at https://docs.slackware.com/howtos:emulators:vms

Have fun

Last edited by ninikos; 08-30-2018 at 08:50 AM.
 
Old 08-30-2018, 11:40 AM   #15
hazel
Senior Member
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 2,870
Blog Entries: 7

Rep: Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501
Maybe you shouldn't have called it vms. There's an operating system called that (used to be used on DEC Vaxes).
 
2 members found this post helpful.
  


Reply

Tags
manage, qemu


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Does Slackware tell qemu/kvm virtual machines to shutdown? Altiris Slackware 6 08-26-2016 02:13 PM
How to run qemu Linux virtual machines properly on android tabs. rupeshforu3 Linux - Virtualization and Cloud 4 06-22-2014 10:05 PM
Single HDD shared between multiple machines (VMs) prushik Linux - Virtualization and Cloud 10 10-06-2011 11:55 AM
how to use ati graphics chipsets in qemu/other vms without driver in guest system lomix Linux - Hardware 4 04-17-2008 07:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration