Bug 1390517 - Hot-adding disk to an VM in RHV provider does not activate it
Summary: Hot-adding disk to an VM in RHV provider does not activate it
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: 5.7.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: GA
: 5.8.0
Assignee: Juan Hernández
QA Contact: Mike Foley
URL:
Whiteboard: rhev
Depends On:
Blocks: 1393939
TreeView+ depends on / blocked
 
Reported: 2016-11-01 09:47 UTC by Prasad Mukhedkar
Modified: 2017-09-14 17:12 UTC (History)
9 users (show)

Fixed In Version: 5.8.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1393939 (view as bug list)
Environment:
Last Closed: 2017-06-12 16:42:30 UTC
Category: ---
Cloudforms Team: RHEVM
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Prasad Mukhedkar 2016-11-01 09:47:40 UTC
Description of problem:

Support for adding and removing disks from virtual machines is 
added 4.2 (5.7), For rhv provider, You can add a disk to a powered 
on vm. If you do this via cloudforms the disk is not activated after
it is created and there is no way to activate it. You end up having
to go into the RHEV UI and activating it manually.

Version-Release number of selected component (if applicable):

5.7.0.3.20160927165516_075d0f3 

How reproducible:
Always


Steps to Reproduce:

1.Navigate to Infrastructure -> Virtual Machines->Select VM 
2.Click "Reconfigure Virtual Machine" from Configuration tab.
3. Add new disk.

Actual results:

Disk is added, but it is not activated and there is no way to activate it

Expected results:

It would be nice to get the disk activated by default or a radio button 
provided to user to decided whether they he wants disk in active state 
or not. 



Additional info:

Passing following with the disk creation request should get the
disk activated. 
<active>true</active>

Comment 2 Oved Ourfali 2016-11-09 07:59:41 UTC
Juan - does the option to activate appear in the ruby SDK?
I think it exists in the python one.

Comment 3 Juan Hernández 2016-11-09 16:19:45 UTC
The option to activate the disk is an attribute of the DiskAttachment type:

  http://www.rubydoc.info/gems/ovirt-engine-sdk/OvirtSDK4/DiskAttachment#active-instance_method

Apparently the backend automatically activates the disk when the virtual machine is down, but not when the virtual machine is up. This should probably be fixed in the engine, or in the documentation of the API. Meanwhile it can be solved in ManageIQ as follows:

diff --git a/app/models/manageiq/providers/redhat/infra_manager.rb b/app/models/manageiq/providers/redhat/infra_manager.rb
index 6e20e69..c584db3 100644
--- a/app/models/manageiq/providers/redhat/infra_manager.rb
+++ b/app/models/manageiq/providers/redhat/infra_manager.rb
@@ -106,6 +106,7 @@ class ManageIQ::Providers::Redhat::InfraManager < ManageIQ::Providers::InfraMana
     {
       :bootable  => disk_spec["bootable"],
       :interface => "VIRTIO",
+      :active    => true,
       :disk      => {
         :provisioned_size => disk_spec["disk_size_in_mb"].to_i * 1024 * 1024,
         :sparse           => disk_spec["thin_provisioned"],

That will activate the disk regardless of the status of the virtual machine. I have submitted the following pull request containing that change:

Comment 4 Juan Hernández 2016-11-09 16:50:32 UTC
Forgot to include the reference to the pull request:

  Explicitly activate disks added to oVirt VMs
  https://github.com/ManageIQ/manageiq/pull/12532

Comment 6 Ilanit Stein 2017-05-03 15:09:17 UTC
Verified on CFME-5.8.0.13 & RHV-4.1.1.8

Disk added is activated as well.

Comment 7 Ian Tewksbury 2017-09-14 17:12:38 UTC
When I do the following the disk still gets added deactivated, but using the UI it gets added activated. This a bug, or just me being an idiot?

```
    vm.add_disk(
      nil, # API want's this to be nil, why it asks for it is unknown....
      size_mb,
      {
        :thinProvisioned => thin_provisioned,
        :dependent       => dependent,
        :persistent      => persistent,
        :bootable        => bootable
      }
    )
```


Note You need to log in before you can comment on or make changes to this bug.