13.3. Methods


13.3.1. Creating a New Storage Connection

Creating a new storage connection requires a POST request.
It is possible to create a new storage connection without adding a storage domain. The host id or name is optional; providing it will attempt a connection to the storage via the host.

Example 13.2. Creating a New Storage Connection

POST /api/storageconnections HTTP/1.1
Accept: application/xml
Content-type: application/xml

<storage_connection>
   <type>nfs</type>
   <address>domain.example.com</address>
   <path>/export/storagedata/username/data</path>
   <host>
     <name>Host_Name</name>
   </host>
</storage_connection>

13.3.2. Deleting a Storage Connection

Deleting a storage connection requires a DELETE request. A storage connection can only be deleted if neither storage domain nor LUN disks reference it.
The host name or id is optional; providing it unmounts the connection from that host.

Example 13.3. Deleting Storage Connection

DELETE /api/storageconnections/Storage_Connection_ID HTTP/1.1
Accept: application/xml
Content-type: application/xml

<host>
  <name>Host_Name</name>
</host>

13.3.3. Updating a Storage Connection

Updating an existing storage connection requires a PUT request. The storage domain must be in either maintenance mode or unattached to successfully update the connection.
Providing the host name or id is optional; if provided, the host attempts a connection to the updated storage details.

Example 13.4. Updating a Storage Connection

PUT /api/storageconnections/Storage_Connection_ID HTTP/1.1
Accept: application/xml
Content-type: application/xml

<storage_connection>   
  <address>updated.example.domain.com</address>
  <host>
      <name>Host_name</name>
   </host>
</storage_connection>

13.3.4. Updating an iSCSI Storage Connection

Updating an existing iSCSI storage connection requires a PUT request. An iSCSI storage domain must be in maintenance mode or unattached to successfully update the connection.

Example 13.5. Updating a Storage Connection

PUT /api/storageconnections/Storage_Connection_ID HTTP/1.1
Accept: application/xml
Content-type: application/xml

<storage_connection>   
  <port>3456</port>
</storage_connection>

13.3.5. Adding New Storage Domain with Existing Storage Connection

Adding a new storage domain with existing storage connection requires a POST request. This is only applicable with file-based storage domains: NFS, POSIX, and local.

Example 13.6. Adding a New Storage Domain with Existing Storage Connection

POST /api/storagedomains HTTP/1.1
Accept: application/xml
Content-type: application/xml

<storage_domain>
  <name>New_Domain</name>
  <type>data</type>
 <storage id="Storage_Connection_ID"/>
  <host>
    <name>Host_Name</name>
  </host>
</storage_domain>

13.3.6. Attaching an Additional Storage Connection to iSCSI Storage

Attaching an additional storage connection to an iSCSI storage domain requires a POST request.

Example 13.7. Attaching an Additional Storage Connection to iSCSI Storage

POST /api/storagedomains/iSCSI_Domain_ID/storageconnections HTTP/1.1
Accept: application/xml
Content-type: application/xml

<storage_connection id="Storage_Connection_ID">
</storage_connection>

13.3.7. Detaching a Storage Connection from iSCSI Storage

Detaching a storage connection from an iSCSI storage domain requires a DELETE request.

Example 13.8. Detaching a Storage Connection from iSCSI Storage

DELETE /api/storagedomains/iSCSI_Domain_ID/storageconnections/Storage_Connection_ID HTTP/1.1
Accept: application/xml
Content-type: application/xml

13.3.8. Defining Credentials to an iSCSI Target

When an iSCSI storage domain is added using the Administration Portal, only a single user name and password can be specified for that domain. However, some setups require that each host in the cluster use a separate user name and password. Specific credentials can be applied to each iSCSI target per host by using the storageconnectionextensions element.

Example 13.9. Defining credentials to an iSCSI target

POST /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/storageconnectionextensions HTTP/1.1
Accept: application/xml
Content-type: application/xml

<storageconnectionextension>
    <target>iqn.2010.05.com.example:iscsi.targetX</target>
    <username>jimmy</username>
    <password>p@55w0Rd!</password>
</storageconnectionextension>
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.