mirror of
https://github.com/YunoHost-Apps/garage_ynh.git
synced 2024-09-03 18:36:32 +02:00
fix wrong weight update
This commit is contained in:
parent
1828687c09
commit
4c76428026
2 changed files with 17 additions and 15 deletions
|
@ -17,5 +17,8 @@ then
|
|||
mkfs.ext4 /dev/nbd$i
|
||||
fi
|
||||
mkdir -p $datadir/data
|
||||
chown __APP__:__APP__ $datadir/data
|
||||
mount /dev/nbd$i $datadir/data/
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
|||
node_id=$(ynh_app_setting_get $app node_id)
|
||||
virtualisation=$(ynh_app_setting_get $app virtualisation)
|
||||
datadir=$(ynh_app_setting_get $app datadir)
|
||||
nbd_index=$(ynh_app_setting_get $app nbd_index)
|
||||
nbd_index=$(cat $datadir/nbd_index)
|
||||
command="$final_path/garage -c $final_path/garage.toml"
|
||||
|
||||
get__weight() {
|
||||
|
@ -28,26 +28,24 @@ get__weight() {
|
|||
set__weight() {
|
||||
if [ "$virtualisation" = "true" ]
|
||||
then
|
||||
systemctl stop $YNH_APP_INSTANCE_NAME
|
||||
old_weight="$ynh_app_setting_get --app=$app --key=weight"
|
||||
if [ $old_weight -le $weight }
|
||||
systemctl stop $app
|
||||
old_weight="$(ynh_app_setting_get --app=$app --key=weight)"
|
||||
if [ $old_weight -le $weight ]
|
||||
then
|
||||
$final_path/umount_disk.sh $nbd_index
|
||||
qemu-img resize $datadir/$datadir/garage_data.qcow2 $weightG
|
||||
qemu-nbd --connect /dev/nbd$nbd_index $datadir/garage.qcow2
|
||||
e2fsck -f /dev/nbd$nbd_index
|
||||
qemu-img resize $datadir/garage_data.qcow2 "$weight"G
|
||||
qemu-nbd --connect /dev/nbd$nbd_index $datadir/garage_data.qcow2
|
||||
e2fsck -f -y /dev/nbd$nbd_index
|
||||
resize2fs /dev/nbd$nbd_index
|
||||
mount /dev/nbd$nbd_index $datadir/data/
|
||||
qemu-nbd --disconnect /dev/nbd$nbd_index
|
||||
else
|
||||
umount /dev/nbd$nbd_index
|
||||
e2fsck -f /dev/nbd$nbd_index
|
||||
e2fsck -f -y /dev/nbd0
|
||||
resize2fs /dev/nbd$nbd_index $weightG
|
||||
qemu-nbd --disconnect /dev/nbd$nbd_index
|
||||
qemu-img resize $datadir/$datadir/garage_data.qcow2 $weightG
|
||||
$nbd_index=$(final_path/mount_disk.sh false)
|
||||
ynh_app_setting_set --app=$app --key=nbd_index --value=$nbd_index
|
||||
qemu-img resize --shrink $datadir/garage_data.qcow2 "$weight"G
|
||||
fi
|
||||
systemctl start $YNH_APP_INSTANCE_NAME
|
||||
$final_path/umount_disk.sh
|
||||
systemctl start $app
|
||||
sleep 3
|
||||
fi
|
||||
$command layout assign $node_id -c $weight 2>/dev/null
|
||||
apply_layout "$command"
|
||||
|
@ -55,6 +53,7 @@ set__weight() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
get__bootstrap_peers() {
|
||||
ynh_app_setting_get --app=$app --key=bootstrap_peers
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue