[PVE-User] Upgrade 3.2 to 3.3

Michael Rasmussen mir at miras.org
Mon Sep 15 19:25:57 CEST 2014


On Mon, 15 Sep 2014 14:27:22 +0000
Joerg Hanebuth <Joerg at im-www.biz> wrote:

> Ty hector,
> 
> ill give a try tonight ;)
> 
If you need a quick way to migrate all running VMs and CTs away from a
node I have made this little script to do just that. Run without
options to see help.

# cat maintainance_mode.sh 
#!/bin/bash
if [ -z $1 ] ; then
 echo "usage: $0 <target-node> [offline]"
 echo "       Migrate all running CTs and VMs on local node to target
node." echo "       Online- (Live-)migration is default."
 echo "       In case live migration fails, please try offline mode."
 exit
fi

if [ ! -d /etc/pve/nodes/$1 ] ; then
 echo "Target node $1 does not exist!"
 exit 1
fi

ping -c 2 -W 2 $1 >/dev/null 2>&1
if [ $? != 0 ] ; then
 echo "node $1 is not reachable."
 exit 1
fi

if [ "x$2" == "xoffline" ] ; then
 OPT=""
else
 OPT="-online"
fi

for OVZ in $(pvectl list|grep running|awk '{print $1}'); do
  echo "Migrating OVZ: $OVZ to $1..."
  pvectl migrate $OVZ $1 $OPT
  echo "$OVZ done."
done

for KVM in $(qm list|grep running|awk '{print $1}'); do
  echo "Migrating KVM: $KVM to $1..."
  qm migrate $KVM $1 $OPT
  echo "$KVM done."
done


-- 
Hilsen/Regards
Michael Rasmussen

Get my public GnuPG keys:
michael <at> rasmussen <dot> cc
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xD3C9A00E
mir <at> datanom <dot> net
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE501F51C
mir <at> miras <dot> org
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE3E80917
--------------------------------------------------------------
/usr/games/fortune -es says:
<knghtbrd> it's too bad most ancient unices are y2k compliant
<|Rain|> too bad?
<|Rain|> why, because people won't upgrade until 2038?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://pve.proxmox.com/pipermail/pve-user/attachments/20140915/f04e48c9/attachment-0015.sig>


More information about the pve-user mailing list