mirror of
https://github.com/RGBCube/vmware-to-proxmox-migration-script
synced 2025-07-26 16:07:45 +00:00
added awareness to BIOS type
This commit is contained in:
parent
7f17348275
commit
4ac7290fe8
1 changed files with 22 additions and 19 deletions
|
@ -4,7 +4,7 @@
|
||||||
# - Find way to carry over MAC
|
# - Find way to carry over MAC
|
||||||
# - Attempt to find way to fix networking post-migration automatically
|
# - Attempt to find way to fix networking post-migration automatically
|
||||||
# - Get script to pull specs of ESXi VM and use them when creating Proxmox VM
|
# - Get script to pull specs of ESXi VM and use them when creating Proxmox VM
|
||||||
# - Add functionality to remove old .ova files from local machine
|
# - Omit creation of EFI disk upon confirmation of non-EFI BIOS
|
||||||
|
|
||||||
### PREREQUISITES ###
|
### PREREQUISITES ###
|
||||||
# - Install ovftool on the Proxmox host
|
# - Install ovftool on the Proxmox host
|
||||||
|
@ -17,6 +17,18 @@ get_input() {
|
||||||
echo ${input:-$2}
|
echo ${input:-$2}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to check the firmware type
|
||||||
|
check_firmware_type() {
|
||||||
|
local vmx_path="/vmfs/volumes/datastore/${VM_NAME}/${VM_NAME}.vmx"
|
||||||
|
local firmware_type=$(ssh ${ESXI_USERNAME}@${ESXI_SERVER} "grep 'firmware =' ${vmx_path}")
|
||||||
|
|
||||||
|
if [[ $firmware_type == *"efi"* ]]; then
|
||||||
|
echo "uefi"
|
||||||
|
else
|
||||||
|
echo "seabios"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Check if ovftool is installed
|
# Check if ovftool is installed
|
||||||
if ! ovftool --version &> /dev/null; then
|
if ! ovftool --version &> /dev/null; then
|
||||||
echo "Error: ovftool is not installed or not found in PATH. Please install ovftool and try again."
|
echo "Error: ovftool is not installed or not found in PATH. Please install ovftool and try again."
|
||||||
|
@ -31,7 +43,7 @@ fi
|
||||||
|
|
||||||
# Check if libguestfs-tools is installed
|
# Check if libguestfs-tools is installed
|
||||||
if ! virt-customize --version &> /dev/null; then
|
if ! virt-customize --version &> /dev/null; then
|
||||||
echo "Error: virtu-customize is not installed or not found in PATH. Please install libguestfs-tools and try again"
|
echo "Error: virt-customize is not installed or not found in PATH. Please install libguestfs-tools and try again."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -73,7 +85,6 @@ function export_vmware_vm() {
|
||||||
echo $ESXI_PASSWORD | ovftool --sourceType=VI --acceptAllEulas --noSSLVerify --skipManifestCheck --diskMode=thin --name=$VM_NAME vi://$ESXI_USERNAME@$ESXI_SERVER/$VM_NAME $ova_file
|
echo $ESXI_PASSWORD | ovftool --sourceType=VI --acceptAllEulas --noSSLVerify --skipManifestCheck --diskMode=thin --name=$VM_NAME vi://$ESXI_USERNAME@$ESXI_SERVER/$VM_NAME $ova_file
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create VM in Proxmox and attach the disk
|
|
||||||
function create_proxmox_vm() {
|
function create_proxmox_vm() {
|
||||||
|
|
||||||
# Extract OVF from OVA
|
# Extract OVF from OVA
|
||||||
|
@ -114,10 +125,12 @@ function create_proxmox_vm() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create the VM with UEFI BIOS, VLAN tag, and specify the SCSI hardware
|
# Check the firmware type
|
||||||
echo "Creating VM in Proxmox with UEFI, VLAN tag, and SCSI hardware..."
|
FIRMWARE_TYPE=$(check_firmware_type)
|
||||||
echo "VM ID is: $VM_ID"
|
|
||||||
qm create $VM_ID --name $VM_NAME --memory 2048 --cores 2 --net0 virtio,bridge=vmbr69,tag=$VLAN_TAG --bios ovmf --scsihw virtio-scsi-pci
|
# Create the VM with the correct BIOS type
|
||||||
|
echo "Creating VM in Proxmox with $FIRMWARE_TYPE firmware, VLAN tag, and SCSI hardware..."
|
||||||
|
qm create $VM_ID --name $VM_NAME --memory 2048 --cores 2 --net0 virtio,bridge=vmbr69,tag=$VLAN_TAG --bios $FIRMWARE_TYPE --scsihw virtio-scsi-pci
|
||||||
|
|
||||||
echo "Enabling QEMU Guest Agent..."
|
echo "Enabling QEMU Guest Agent..."
|
||||||
qm set $VM_ID --agent 1
|
qm set $VM_ID --agent 1
|
||||||
|
@ -160,18 +173,8 @@ function add_efi_disk_to_vm() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Migration completed"
|
|
||||||
echo ""
|
|
||||||
echo "You will likely need to update your network interace name on the VM. This can be done by"
|
|
||||||
echo "running ip ad to grab the new interface name and then updating what is stored in /etc/netplan/00-installer-config.yaml"
|
|
||||||
|
|
||||||
#function update_netplan_config() {
|
|
||||||
#
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Main process
|
# Main process
|
||||||
export_vmware_vm
|
export_vmware_vm
|
||||||
create_proxmox_vm
|
create_proxmox_vm
|
||||||
cleanup_migration_directory
|
cleanup_migration_directory
|
||||||
add_efi_disk_to_vm
|
add_efi_disk_to_vm
|
||||||
#update_netplan_config
|
|
Loading…
Add table
Add a link
Reference in a new issue