Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1182158

Summary: [RFE][ImportDomain] Add support for importing Block Storage Domain using REST-api
Product: Red Hat Enterprise Virtualization Manager Reporter: rhev-integ
Component: ovirt-engine-sdkAssignee: Maor <mlipchuk>
Status: CLOSED ERRATA QA Contact: lkuchlan <lkuchlan>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.5.0CC: acanan, adahms, amureini, ecohen, gklein, iheim, lsurette, mlipchuk, rbalakri, Rhev-m-bugs, yeylon, ylavi
Target Milestone: ---Keywords: FutureFeature, ZStream
Target Release: 3.5.1Flags: ylavi: Triaged+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: vt14 Doc Type: Enhancement
Doc Text:
This enhancement adds the ability to import block storage domains using the REST API.
Story Points: ---
Clone Of: 1179901 Environment:
Last Closed: 2015-04-28 18:44:22 UTC Type: ---
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: 1179901    
Bug Blocks: 1193058, 1197441    

Comment 1 Allon Mureinik 2015-01-15 13:51:43 UTC
Maor, both patches in the external tracker refer to upstream/master.
If they were not backported, this BZ should be on POST, not MODIFIED.
If they were, please add them as external trackers and move back to MODIFIED.

Comment 2 Maor 2015-01-15 14:08:34 UTC
Adding the backported patches to the bug

Comment 3 Ori Gofen 2015-03-04 14:32:09 UTC
Maor, can you please provide steps for new api?

Comment 4 Maor 2015-03-04 16:53:13 UTC
(In reply to Ori Gofen from comment #3)
> Maor, can you please provide steps for new api?

sure, It is described in the documentation at http://www.ovirt.org/Features/ImportStorageDomain#Import_block_Storage_Domain:

Step1: Discover the targets in your iSCSI Storage Server:

POST /api/hosts/052a880a-53e0-4fe3-9ed5-01f939d1df66/iscsidiscover
Accept: application/xml
Content-Type: application/xml
<action>
  <iscsi>
     <address>iscsi.server</address>
  </iscsi>
    <iscsi_target>iqn.iscsi.120.01</iscsi_target>  
    <iscsi_target>iqn.iscsi.120.02</iscsi_target>
   <iscsi_target>iqn.iscsi.120.03</iscsi_target>
</action>



Step2: Get a candidates Storage Domains list to be imported

After the iscsilogin operation, the host is already connected to the targets in the iSCSI and we can fetch the Storage Domains which are candidates to be imported.

POST /api/hosts/052a880a-53e0-4fe3-9ed5-01f939d1df66/unregisteredstoragedomainsdiscover HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
   <iscsi>
       <address>iscsiHost</address>
   </iscsi>
   <iscsi_target>iqn.name1.120.01</iscsi_target>
   <iscsi_target>iqn.name2.120.02</iscsi_target>
   <iscsi_target>iqn.name3.120.03</iscsi_target>
</action>

The response which should returned as a list of Storage Domains, as follow:

<action>
   <iscsi>
       <address>iscsiHost</address>
   </iscsi>
   <storage_domains>
       <storage_domain id="6ab65b16-0f03-4b93-85a7-5bc3b8d52be0">
           <name>scsi4</name>
           <type>data</type>
           <master>false</master>
           <storage>
               <type>iscsi</type>
               <volume_group id="OLkKwa-VmEM-abW7-hPiv-BGrw-sQ2E-vTdAy1"/>
           </storage>
           <available>0</available>
           <used>0</used>
           <committed>0</committed>
           <storage_format>v3</storage_format>
       </storage_domain>
   <status>
       <state>complete</state>
   </status>
   <iscsi_target>iqn.name1.120.01</iscsi_target>
   <iscsi_target>iqn.name2.120.02</iscsi_target>
   <iscsi_target>iqn.name3.120.03</iscsi_target>
</action>




Step3: Import the block Storage Domains to the setup

POST /api/storagedomains/ HTTP/1.1
Accept: application/xml
Content-type: application/xml
<storage_domain id="39baf524-380e-407c-8625-50709fcaa9c2">
  <import>true</import>
  <host id="052a880a-53e0-4fe3-9ed5-01f939d1df66" />
  <type>data</type>
  <storage>
     <type>iscsi</type>
  </storage>
</storage_domain>

Comment 5 Allon Mureinik 2015-03-08 11:08:36 UTC
Maor, please provide doctext for this bug (and the 3.6.0 too, while you're at it).

Comment 6 lkuchlan 2015-03-11 14:13:36 UTC
Tested using rhevm-3.5.1-0.1.el6ev, vdsm-4.16.12-2.el7ev.x86_64
The importing FC domain using Rest-api is supported

Comment 7 Andrew Dahms 2015-04-21 10:35:29 UTC
Revised doc text; a docs bug to be raised to include an example of adding a block storage domain using the REST API.

Comment 8 Allon Mureinik 2015-04-21 12:22:48 UTC
(In reply to Andrew Dahms from comment #7)
> Revised doc text; a docs bug to be raised to include an example of adding a
> block storage domain using the REST API.
Thanks Andrew!
When you open it, could you please add a reference to it here?

Comment 9 Andrew Dahms 2015-04-21 12:31:02 UTC
Hi Allon,

Here it is - https://bugzilla.redhat.com/show_bug.cgi?id=1213803

Let me know if there is anything else we can do for you! :)

Kind regards,

Andrew

Comment 10 errata-xmlrpc 2015-04-28 18:44:22 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/RHSA-2015-0888.html