Bug 1311221 - CFME VMware_HotAdd_Disk isn't working
CFME VMware_HotAdd_Disk isn't working
Status: CLOSED ERRATA
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate (Show other bugs)
5.5.0
Unspecified Unspecified
high Severity high
: GA
: 5.6.0
Assigned To: Drew Bomhof
Milan Falešník
vmware:automate:retest
: ZStream
Depends On:
Blocks: 1312076
  Show dependency treegraph
 
Reported: 2016-02-23 11:02 EST by Martin Welk
Modified: 2016-08-10 10:48 EDT (History)
15 users (show)

See Also:
Fixed In Version: 5.6.0.1
Doc Type: Bug Fix
Doc Text:
In the previous version of CloudForms Management Engine, there was a regex parsing issue that broke the Vmware_HotAdd_Disk . Vmware_HotAdd_Disk. The action registered the following error in the vim.log: “addDisk: no SCSI controller found". This fix checks for a specific xsiType when adding a disk to a VMware instance. Previously, when hot adding a disk we were using a regex to find the appropriate SCSI controller. This change validates the xsiType as being the correct type and removes the regex. This will remove the problems the regex created with different localizations.
Story Points: ---
Clone Of:
: 1312076 (view as bug list)
Environment:
Last Closed: 2016-06-29 11:38:55 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
mfalesni: automate_bug+


Attachments (Terms of Use)

  None (edit)
Description Martin Welk 2016-02-23 11:02:19 EST
Description of problem:
Standard method in /RedHat/Integration/VMware has several reproducible bugs.

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

How reproducible:
100%

Steps to Reproduce:
1. Create a copy of /RedHat/Integration/VMware/VimApi/VMware_HotAdd_Disk to custom name space
2. Create a button to be used for a VM
3. Create a service dialog that asks for the disk size ("size")
4. Try to use the button to add a disk.

Actual results:

1. Nothing happens. Action ends with "addDisk: no SCSI controller found" in the vim.log after raising log level to debug. Reason: wrong pattern matching in the script, at least, for a VMware vCenter talking german language. I suspect, it's SCSI-Controller (SCSI-dash-Controller) in german language. See #1130060, explained that there. If it's a national language setting, I'd suggest to normalize all API calls to one language in general.

2. Disk is added, but as independent-persistent. In /var/www/miq/vmdb/gems/pending/VMwareWebService/MiqVimVm.rb the method addDisk removes all keys in the options hash that have no value. While they should have a value of "true", they vanish on the way, the addDisk method just sees "nil" values and therefore removes the keys.

Expected results:
Disk is added with the parameters specified in the method.

Additional info:
Comment 2 Greg McCullough 2016-02-25 09:23:52 EST
See additional comments here https://bugzilla.redhat.com/show_bug.cgi?id=1130060#c3
Comment 3 Dave Johnson 2016-02-25 17:02:36 EST
Milan, can you figure out if test automation missed this please.
Comment 5 Greg McCullough 2016-03-07 13:04:15 EST
This ticket is reporting two different issues:

1. The add_disk logic does not work which this ticket suggests could be related to a regex parsing issue.  We will address that issue using this ticket.

2. The enhancement to pass along additional values as part of the add_disk method.  This is an enhancement because the code currently only passes disk_name and disk_size as part of the call.

https://github.com/ManageIQ/manageiq/blob/master/lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-vmware-infra_manager-vm.rb#L11

