Bug 1096217

Summary: Direct iSCSI lun disk details aren't validated
Product: [Retired] oVirt Reporter: Juan Hernández <juan.hernandez>
Component: ovirt-engine-apiAssignee: Daniel Erez <derez>
Status: CLOSED UPSTREAM QA Contact: Carlos Mestre González <cmestreg>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.4CC: acanan, amureini, bugs, derez, gklein, iheim, rbalakri, tnisan, yeylon
Target Milestone: ---Keywords: Triaged
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: ovirt-engine-3.5.0_rc2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1123754 (view as bug list) Environment:
Last Closed: 2014-09-22 08:02:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1123754    

Description Juan Hernández 2014-05-09 13:21:45 UTC
When adding a direct iSCSI direct LUN disk using the RESTAPI without creating a storage domain, the details given by the user aren't validated, and stored in the database regardless of their correctness. In particular the LUN id isn't validated, just stored in the database. Other attributes, like the vendor id, the model id, the serial number and the size aren't retrieved from the iSCSI server and left empty in the database.

This can be reproduced with a Python script like this:

#!/usr/bin/python

import ovirtsdk.api
import ovirtsdk.xml.params

api = ovirtsdk.api.API(
    url="https://rhel.example.com/ovirt-engine/api",
    username="admin@internal",
    password="******",
    insecure=True,
    debug=True)

# Create the iSCSI storage connection:
sc = ovirtsdk.xml.params.StorageConnection()
sc.set_address("192.168.122.1")
sc.set_type("iscsi")
sc.set_port(3260)
sc.set_target("iqn.2014-01.com.example:iscsi")
sc = api.storageconnections.add(sc)

# Add the direct LUN disk:
lu = ovirtsdk.xml.params.LogicalUnit()
lu.set_id("something_that_doesnt_exist")
lu.set_address(sc.get_address())
lu.set_port(sc.get_port())
lu.set_target(sc.get_target())
storage = ovirtsdk.xml.params.Storage()
storage.set_type("iscsi")
storage.set_logical_unit([lu])
disk = ovirtsdk.xml.params.Disk()
disk.set_name("mylun")
disk.set_interface("virtio")
disk.set_type("iscsi")
disk.set_format("raw")
disk.set_lun_storage(storage)
disk = api.disks.add(disk)

api.disconnect()

This succeeds, and the LUN disk is created, but will never work. The expected result is that incorrect LUN ids are detected, and that the additional attributes are populated correctly.

Comment 1 Allon Mureinik 2014-08-20 06:59:10 UTC
Daniel, where's the patch that moved this BZ to POST? thanks.

Comment 2 Daniel Erez 2014-08-20 07:10:34 UTC
(In reply to Allon Mureinik from comment #1)
> Daniel, where's the patch that moved this BZ to POST? thanks.

Added.