proxmox: script pour console serie
This commit is contained in:
parent
f8fcb79a42
commit
6c0c602ea1
2 changed files with 55 additions and 5 deletions
55
gestion/virtualisation/connect-qm
Executable file
55
gestion/virtualisation/connect-qm
Executable file
|
@ -0,0 +1,55 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
VM_PATH=/etc/pve/qemu-server
|
||||||
|
PVE_PATH=/etc/pve
|
||||||
|
LOCAL_VM_PATH=/etc/pve/local/qemu-server
|
||||||
|
SERIAL_PATH=/var/run/qemu-server
|
||||||
|
|
||||||
|
if [[ ! -d /etc/pve ]]; then
|
||||||
|
echo "Not a proxmox server !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo "Please give vmid or pve name"
|
||||||
|
exit 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "`whoami`" != "root" ]]; then
|
||||||
|
echo "You must probably be root"
|
||||||
|
exit 42
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 != *[!0-9]* ]]; then
|
||||||
|
vmid=$1
|
||||||
|
else
|
||||||
|
echo "Looking for vmid of $1 ..."
|
||||||
|
for host in `ls $PVE_PATH/nodes`; do
|
||||||
|
p=$PVE_PATH/nodes/$host/qemu-server
|
||||||
|
for f in `ls $p`; do
|
||||||
|
grep "name: *$1" $p/$f -q && {
|
||||||
|
vmid=`echo $f | grep -o "[0-9]*"`
|
||||||
|
node=$host
|
||||||
|
echo "Found vmid $vmid"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
done
|
||||||
|
done
|
||||||
|
if [[ -z "$node" ]]; then
|
||||||
|
echo "vmid not found"
|
||||||
|
exit 2
|
||||||
|
elif [[ "$node" != "`hostname`" ]]; then
|
||||||
|
echo "Wrong node (go to $node)"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
|
||||||
|
device=$SERIAL_PATH/$vmid.serial
|
||||||
|
|
||||||
|
if [[ ! -S $device ]]; then
|
||||||
|
echo "$device missing (vm misconfigured or shutdown ?)"
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
|
||||||
|
minicom -D unix#$device "$@"
|
|
@ -1,5 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding:utf-8 -*-
|
|
||||||
#
|
|
||||||
# High level interface between XEN
|
|
||||||
# and XEN user
|
|
Loading…
Add table
Add a link
Reference in a new issue