mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-02 03:22:59 +00:00
fix(vm): resize image once imported (#753)
fix(vm): Resize image once imported #737 Signed-off-by: dandalorinan <daniel_rees@web.de>
This commit is contained in:
parent
a4ac84a78c
commit
d16b8e1696
@ -2809,12 +2809,10 @@ func vmCreateCustomDisks(ctx context.Context, d *schema.ResourceData, m interfac
|
||||
fmt.Sprintf(`file_path_tmp="%s"`, filePathTmp),
|
||||
fmt.Sprintf(`vm_id="%d"`, vmID),
|
||||
`source_image=$(pvesm path "$file_id")`,
|
||||
`cp "$source_image" "$file_path_tmp"`,
|
||||
`qemu-img resize -f "$file_format" "$file_path_tmp" "${disk_size}G"`,
|
||||
`imported_disk="$(qm importdisk "$vm_id" "$file_path_tmp" "$datastore_id_target" -format $file_format | grep "unused0" | cut -d ":" -f 3 | cut -d "'" -f 1)"`,
|
||||
`imported_disk="$(qm importdisk "$vm_id" "$source_image" "$datastore_id_target" -format $file_format | grep "unused0" | cut -d ":" -f 3 | cut -d "'" -f 1)"`,
|
||||
`disk_id="${datastore_id_target}:$imported_disk${disk_options}"`,
|
||||
`qm set "$vm_id" "-${disk_interface}" "$disk_id"`,
|
||||
`rm -f "$file_path_tmp"`,
|
||||
`qm resize "$vm_id" "${disk_interface}" "${disk_size}G"`,
|
||||
)
|
||||
|
||||
importedDiskCount++
|
||||
|
Loading…
Reference in New Issue
Block a user