I am re-opening bug 1130060 (mentioned in description and comment #2) to address this enhancement.
Comment 6 Drew Bomhof 2016-03-15 11:15:18 EDT
Hi Martin,

We've been looking into this issue and have a question.

Per - https://bugzilla.redhat.com/show_bug.cgi?id=1130060#c3 - Is there anyway you could get a screen shot of the hardware edit screen showing the SCSI controller label - 'SCSI-Controller'?

We're looking at making the change to allow a '-' in the regex - but we've been unable to find a version of the label that includes a '-'.  We wanted to make sure that we're not missing additional characters in the label with a specific regex change - while not opening the regex too much with a .* change.

Thanks so much!

~Drew
Comment 7 Martin Welk 2016-03-17 08:10:08 EDT
Drew,

I just logged on to the customer environment, but only to their development environment. They moved to the vCenter appliance version 6.0 now, and in the vSphere Web (!) Client, I see things totally different.

It says SCSI Adapters -> SCSI controller 0 (LSI Logic SAS), for example, when I edit the hardware of a VM.

I debugged /var/www/miq/vmdb/gems/pending/VMwareWebService/MiqVimVm.rb on-site, added some debug output, and it was clearly visible, that we got "SCSI-Controller" back from the vCenter API: in getScsiCandU, I logged the output of the label value in this block:

def getScsiCandU
    devs = getProp("config.hardware")["config"]["hardware"]["device"]
    ctrlrHash = {}
    devs.each do |dev|
      next unless (key = dev["key"])
      next unless dev["deviceInfo"]
      next unless (label = dev["deviceInfo"]["label"])
      ctrlrHash[key] = 0 if label =~ /^SCSI\s[Cc]ontroller\s.*$/
    end

The value of label was definitely "SCSI-Controller", and in the native Windows vCenter client it is shown as that, but I cannot provide that information right now, the responsible person is on a training this week.

I patched the regex to ^SCSI[\s-][Cc]ontroller\s.*$ to see if I run into other issues: ^SCSI-[Cc]ontroller\s.*$ - that works, but of course, this breaks the original format.

Personal comment: I think we shouldn't rely on a format of a probably-localized string. Isn't there some numeric value that we can match against? Or, can we at least enforce one definitive language while talking to the vCenter, before we run into similar troubles with other localizations? I found https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2121646, it seems there is functionality to set a particular language when opening a session through the API. 

Regards,

Martin
Comment 9 CFME Bot 2016-04-12 13:05:59 EDT
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/73a521788e2cd3ffa46a561c6f41f794e3267446

commit 73a521788e2cd3ffa46a561c6f41f794e3267446
Author:     Drew Bomhof <dbomhof@redhat.com>
AuthorDate: Mon Mar 28 16:39:33 2016 -0400
Commit:     Drew Bomhof <dbomhof@redhat.com>
CommitDate: Tue Apr 12 11:44:00 2016 -0400

    Check for a specific xsiType when adding a disk to a VMware instance
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1311221
    
    When hot adding a disk we were using a Regex to find the
    appropriate SCSI controller.  This change validates the xsiType
    as being the correct type and removes the Regex.
    This will remove the problems the Regex
    created with different localizations.

 gems/pending/VMwareWebService/MiqVimVm.rb          | 36 +++++++--------
 .../pending/spec/VMwareWebService/MiqVimVm_spec.rb | 52 ++++++++++++++++++++++
 2 files changed, 69 insertions(+), 19 deletions(-)
Comment 12 Milan Falešník 2016-04-19 13:05:23 EDT
Checked in 5.6.0.2-beta2. I had to change the size to dialog_size in the vmware automate method.

With the latest ESX compatibility version of the tempalte I was able to successfully hot add the disk using the automate method.
Comment 13 CFME Bot 2016-05-24 11:29:56 EDT
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=c6f003e637fd747b7739b68840e1088ff4471842

commit c6f003e637fd747b7739b68840e1088ff4471842
Author:     Drew Bomhof <dbomhof@redhat.com>
AuthorDate: Mon Mar 28 16:39:33 2016 -0400
Commit:     Drew Bomhof <dbomhof@redhat.com>
CommitDate: Mon May 2 16:33:59 2016 -0400

    Check for a specific xsiType when adding a disk to a VMware instance
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1311221
    
    When hot adding a disk we were using a Regex to find the
    appropriate SCSI controller.  This change validates the xsiType
    as being the correct type and removes the Regex.
    This will remove the problems the Regex
    created with different localizations.

 gems/pending/VMwareWebService/MiqVimVm.rb          | 36 +++++++--------
 .../pending/spec/VMwareWebService/MiqVimVm_spec.rb | 52 ++++++++++++++++++++++
 2 files changed, 69 insertions(+), 19 deletions(-)
Comment 14 CFME Bot 2016-05-24 11:30:20 EDT
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=31bc75c2e68161cec88904ed9c3f38a98e21a452

commit 31bc75c2e68161cec88904ed9c3f38a98e21a452
Merge: fa34055 c6f003e
Author:     Greg McCullough <gmccullo@redhat.com>
AuthorDate: Tue May 24 11:14:17 2016 -0400
Commit:     Greg McCullough <gmccullo@redhat.com>
CommitDate: Tue May 24 11:14:17 2016 -0400

    Merge branch 'add_vmware_hotdisk_5.5.z' into '5.5.z'
    
    Check for a specific xsiType when adding a disk to a VMware instance
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1311221
    
    When hot adding a disk we were using a Regex to find the
    appropriate SCSI controller.  This change validates the xsiType
    as being the correct type and removes the Regex.
    This will remove the problems the Regex
    created with different localizations.
    
    PR: https://github.com/ManageIQ/manageiq/pull/7554
    
    Cherry Pick was clean
    
    See merge request !923

 gems/pending/VMwareWebService/MiqVimVm.rb          | 36 +++++++--------
 .../pending/spec/VMwareWebService/MiqVimVm_spec.rb | 52 ++++++++++++++++++++++
 2 files changed, 69 insertions(+), 19 deletions(-)
Comment 16 errata-xmlrpc 2016-06-29 11:38:55 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1348

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