Meilleure verbosité

This commit is contained in:
Adrien Bourmault 2022-05-22 00:45:46 +02:00 committed by admin666
parent a164e63937
commit 968688463a
1 changed files with 22 additions and 11 deletions

View File

@ -5,22 +5,33 @@ VMs=$(sudo virsh list --state-running --name | sort -R)
#sudo aa-teardown #sudo aa-teardown
for vm in $VMs for vm in $VMs
do do
echo BLOCKCOMMITTING $vm ... path_vda=$(sudo virsh domblklist $vm | grep vda | cut -d" " -f 8)
path_vdb=$(sudo virsh domblklist $vm | grep vdb | cut -d" " -f 8)
retour=$(sudo virsh blockcommit $vm vda --active --verbose --pivot --delete 2>&1 | tee /dev/tty) if [ ! -z "$path_vda" ]
if [[ "$retour" =~ 'block copy still active' ]]
then then
path_img=$(sudo virsh domblklist $vm | grep vda | cut -d" " -f 8) echo "-- BLOCKCOMMITTING $vm disk vda ..."
sudo virsh blockjob $vm $path_img --pivot --info retour=$(sudo virsh blockcommit $vm vda --active --verbose --pivot --delete 2>&1 | tee /dev/tty)
sudo virsh blockcommit $vm vda --active --verbose --pivot --delete 2>&1 if [[ "$retour" =~ 'block copy still active' ]]
then
echo "-- Finishing blockjob for $vm ..."
sudo virsh blockjob $vm $path_vda --pivot --info
echo "-- BLOCKCOMMITTING $vm ..."
sudo virsh blockcommit $vm vda --active --verbose --pivot --delete 2>&1
fi
fi fi
retour=$(sudo virsh blockcommit $vm vdb --active --verbose --pivot --delete 2>&1 | tee /dev/tty) if [ ! -z "$path_vdb" ]
if [[ "$retour" =~ 'block copy still active' ]]
then then
path_img=$(sudo virsh domblklist $vm | grep vdb | cut -d" " -f 8) echo "-- BLOCKCOMMITTING $vm disk vdb ..."
sudo virsh blockjob $vm $path_img --pivot --info retour=$(sudo virsh blockcommit $vm vdb --active --verbose --pivot --de>
sudo virsh blockcommit $vm vda --active --verbose --pivot --delete 2>&1 if [[ "$retour" =~ 'block copy still active' ]]
then
echo "-- Finishing blockjob for $vm ..."
sudo virsh blockjob $vm $path_vdb --pivot --info
echo "-- BLOCKCOMMITTING $vm ..."
sudo virsh blockcommit $vm vdb --active --verbose --pivot --delete >
fi
fi fi
done done
#sudo systemctl restart apparmor.service #sudo systemctl restart apparmor.service