Skip to content
Snippets Groups Projects
Commit dae63cdf authored by Julien Allary's avatar Julien Allary
Browse files

dirty vm export function

parent 0f3a1612
No related branches found
No related tags found
No related merge requests found
...@@ -128,6 +128,33 @@ exportvm() { ...@@ -128,6 +128,33 @@ exportvm() {
echo -e "${CYAN}Files are available at ${VM_STORE_LOCAL}${NC}" echo -e "${CYAN}Files are available at ${VM_STORE_LOCAL}${NC}"
} }
exportvm_local(){
VM_STORE=/home/jallary/ubicast/TMP/ENVOI
VM_STORE_LOCAL=/home/
# depuis poste local
VBoxManage export ${VM_NAME} -o ${VM_STORE}/${VM_NAME}.ovf --ovf10
# generating vmware conf file
cp ${VM_STORE_LOCAL}/${VM_NAME}.ovf ${VM_STORE_LOCAL}/${VM_NAME}_vmware.ovf
sed -i "s@<vssd:VirtualSystemType>virtualbox-2.2</vssd:VirtualSystemType>@<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>@" ${VM_STORE_LOCAL}/${VM_NAME}_vmware.ovf
sed -i "s@<rasd:Caption>sataController0</rasd:Caption>@<rasd:Caption>SCSIController</rasd:Caption>@" ${VM_STORE_LOCAL}/${VM_NAME}_vmware.ovf
sed -i "s@<rasd:Description>SATA Controller</rasd:Description>@<rasd:Description>SCSIController</rasd:Description>@" ${VM_STORE_LOCAL}/${VM_NAME}_vmware.ovf
sed -i "s@<rasd:ElementName>sataController0</rasd:ElementName>@<rasd:ElementName>SCSIController</rasd:ElementName>@" ${VM_STORE_LOCAL}/${VM_NAME}_vmware.ovf
sed -i "s@<rasd:ResourceSubType>AHCI</rasd:ResourceSubType>@<rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>@" ${VM_STORE_LOCAL}/${VM_NAME}_vmware.ovf
sed -i "s@<rasd:ResourceType>20</rasd:ResourceType>@<rasd:ResourceType>6</rasd:ResourceType>@" ${VM_STORE_LOCAL}/${VM_NAME}_vmware.ovf
# recherche n° ligne paragraphe à supp.
LIG=$(grep -n '<rasd:AddressOnParent>3</rasd:AddressOnParent>' ${VM_STORE_LOCAL}/${VM_NAME}_vmware.ovf | awk -F ":" '{print$1}')
LIG0=$(( $LIG - 1 ))
LIG1=$(( $LIG0 + 9 ))
sed -i "${LIG0},${LIG1}d" ${VM_STORE_LOCAL}/${VM_NAME}_vmware.ovf
# converting disk to qemu image
qemu-img convert -c -O qcow2 ${VM_STORE_LOCAL}/${VM_NAME}-disk1.vmdk ${VM_STORE_LOCAL}/${VM_NAME}.qcow2
echo -e "${CYAN}Files are available at ${VM_STORE_LOCAL}${NC}"
}
case "$1" in case "$1" in
"ms") "ms")
init init
...@@ -183,6 +210,12 @@ case "$1" in ...@@ -183,6 +210,12 @@ case "$1" in
CONF=$(echo "$2") CONF=$(echo "$2")
exportvm exportvm
;; ;;
"exportvm_local")
VM_NAME=$(echo "$2")
exportvm_local
;;
*) *)
echo " echo "
...@@ -204,7 +237,9 @@ wrecette deploy wowza license key and run tests ...@@ -204,7 +237,9 @@ wrecette deploy wowza license key and run tests
After usage a log file will be generated under /root/$(date +%F)_envsetup.log After usage a log file will be generated under /root/$(date +%F)_envsetup.log
From admin machine : From admin machine :
Usage: $0 exportvm [conf_file] Usage: $0 exportvm
exportvm export VM" exportvm [conf_file] export VM from an hypervisor
exportvm_local [vm name] export VM from local vbox
"
;; ;;
esac esac
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment