Bug 1243463 - Attaching direct LUN via FC results in size -1 and most parameters greyed out when viewed in the UI
Summary: Attaching direct LUN via FC results in size -1 and most parameters greyed out...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.5.3
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ovirt-3.6.0-rc
: 3.6.0
Assignee: Daniel Erez
QA Contact: Elad
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-07-15 13:37 UTC by Ade Bradshaw
Modified: 2019-10-10 09:57 UTC (History)
12 users (show)

Fixed In Version: 3.6.0-9
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-03-09 21:09:51 UTC
oVirt Team: Storage
Target Upstream Version:


Attachments (Terms of Use)
View 1 from the UI (13.67 KB, image/png)
2015-07-15 13:37 UTC, Ade Bradshaw
no flags Details
View 2 from the UI showing wrong settings and greyed out boxes (13.70 KB, image/png)
2015-07-15 13:39 UTC, Ade Bradshaw
no flags Details
Example script to search and add an available logical unit (1.29 KB, text/x-python)
2015-07-16 17:36 UTC, Juan Hernández
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2016:0376 0 normal SHIPPED_LIVE Red Hat Enterprise Virtualization Manager 3.6.0 2016-03-10 01:20:52 UTC
oVirt gerrit 44319 0 None None None Never
oVirt gerrit 44477 0 ovirt-engine-3.6 MERGED webadmin: remove Storage Type from edit disk dialog Never

Description Ade Bradshaw 2015-07-15 13:37:40 UTC
Created attachment 1052365 [details]
View 1 from the UI

Description of problem:
When we attach the LUN via the python API fails with a disk size of -1 and most option in the UI wrong/greyed out. 

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

How reproducible:
100%

Steps to Reproduce:
1. Create a VM
2. Attempt to attach a direct LUN (FC)
3. Check the direct LUN settings in the UI

Actual results:
disk is attached but doesnt work. It reports a size of -1, it shows the connection as iscsi (greyed out) an other options are also greyed out

Expected results:
The disk should be attached and have the parameters that were set in the API call


Additional info:
My customer has tried 4 different ways to attach the direct LUN via API

This are the 4 ways that I tried to attach the direct lun

1. example at bottom:

vm.disks.add(disk=params.Disk(interface="virtio_scsi",lun_storage=params.Storage(type_="fcp",logical_unit=[params.LogicalUnit(id="360001440000000106071a3259142aa47")])))

Output:

eexthie@lxf02p90 [ 12:07 ] ~/install-ng > ./ovirt-create-guest.py --guest lxf02tp2261
VM lxf02tp2261 already exists!
Attaching free SCSI LUN 360001440000000106071a3259142ab40  (size: 300GB)

In RHEVM:

2. Use the lun storage object:

def getFreeLun(host, size):

  for lun, unit in ((l,u) for l in host.storage.list() for u in l.logical_unit):
    unit_size = int(unit.size)/1024/1024/1024

    if getattr(unit, 'disk_id'):
      continue
    if unit.status == 'used':
      continue

    if not unit_size == size:
      continue

    return unit.id, unit_size, lun.logical_unit, lun

  return None

lun_id, unit_size, logical_unit, lun = getFreeLun('hostname', '150')
vm.disks.add(disk=params.Disk(interface="virtio_scsi",lun_storage=params.Storage(type_="fcp",lun_storage=lun)))

3. Use the logical_unit *list* object:

def getFreeLun(host, size):

  for lun, unit in ((l,u) for l in host.storage.list() for u in l.logical_unit):
    unit_size = int(unit.size)/1024/1024/1024

    if getattr(unit, 'disk_id'):
      continue
    if unit.status == 'used':
      continue

    if not unit_size == size:
      continue

    return unit.id, unit_size, lun.logical_unit, lun

  return None

lun_id, unit_size, logical_unit, lun = getFreeLun('hostname', '150')
vm.disks.add(disk=params.Disk(interface="virtio_scsi",lun_storage=params.Storage(type_="fcp",logical_unit=logical_unit)))

4. Define most of the parameters of the new object

    lu = params.LogicalUnit()
    lu.set_id(lun_id)
    storage = params.Storage()
    storage.set_type("fcp")
    storage.set_logical_unit([lu])
    storage.set_host(host)
    disk = params.Disk()
    disk.set_name("mylun")
    disk.set_interface("virtio")
    disk.set_type("fcp")
    disk.set_format("raw")
    disk.set_lun_storage(storage)
    disk = vm.disks.add(disk)

Comment 1 Ade Bradshaw 2015-07-15 13:39:38 UTC
Created attachment 1052366 [details]
View 2 from the UI showing wrong settings and greyed out boxes

Comment 2 Juan Hernández 2015-07-16 17:34:51 UTC
There are several potential issues here:

1. The backend doesn't validate the logical unit parameter sent by the RESTAPI, it just inserts them into the database. So if there is any error (wrong id, for example) the disk will be created successfully but then it won't work.

2. As the backend doesn't contact the storage server when the disk is added the size can't be initially populated correctly. However it will be populated once the VM is started and the storage server is contacted, then it will be displayed correctly in the GUI.

3. The GUI doesn't display correctly the type of storage for direct LUN disks.

Anyhow, if the parameters given to the RESTAPI are correct the disk will be added and will work, at least that worked correctly in my environment. I'm attaching an example script that finds the logical unit identifier (using the /hosts/{host:id}/storage collection) and adds the disk to a VM.

I think that the issues described in the above 1, 2 and 3 should be fixed outside of the RESTAPI.

Comment 3 Juan Hernández 2015-07-16 17:36:11 UTC
Created attachment 1052775 [details]
Example script to search and add an available logical unit

Comment 4 Daniel Erez 2015-08-02 15:11:42 UTC
Hi Ade,

* Can you please attach the relevant vdsm and engine logs.

* As Juan suggested, can you please check whether the size is populated once the VM is started?

* Can you please verify the output of 'vdsClient -s 0 getDeviceList' - i.e. LUN details being reported correctly?

* As part of bug 1123754, the logical unit parameter should be validated upon disk creation. Is any error displayed in the webadmin?

* It seems that the only UI issue is the storage type select-box, though it's merely a display issue, the select-box should be grayed-out.

Thanks,
Daniel

Comment 5 Allon Mureinik 2015-08-03 13:24:21 UTC
Daniel, I see a patch posted to https://gerrit.ovirt.org/#/c/44319. Shouldn't this BZ be moved to POST?

Comment 6 Daniel Erez 2015-08-03 13:27:04 UTC
(In reply to Allon Mureinik from comment #5)
> Daniel, I see a patch posted to https://gerrit.ovirt.org/#/c/44319.
> Shouldn't this BZ be moved to POST?

Not yet. It's just for the display issue..

Comment 7 Ade Bradshaw 2015-08-03 13:31:07 UTC
Looks like you are right, once the VM powers up, the size is set correctly. The storage type is wrong though (its set to iSCSI and greyed out). We are just doing a provision test now and will have more info within an hour or so

Comment 8 Ade Bradshaw 2015-08-04 08:46:00 UTC
OK, confirmed, its only a visual issue - the size fills in once the VM is powered up and the fact that the interface shows as iSCSI and not FC isnt affecting the usability of the LUN. The LUN attach code from comment #3 works fine. Im happy to close the BZ so long the GUI thing is addressed in the future

Comment 9 Daniel Erez 2015-08-04 13:45:18 UTC
(In reply to Ade Bradshaw from comment #8)
> OK, confirmed, its only a visual issue - the size fills in once the VM is
> powered up and the fact that the interface shows as iSCSI and not FC isnt
> affecting the usability of the LUN. The LUN attach code from comment #3
> works fine. Im happy to close the BZ so long the GUI thing is addressed in
> the future

Posted patch [1] for hiding the confusing select-box for now (until a long-term solution which would probably require persisting the LUN storage type (FCP/ISCSI) in DB).

[1] https://gerrit.ovirt.org/#/c/44319

Comment 10 Allon Mureinik 2015-08-05 12:45:50 UTC
The patch missed the branching cut off, return to POST.
Daniel - please backport it.

Comment 11 Elad 2015-08-23 09:00:08 UTC
Storage type doesn't appear in Webadmin for edit a direct LUN attached to a VM

Verified using rhevm-3.6.0-0.12.master.el6.noarch

Comment 13 errata-xmlrpc 2016-03-09 21:09:51 UTC
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://rhn.redhat.com/errata/RHEA-2016-0376.html


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