diff --git a/app/models/foreman_fog_proxmox/proxmox_volumes.rb b/app/models/foreman_fog_proxmox/proxmox_volumes.rb index a6ff69b81..5ad76bbcf 100644 --- a/app/models/foreman_fog_proxmox/proxmox_volumes.rb +++ b/app/models/foreman_fog_proxmox/proxmox_volumes.rb @@ -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? diff --git a/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_cdrom_test.rb b/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_cdrom_test.rb index 163afacae..c54e42ab3 100644 --- a/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_cdrom_test.rb +++ b/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_cdrom_test.rb @@ -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 => '') @@ -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') @@ -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')