ryran / valine Goto Github PK
View Code? Open in Web Editor NEWEasy qcow & LVM snapshot management of libvirt guests with intelligent tab-completion
License: GNU General Public License v3.0
Easy qcow & LVM snapshot management of libvirt guests with intelligent tab-completion
License: GNU General Public License v3.0
When running valine
with no args, we've always inserted a blank line in between each VM ... Now that I'm seeing valine
run on machines with more than a few VMs, well ... it really wastes space. Time to fix.
Hi
I found this script could be very useful and decied to try it on my env.
I downloaded your code and started to do simple things like
./valine DOMAIN {console|loop-ssh}
on my xen 4.2 env and i get error that vm not reconised :
[root@xen valine-master]# virsh list
Id Name State
----------------------------------------------------
0 Domain-0 running
6 informix-21-222_4 idle
[root@xen valine-master]# ./valine informix-21-222_4 console
Error: DOMAIN 'informix-21-222_4' not recognized
Available domains:
[root@xen valine-master]#
I couldn't find reason why it got this error and also why there is no output after Available domain:
Keep good work.
Best Regards
Kenan
network interface, that is.
Not sure if I should use the same name as virsh
or come up with something else
I literally forgot about virt-top
... haven't touched it in a couple years. It's too awesome not to use.
/etc/valine
directory for you YIKES/usr/bin/valine: line 313: /etc/valine/rhel65: No such file or directory
/usr/bin/valine: line 333: /etc/valine/rhel65: No such file or directory
/usr/bin/valine: line 333: /etc/valine/rhel65: No such file or directory
awk: fatal: cannot open file `/etc/valine/rhel65' for reading (No such file or directory)
Warning: rhel65 config file has improper CfgVersion ('0Sifr' expected)
Storage displayed for this domain might not be accurate
If this causes problems, delete /etc/valine/rhel65
awk: cmd. line:2: fatal: cannot open file `/etc/valine/rhel65' for reading (No such file or directory)
/var/lib
instead of /etc
/usr/sbin/lvm
printed in the main output, i.e.:──────────────┬───┬─────────┬───────────────────────────────────────────
DOMAIN │ ⚡ │ STORAGE │ SNAPSHOTS
──────────────┼───┼─────────┼───────────────────────────────────────────
r72 │ ◌ │ qcow2 │ /var/lib/upvm/r72.qcow2
│ │ │ └─pristine
│ │ │ └─webdb
│ │ │ └─reg-updated ←
/usr/sbin/lvm
rhel65 │ ◌ │ lvm │ /dev/jiop/rhel65
│ │ │ └─rhel65-snap0 ←
tae511 │ ◌ │ qcow2 │ /var/lib/libvirt/images/tae511.qcow2 ←
sudo lvm
, you get weird corrupted output even if there's already a generated configfile for that vm:────────┬───┬─────────┬───────────────────────────────────────────
DOMAIN │ ⚡ │ STORAGE │ SNAPSHOTS
────────┼───┼─────────┼───────────────────────────────────────────
tae66 │ ◉ │ qcow2 │ /var/lib/upvm/tae66.qcow2 ←
tae72 │ ◉ │ qcow2 │ /var/lib/upvm/tae72.qcow2 ←
r49 │ ◌ │ qcow2 │ /var/lib/upvm/r49.qcow2
│ │ │ └─pristine ←
r511 │ ◌ │ qcow2 │ /var/lib/upvm/r511.qcow2
│ │ │ └─pristine ←
r65 │ ◌ │ qcow2 │ /var/lib/upvm/r65.qcow2
│ │ │ └─pristine
│ │ │ └─httpd ←
r67 │ ◌ │ qcow2 │ /var/lib/upvm/r67.qcow2
│ │ │ └─pristine
│ │ │ └─webdb
│ │ │ └─reg-updated ←
r71 │ ◌ │ qcow2 │ /var/lib/upvm/r71.qcow2 ←
r72 │ ◌ │ qcow2 │ /var/lib/upvm/r72.qcow2
│ │ │ └─pristine
│ │ │ └─webdb
│ │ │ └─reg-updated ←
Error: Not root and this user doesn't have required sudo access to 'lvm' command
Consdier running as root:
──echo─'junkbob─ALL=(ALL)─NOPASSWD:─/usr/sbin/lvm'─>>/etc/sudoers.d/junkbob-lvm──────────────────────────────────────────
Not sure about what to call it but attach-disk
is already in virsh
I.e., only run start
against VMs that are off and only run shutdown
, destroy
, hibernate
against VMs that are on.
corresponding with virsh send-key
for sending keystrokes
This could be used to send sysrq or ctrl-alt-del ... I dunno.
yep.
Sourcing /etc/bash_completion.d/valine-bash-completion.bash
with zsh works, but it's not loaded automatically.
E.g.:
start
if VM is offrevert-snap
& Delete-snap
if VM has snapshotsconsole
, Shutdown
, destroy
, hibernate
if VM is runningChange-media
if VM has cdromcorresponding with virsh
cmd of same name for changing ISO in CD drive
This would correspond with virsh reset
... unfortunately I think it would be too confusing to have reset
be the command for this since valine is all about snapshots. I dunno ... thoughts?
If we're going to be changing the attached iso, we should also be able to see the current one .... among other things.
Why did I use K
anyway? Kill? I dunno. It doesn't make sense.
Or maybe consolidate those 2 virsh commands into one.
Looks like all of the errors I receive when using valine without escalated privileges are related to the images being 'raw image' rather than a 'qcow2'.
When I invoke valine with sudo, I do not hit this issue, currently.
See below:
# valine
qemu-img: Could not open '/home/data/virts/images/rhel4.5.qcow2': Could not open '/home/data/virts/images/rhel4.5.qcow2': Permission denied
qemu-img: Could not open '/home/data/virts/images/rhel5.10.qcow2': Could not open '/home/data/virts/images/rhel5.10.qcow2': Permission denied
qemu-img: Could not open '/home/data/virts/images/rhel5.11.qcow2': Could not open '/home/data/virts/images/rhel5.11.qcow2': Permission denied
qemu-img: Could not open '/home/data/virts/images/rhel6.5.qcow2': Could not open '/home/data/virts/images/rhel6.5.qcow2': Permission denied
qemu-img: Could not open '/home/data/virts/images/rhel6.6.qcow2': Could not open '/home/data/virts/images/rhel6.6.qcow2': Permission denied
qemu-img: Could not open '/home/data/virts/images/rhel7.0.qcow2': Could not open '/home/data/virts/images/rhel7.0.qcow2': Permission denied
───────────────────────────┬───┬────────────┬───────────────────────────────────────────
DOMAIN │ ⚡ │ STORAGE │ SNAPSHOTS
───────────────────────────┼───┼────────────┼───────────────────────────────────────────
r71 │ ◌ │ qcow2 │ /home/data/virts/images/r71.qcow2 ←
│ │ │
r72 │ ◌ │ qcow2 │ /home/data/virts/images/r72.qcow2 ←
│ │ │
rhel4.5-ss │ ◌ │ raw image │ /home/data/virts/images/rhel4.5.qcow2 ←
│ │ │
rhel5.10 │ ◌ │ raw image │ /home/data/virts/images/rhel5.10.qcow2 ←
│ │ │
rhel5.10-sat6 │ ◌ │ qcow2 │ /home/data/virts/images/rhel5.10-sat6.qcow2
│ │ │ └─5.10 ─no release set
│ │ │
rhel5.11 │ ◌ │ raw image │ /home/data/virts/images/rhel5.11.qcow2 ←
│ │ │
rhel5.11-sat6 │ ◌ │ qcow2 │ /home/data/virts/images/rhel5.11-sat6.qcow2 ←
│ │ │
rhel5.5 │ ◌ │ qcow2 │ /home/data/virts/images/rhel5.5.qcow2 ←
│ │ │
rhel6.5 │ ◌ │ raw image │ /home/data/virts/images/rhel6.5.qcow2 ←
│ │ │
rhel6.5-sat6 │ ◌ │ qcow2 │ /home/data/virts/images/rhel6.5-sat6.qcow2 ←
│ │ │
rhel6.6 │ ◌ │ raw image │ /home/data/virts/images/rhel6.6.qcow2 ←
When running valine on a Fedora25 for the first time, I receive, one per each VM in my libvirt:
./valine/valine: riga 330: /var/lib/valine/centos7-prometheus: No such file or directory
./valine/valine: riga 350: /var/lib/valine/centos7-prometheus: No such file or directory
Warning: centos7-prometheus config file has improper CfgVersion ('0Sifr' expected)
Storage displayed for this domain might not be accurate
If this causes problems, delete /var/lib/valine/centos7-prometheus
The error is triggered by the lack of /var/lib/valine , problem is that user do not receive the expected message:
mkdir: impossibile creare la directory "/var/lib/valine": Permission denied
Error: Missing [and unable to create] needed directory '/var/lib/valine'
As root, execute:
mkdir -pm 2775 /var/lib/valine; chgrp libvirt /var/lib/valine
due to some bash substring mistake.
In attach lvm config and debug output.
What if we moved all the multiline snapshot details from the main valine
output and into the per-VM output (e.g., valine SOMEVM
) ...?
We could then keep the main valine
output to 1 line for each VM ... and we could add mem/cpu limit details -- maybe even including virt-top
percentages as mentioned in another issue. I'd love to get some feedback from people on this.
Hi
Me again :)
Is there something i missing in versions you use for bash/libvirt or there is something incomplete in code.
Just start valine gives me this :
[root@xen2 ~]# valine
column: invalid option -- 'o'
usage: column [-tx] [-c columns] [file ...]
Key:
• Each domain's current storage is marked with a green arrow: ←
• Storage which is revertable & Deletable is displayed in cyan
[root@xen2 ~]#
I found that column version column i use is util-linux-ng-2.17.2-12.14.el6.x86_64 and there is no option -o. I tried to put to -c insted -o
[root@xen2 ~]# diff myversion.sh bin/valine
570c570
< column -t -s "❚" -c " │ " |
---
> column -t -s "❚" -o " │ " |
and i got this output :
./1.sh: line 319: /var/lib/valine/informix-21-222_4: No such file or directory
./1.sh: line 339: /var/lib/valine/informix-21-222_4: No such file or directory
Warning: informix-21-222_4 config file has improper CfgVersion ('0Sifr' expected)
Storage displayed for this domain might not be accurate
If this causes problems, delete /var/lib/valine/informix-21-222_4
─DOMAIN──────────────⚡──STORAGE───SNAPSHOTS──────────────────────────────────────────
Domain-0 ◉ unknown ←
─informix-21-222_4───◉──lvm───────/dev/vmspace/informix-21-222_4─←──────────────────────────────────────────
─privremeno──────────◌──unknown───/backup/systemrescuecd-x86-4.2.0.iso─←──────────────────────────────────────────
Key:
• Each domain's current storage is marked with a green arrow: ←
• Storage which is revertable & Deletable is displayed in cyan
Am i doing something wrong or missing prerequisites list somewhere. How to make files /var/lib/valine/* and are they required.
Best Regards
Kenan
Not sure about the name, but of course the goal would be to launch virt-viewer for you.
I'm leaning toward yes. E.g., mockup:
─────────┬───┬──────────────┬───────┬─────────┬───────────────────────────────────────────
DOMAIN │ ⚡ │ MEMORY │ VCPU │ STORAGE │ SNAPSHOTS
─────────┼───┼──────────────┼───────┼─────────┼───────────────────────────────────────────
r67 │ ◉ │ 2048M │ 2 │ qcow2 │ /var/lib/upvm/r67.qcow2
│ │ │ │ │ └─pristine
│ │ │ │ │ └─webdb
│ │ │ │ │ └─reg-updated ←
r72 │ ◉ │ 512M / 2048M │ 1 / 2 │ qcow2 │ /var/lib/upvm/r72.qcow2
│ │ │ │ │ └─pristine ←
│ │ │ │ │ └─webdb
│ │ │ │ │ └─reg-updated
r511 │ ◉ │ 512M / 2048M │ 1 / 2 │ qcow2 │ /var/lib/upvm/r511.qcow2
│ │ │ │ │ └─pristine ←
r49 │ ◌ │ 1024M │ 1 │ qcow2 │ /var/lib/upvm/r49.qcow2
│ │ │ │ │ └─pristine ←
r65 │ ◌ │ 512M / 2048M │ 1 / 2 │ qcow2 │ /var/lib/upvm/r65.qcow2
│ │ │ │ │ └─pristine
│ │ │ │ │ └─httpd ←
r71 │ ◌ │ 512M / 2048M │ 1 / 2 │ qcow2 │ /var/lib/upvm/r71.qcow2 ←
rhel65 │ ◌ │ 1024M │ 1 │ lvm │ /dev/jiop/rhel65
│ │ │ │ │ └─rhel65-snap0 ←
tae511 │ ◌ │ 1024M │ 1 │ qcow2 │ /var/lib/libvirt/images/tae511.qcow2 ←
tae66 │ ◌ │ 1024M │ 1 │ qcow2 │ /var/lib/upvm/tae66.qcow2 ←
tae67 │ ◌ │ 1024M │ 1 │ qcow2 │ /var/lib/libvirt/images/tae67.qcow2 ←
z72 │ ◌ │ 1024M │ 1 │ qcow2 │ /var/lib/upvm/z72.qcow2
│ │ │ │ │ └─teamd ←
─────────┴───┴──────────────┴───────┴ ────────┴───────────────────────────────────────────
If I do that, then do I need to also integrate NICs and other non-snapshot disks? Probably won't but still ...
One annoying thing about until ssh HOST; sleep 2; done
is that sometimes shutting down a VM will result in the ssh connection being disconnected such that ssh
quits with non-zero exit code.
We could save unixtime on each iteration of the loop and break the loop if it's been more than 60sec (or slt) since the last iteration.
I think this should be added as a note in the README. When running valine I received the following error message:
root@helios:~# v
column: invalid option -- 'o'
usage: column [-tx] [-c columns] [-s sep] [file ...]
Key:
• Each domain's current storage is marked with a green arrow: ←
• Storage which is revertable & Deletable is displayed in cyan
I'm running Debian 9.
I fixed this by downloading the latest util-linux (at the time of writing it was this - https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.34/ ). Compile then editing .bashrc to include the path to the compiled binaries.
Now it works great:
root@helios:~# v
──────────────────┬────┬──────────┬───────────────────────────────────────────
DOMAIN │ ⚡ │ STORAGE │ SNAPSHOTS
──────────────────┼────┼──────────┼───────────────────────────────────────────
pilot │ ◉ │ qcow2 │ /var/lib/libvirt/images/pilot.before-resize-clone.qcow2 ←
fusionpbx │ ◉ │ qcow2 │ /var/lib/libvirt/images/fusionpbx.qcow2
│ │ │ └─snapshot-beforeupgrade ←
...
I should probably switch to CentOS at some point but 🤷♀
yep
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.