Manually Remove Content Library from vCenter Server Appliance
search cancel

Manually Remove Content Library from vCenter Server Appliance

book

Article ID: 326242

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

  • A Content Library cannot be deleted from the vSphere Client UI.
  • When attempting to delete the Content Library, the task fails with a general system error:

    A general system error occurred:
    Cannot delete content from library 19b1fa06-####-####-####-23379ec0e9c7, reason: (vim.fault.InaccessibleDatastore) {
    faultCause = null,
    faultMessage = null,
    datastore = ManagedObjectReference: type = Datastore, value = datastore-####, serverGuid = 3c723c9d-####-####-####-b24fb5a070c0,
    name = <DS_Name>,
    detail = notAccessibleWithPrivilege
    }.
  • The backing datastore for the Content Library is no longer accessible after the datastore has been unmounted and/or removed from hosts.

  • Deleting the library results in a java.util.NoSuchElementException
  • Errors in /var/log/vmware/content-library/cls.log show: DeleteLibraryActivity | Library items deletion... failed at library item [UUID]

Environment

VMware vCenter Server

Cause

This article provides steps to manually remove a Content Library and its stale items from the vCenter Server database (VCDB) when the backing datastore is inaccessible or the library metadata is corrupted.

Resolution

Prerequisites

Important: The steps below are irreversible. Before making these changes, ensure you have completed the following:

  1. SSH to the vCenter Server Appliance as root.

  2. Stop the vCenter and Content Library services:
    service-control --stop vmware-vpxd && service-control --stop vmware-content-library

        Step 2: Remove the Content Library from the Database

  1. Connect to the vCenter Postgres VCDB:
    /opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres

  2. Find the ID of the Content Library you wish to delete (replace [Library_Name] with the actual name):
    SELECT id, name FROM cl_library WHERE name = '[Library_Name]';

  3. Use the returned Library ID to find the associated storage ID
    SELECT * FROM cl_library_storage WHERE library_id = '[Library_ID]';

  4. Delete the entries using the IDs identified above
    DELETE FROM cl_library_storage WHERE library_id = '[Library_ID]';
    DELETE FROM cl_storage WHERE id = '[Storage_ID]';
    DELETE FROM cl_library WHERE id = '[Library_ID]';

        Step 3: Clean Up Stale Library Items

  1. Identify items associated with the deleted library_id
    SELECT id, name, libraryid FROM cl_libraryitem WHERE libraryid = '[Library_ID]';

  2. Delete each stale item using its unique ID:
    DELETE FROM cl_libraryitem WHERE id = '[Item_ID]';

  3. Exit the psql interface: \q

        Step 4: Restart Services

  1. Start the vCenter and Content Library services:
    service-control --start vmware-vpxd && service-control --start vmware-content-library

  2. Log in to the vSphere Client and complete the removal of the Content Library 

Additional Information

データストアにアクセスできなくなったまたは破損した場合に、vCenter Server Appliance からコンテンツ ライブラリを手動で削除する方法(434901)