Skip to content

Commit

Permalink
fix: Prevent mount point volid to change on host edit (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
Manisha15 authored Aug 2, 2024
1 parent 7c285cb commit c552fd2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/foreman_fog_proxmox/proxmox_volumes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def volume_exists?(vm, volume_attributes)
return false unless disk

# Return boolean if disk of type hard_disk, cloud_init, cdrom or rootfs(LXC container) exists
if disk.hard_disk? || disk.cloud_init? || disk.rootfs?
if disk.hard_disk? || disk.cloud_init? || disk.rootfs? || disk.mount_point?
volume_attributes['volid'].present?
elsif disk.cdrom?
volume_attributes['cdrom'].present?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class ProxmoxVmCommandsServerUpdateCdromTest < ActiveSupport::TestCase
disk.stubs(:hard_disk?).returns(false)
disk.stubs(:cdrom?).returns(true)
disk.stubs(:rootfs?).returns(false)
disk.stubs(:mount_point?).returns(false)
disks.stubs(:get).returns
config.stubs(:disks).returns(disks)
config.stubs(:attributes).returns(:cores => '')
Expand Down Expand Up @@ -95,6 +96,7 @@ class ProxmoxVmCommandsServerUpdateCdromTest < ActiveSupport::TestCase
disk.stubs(:hard_disk?).returns(false)
disk.stubs(:cdrom?).returns(true)
disk.stubs(:rootfs?).returns(false)
disk.stubs(:mount_point?).returns(false)
disk.stubs(:cloud_init?).returns(false)
disk.stubs(:storage).returns('local-lvm')
disk.stubs(:volid).returns('local-lvm:iso/ubuntu-20_4.iso')
Expand Down Expand Up @@ -148,6 +150,7 @@ class ProxmoxVmCommandsServerUpdateCdromTest < ActiveSupport::TestCase
disk.stubs(:hard_disk?).returns(false)
disk.stubs(:cdrom?).returns(true)
disk.stubs(:rootfs?).returns(false)
disk.stubs(:mount_point?).returns(false)
disk.stubs(:cloud_init?).returns(false)
disk.stubs(:storage).returns('local-lvm')
disk.stubs(:volid).returns('local-lvm:iso/ubuntu-20_4.iso')
Expand Down

0 comments on commit c552fd2

Please sign in to comment.