Is there a way to remove a LUN to shrink the size of a Storage Domain in RHEV?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Virtualization (RHEV) 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6
  • Red Hat Virtualization (RHV) 4.0, 4.1, 4.2, 4.3

Issue

  • I have used the wrong LUN to extend a storage domain. How can I shrink or reduce a Storage Domain in RHEV?
  • My storage admin has requested that I give back a LUN used for a storage domain in RHEV. How can I do that without losing my VM data?
  • Are there any considerations I should take into account when creating Storage Domains so I can be sure they can be shrunk in the future?

Resolution

  • In RHV 4.2 and above, this can now be performed via the RHV Admin Portal. The RFE that provided this was This content is not included.BZ 1454287. The storage domain has to be in maintenance mode, then under Manage Domain, a Remove button is available to mark the desired LUNs.

  • In RHV 4.1, this could only be performed via the REST-API, as documented in the REST API Guide.

  • REST API Example

cat reduce.xml
 <action>
   <logical_units>
     <logical_unit id="LUN_ID"/>
   </logical_units>
 </action>

curl -X POST -H "Content-type: application/xml" -u USER:PASSWORD --insecure -d @reduce.xml "https://manager-fqdn/ovirt-engine/api/storagedomains/storage-domain-id/reduceluns"

Replace,
a. USER:PASSWORD with username and password.
b. storage-domain-id with the storage domain id on which you added the LUN.
c. LUN_ID with id of the LUN which has to be removed.
  • In both cases, the following apply;

    1. The first lun in the Storage Domain (the one containing the Volume Group metadata) cannot be removed.

    2. Enough free space has to exist in the Storage Domain so that any data on the lun being removed can be relocated. In the event that the lun contains data, the removal sequence will attempt to move the Physical Extents (via 'pvmove') to another lun before removing the lun.

  • In earlier versions of RHV, if the space is available to create a new storage domain, VMs' disks can be migrated to a new storage domain, and then the original storage domain can be removed.

  • If assistance is required for any of the above, please contact Red Hat Technical Support.

Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.