Bug 1005284

Summary: It is possible to change an iscsi storage connection and set an empty target
Product: Red Hat Enterprise Virtualization Manager Reporter: Katarzyna Jachim <kjachim>
Component: ovirt-engine-restapiAssignee: Daniel Erez <derez>
Status: CLOSED CURRENTRELEASE QA Contact: Meital Bourvine <mbourvin>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.3.0CC: acathrow, amureini, bazulay, ebenahar, iheim, ncredi, nlevinki, oramraz, Rhev-m-bugs, scohen, yeylon
Target Milestone: ---Flags: amureini: Triaged+
Target Release: 3.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: ovirt-3.4.0-alpha1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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:
Bug Depends On:    
Bug Blocks: 1078909, 1142926    
Attachments:
Description Flags
test logs (vdsm, engine, server etc.) none

Description Katarzyna Jachim 2013-09-06 15:14:35 UTC
Created attachment 794810 [details]
test logs (vdsm, engine, server etc.)

Description of problem:

If you try to add an iscsi storage connection via REST API with empty target, it will fail:

POST request:
<storage_connection>
   <address>10.34.63.202</address>
   <type>iscsi</type>
   <port>3260</port>
   <target></target>
</storage_connection>

response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fault>
    <reason>Operation Failed</reason>
    <detail>[Target details cannot be empty.]</detail>
</fault>

However, if you create a connection with non-empty target, you can later change the target to empty:

PUT request:
<storage_connection>
   <address>10.34.63.202</address>
   <type>iscsi</type>
   <port>3260</port>
   <target></target>
</storage_connection>

response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<storage_connection href="/api/storageconnections/28aeccb1-d72b-4742-bff2-4f9199463873" id="28aeccb1-d72b-4742-bff2-4f9199463873">
    <address>10.34.63.202</address>
    <type>iscsi</type>
    <port>3260</port>
    <target></target>
</storage_connection>


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


How reproducible: 100%


Steps to Reproduce:
1. create an iscsi storage connection
2. try to change target to empty string

Actual results: it is possible to change an iscsi storage connection so that the target is empty


Expected results: the command should fail with the "Target details cannot be empty." error

Additional info:
Attached logs are from this execution: http://jenkins.qa.lab.tlv.redhat.com:8080/view/Storage/view/3.3/job/3.3-storage_storage_connections_iscsi-iscsi-rest/25/testReport/junit/storage_storage_connections.test_manage_storage_connections_iscsi/013-TestCase288986;test_changing_storage_connection_without_target/TestCase288986_test_changing_storage_connection_without_target/

2013-09-04 17:19:24,283 - MainThread - plmanagement.trace - INFO - art.rhevm_api.tests_lib.low_level.storageconnections._prepare_connection_object(kwargs={'lun_target': '', 'type': 'iscsi'})
2013-09-04 17:19:24,285 - MainThread - storageconnections - DEBUG - PUT request content is --  url:/api/storageconnections/c1a89e8c-b220-424b-8b0f-7133b5cc6040 body:<storage_connection>
    <type>iscsi</type>
    <target></target>
</storage_connection>
 
2013-09-04 17:19:24,625 - MainThread - core_api - DEBUG - Request response time: 0.260
2013-09-04 17:19:24,626 - MainThread - storageconnections - DEBUG - Response body for PUT request is: 
<storage_connection href="/api/storageconnections/c1a89e8c-b220-424b-8b0f-7133b5cc6040" id="c1a89e8c-b220-424b-8b0f-7133b5cc6040">
    <address>256.256.256.256</address>
    <type>iscsi</type>
    <port>3260</port>
    <target></target>
</storage_connection>

Comment 1 Sandro Bonazzola 2014-01-14 08:44:41 UTC
ovirt 3.4.0 alpha has been released

Comment 2 Meital Bourvine 2014-01-16 13:50:08 UTC
Verified on ovirt-3.4.0-alpha1:

request:
Method: PUT
URL: https://10.34.63.25/api/storageconnections/6147014f-e4b9-4a85-bb6d-d08d9a3faed6
Body:
<storage_connection>
<address>10.34.63.202</address>
<type>iscsi</type>
<port>3260</port>
<target></target>
</storage_connection>

Response:
<fault>
<reason>Operation Failed</reason>
<detail>[Target details cannot be empty.]</detail>
</fault>

Comment 3 Itamar Heim 2014-06-12 14:10:57 UTC
Closing as part of 3.4.0