下载OBS 脚本
[root@0003 data]# more motion.sh #!/bin/bash
path=s3://obs-jiutingtest/lyf
for i in $(cat /data/huaweilist);do name=$(awk 'NR==1' /data/huaweilist) cd /data/ && s3cmd get $path\/$name\/$nameflatvmdk
if [$?-eq0];then
echo"$(date +%Y%m%d_%H:%M:%S) download this vmdk successful:$name">>/data/download.log
sed-i '1d'/data/huaweilist
else
echo"$(date +%Y%m%d_%H:%M:%S) download this vmdk successful:$name">>/data/downloaderror.log
fi
转换kvm 格式 zvhd2 脚本
[root@0003 data]# more convert.sh
#!/bin/bash
path=s3://obs-jiutingtest/lyf
for i in$(ls /data2/over128G/);
do
name=$(ls /data2/over128G/ | head -1)
name1=$(ls /data2/over128G/ | head -1| sed -nr 's#\.vmdk#\.zvhd2#gp')
cd/root/ && ./qemu-img-hw convert-p-Ozvhd2 /data2/over128G/$name/data2/$name1
if[$?-eq0];then
echo"$(date +%Y%m%d_%H:%M:%S) convert this vmdk successful:$name1">>/upload/convert.log
#sed -i '1d' /data/huaweilist
#sed -i '1d' /data/huaweilist1
rm-rf/data2/over128G/$name
else
echo"$(date +%Y%m%d_%H:%M:%S) convert this vmdk failed:$name1">>/upload/converterror.log
fi
done
上传OBS脚本
[root@0003 data]# more upload.sh
#!/bin/bash
path=s3://obs-jiutingtest/lyf-NH/
foriin$(ls /data2/);
do
name=$(ls /data2/|head -1)
# s3cmd --recursive put /data2/vm1205/$name $path
# s3cmd --multipart-chunk-size-mb=50 put /data/over128G/$name $path
s3cmd put /data2/$name$path
if[$?-eq0];then
echo"$(date +%Y%m%d_%H:%M:%S) upload this zvhd2 successful:$name">>/upload/upload.log
#sed -i '1d' /upload/huaweilist
rm-rf/data2/$name
else
echo"$(date +%Y%m%d_%H:%M:%S) upload this zvhd2 failed:$name">>/upload/uploaderror.log
fi
done