Content Library VM deployment fails with "storage backing does not exist" error
search cancel

Content Library VM deployment fails with "storage backing does not exist" error

book

Article ID: 316503

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

  • When attempting to deploy or convert a Virtual Machine from a Content Library template, the operation may fail during the 'Processing' or 'Import' stage

  • UI Errors
    • Unable to process template
    • The operation is not allowed in the current state. Cannot instantiate library item ##### due to the failure of importing file <Template Name>
      Detailed error: Error exporting file Template.ovf. Reason: The provided storage backing Datastore:datastore-##:##### for library ##### does not exist, the storage backing might be removed, disconnected, or no longer accessible via Datastore:datastore- ##:#####
    • If the affected Content Library is a subscribed library, synchronization fails with the following error: A specified parameter was not correct: The provided storage backing Datastore:datastore-##:##### for library ##### does not exist, the storage backing might be removed, disconnected, or no longer accessible via Datastore:datastore-##:#####.
       
  • In the vSphere Client, the Content Library Storage Status may display as ? Unknown
  • The Content Library logs will display the following errors:
    • /var/log/vmware/cls.log
      YYYY-MM-DDThh:mm | WARN     | mfsn63a3-545381-auto-boti-h5:70054873-d0 | cls-simple-activity-5     | ApiMethodSkeleton              | Implementation
      method reported unexpected exception: com.vmware.vapi.std.errors.NotAllowedInCurrentState
      com.vmware.vapi.std.errors.NotAllowedInCurrentState: NotAllowedInCurrentState (com.vmware.vapi.std.errors.not_allowed_in_current_state) => {
          messages = [LocalizableMessage (com.vmware.vapi.std.localizable_message) => {
          id = com.vmware.ovfs.ovfs-main.ovfs.library_item_files_not_prepared,
          defaultMessage = Cannot instantiate library item ##### due to the failure of importing file ##### Template.
      ovf, detail error: Error exporting file #####.ovf. Reason: The provided storage backing Datastore:datastore-##:##### for library ##### does not exist, the storage backing might be removed, disconnected, or no longer accessible via Datastore:datastore-##:#####..,
          args = [#####, ##### Template.ovf, Error exporting file ##### Template.ovf. Reason: The provided storage backing Datastore:datastore-##:##### for library ##### does not exist, the storage
       backing might be removed, disconnected, or no longer accessible via Datastore:datastore-##:#####.],
          params = <null>,
          localized = <null>
      }],
          data = <null>,
          errorType = NOT_ALLOWED_IN_CURRENT_STATE
      }
  • Verify the metadata mismatch via the VCSA shell using the command:
    • /opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres
    • SELECT storageuri FROM cl_storage WHERE id IN (SELECT storage_id FROM cl_library_storage WHERE library_id = '[Library_ID]');

Output:

                         storageuri
-------------------------------------------------------------
 Datastore:datastore-##:#####
(1 row)

Note: If the storageuri output references a datastore that is no longer present in the inventory, proceed with the resolution steps

Environment

VMware vCenter Server 8.x

Cause

  • A database inconsistency exists within the cl_libraryitem and cl_storage tables of the vCenter Database (VCDB)
  • This occurs when a datastore is unmounted or removed from the environment before the associated Content Library templates are deleted
  • Because the database metadata still references the old datastore URI, vCenter attempts to access a non-existent physical path, resulting in the "Not Allowed in Current State" exception

Resolution

Rebuild the affected Content Library.
  1. Determine which vCenter is the Publisher and which are Subscribers.
  2. Disable "Enable automatic synchronization" on all Subscriber vCenters under Actions > Edit Settings.
  3. On the Publisher vCenter, delete existing links in the Subscriptions tab.
  4. Delete and recreate the local library on the Publisher following the steps outlined in KB Deleting a content library will also remove the CL file from the datastore, causing the storage datastore to be displayed as "unknown."
    Note: Ensure Enable publishing is selected to generate a new Subscription URL 
  5. To reconnect, recreate the subscribed libraries on the recipient vCenters using the new URL provided by the Publisher