mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-04 21:14:05 +00:00
fix(vm): set FileVolume for disks with file_id (#635)
Disks imported using `file_id` argument do not have FileVolume set, that makes PathInDatastore return an empty string, which makes IsOwnedBy return fales for any vm id. The end result is the inability to resize imported disks, this fixes it. Signed-off-by: Oto Petřík <oto.petrik@gmail.com> Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
parent
6753582e4b
commit
d1d7bd39c7
@ -3053,17 +3053,17 @@ func vmGetDiskDeviceObjects(
|
||||
}
|
||||
if fileID != "" {
|
||||
diskDevice.Enabled = false
|
||||
} else {
|
||||
if pathInDatastore != "" {
|
||||
if datastoreID != "" {
|
||||
diskDevice.FileVolume = fmt.Sprintf("%s:%s", datastoreID, pathInDatastore)
|
||||
} else {
|
||||
// FileVolume is absolute path in the host filesystem
|
||||
diskDevice.FileVolume = pathInDatastore
|
||||
}
|
||||
}
|
||||
|
||||
if pathInDatastore != "" {
|
||||
if datastoreID != "" {
|
||||
diskDevice.FileVolume = fmt.Sprintf("%s:%s", datastoreID, pathInDatastore)
|
||||
} else {
|
||||
diskDevice.FileVolume = fmt.Sprintf("%s:%d", datastoreID, size)
|
||||
// FileVolume is absolute path in the host filesystem
|
||||
diskDevice.FileVolume = pathInDatastore
|
||||
}
|
||||
} else {
|
||||
diskDevice.FileVolume = fmt.Sprintf("%s:%d", datastoreID, size)
|
||||
}
|
||||
|
||||
diskDevice.ID = &datastoreID
|
||||
|
Loading…
Reference in New Issue
Block a user