2 Replies Latest reply on Dec 3, 2015 3:59 PM by eXoRt0

    How to change catalog default storage policy?

    tobycoleridge Lurker


      I am trying to change the default storage policy on a organizations catalog


      Organization -> Catalogs -> Org Catalog -> Properties -> Storage -> Pre-provision on on specific storage policy


      I can't get the storage profile into the right type for the catalog:


      $catalog = Get-Org -name test |get-catalog -name "test catalog"




      $storProfile = Search-Cloud -QueryType ProviderVdcStorageProfile -Name "Standard 1" | Get-CIView




      $cat.ExtensionData.CatalogStorageProfiles = $storProfile




      returns:


      Exception setting "CatalogStorageProfiles": "Cannot convert the "VMware.VimAutomation.Cloud.Views.VMWProviderVdcStorage Profile" value of type "VMware.VimAutomation.Cloud.Views.VMWProviderVdcStorageProfile" to type "VMware.VimAutomation.Cloud.Views.CatalogStorageProfiles"."


      So I guess the question is how do I set $storProfile to a CatalogStorageProfiles object?

      $catalog = Get-Org -name arntd |get-catalome "arntd catalog"



      $storProfile = Search-Cloud -QueryType ProviderVdcStorageProfile -Name "Standard 1"  |Get-CIView 



      $cat.ExtensionData.CatalogStorageProfiles = $storProfile



       



      Exception setting "CatalogStorageProfiles": "Cannot convert the "VMware.VimAutomation.Cloud.Views.VMWProviderVdcStorage



      Profile" value of type "VMware.VimAutomation.Cloud.Views.VMWProviderVdcStorageProfile" to type "VMware.VimAutomation.Cl



      oud.Views.CatalogStorageProfiles"."


        • 1. Re: How to change catalog default storage policy?
          mavelite Enthusiast

          Same issue here. I can create a new catalog without issue using powercli but either creating the catalog on the correct profile correctly or trying to change it gives me the above errors.

           

          -Mav

          • 2. Re: How to change catalog default storage policy?
            eXoRt0 Lurker

            Had the same issue and found this forum. After a lot of trials and errors I found a solution.

             

            #Set thew new catalog profile

            $orgvDCStoragePolicy = search-cloud -querytype AdminOrgVdcStorageProfile | where {($_.Name -match $StorageCatalogPolicyName) -and ($_.VdcName -eq $orgvDCName)} | Get-CIView

            $orgvDCStoragePolicy.UpdateServerData()

             

            #Create a private Catalog and share it to all Org members with Read/Write access

            $privateCatalog = New-Object VMware.VimAutomation.Cloud.Views.AdminCatalog

            $privateCatalog.name = "$orgName Private Catalog"

            (Get-Org $orgName | Get-CIView).CreateCatalog($privateCatalog)

            New-CIAccessControlRule -Entity $privateCatalog.name -EveryoneInOrg -AccessLevel ReadWrite -Confirm:$False

             

            #Update catalog storage policy

            $catalog = Get-Org -name $OrgName | get-catalog -name $privateCatalog.name

            $catalog.ExtensionData.CatalogStorageProfiles.VdcStorageProfile = $orgvDCStoragePolicy.href

            $catalog.ExtensionData.UpdateServerData()

             

            You have to use the ".href" to reference the object instead of the catalog name. I was hoping to set the catalog storage policy at the creation with this line:

             

            $privateCatalog.ExtensionData.CatalogStorageProfiles.VdcStorageProfile = $orgvDCStoragePolicy.href


            It won't take it, I get the following error:


            The property 'VdcStorageProfile' cannot be found on this object. Verify that the property exists and can be set.


            As a result you end up with "Version 2" of every newly created catalog.


            Hope that helps.

             

            -Alex