cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prasanna Santhanam <...@apache.org>
Subject Re: How does the plugin model work for storage providers?
Date Wed, 26 Jun 2013 11:48:14 GMT
On Wed, Jun 26, 2013 at 03:53:20PM +0530, Prasanna Santhanam wrote:
> On Tue, Jun 25, 2013 at 11:06:36PM +0000, Edison Su wrote:
> > I would say, the adapter thing is the legacy stuff, all the storage
> > plugins will be managed by DataStoreProviderManager. But as you
> > said, we can group plugins into one place by using spring's syntax,
> > such as:
> 
> > <bean id="storageProviders"
> >       class="org.apach.***.datastoreproviderManagerImpl">
> >     <property name="providerList">
> >         <list>
> >             <ref local="providerOne"/>
> >             <ref local="providerTwo"/>
> >         </list>
> >     </property>
> > </bean>
> >           
> 
> I tried something like this:
> In applicationContext beanfactory:
> <bean id="dataStoreProviderManager"
>         class="org.apache.cloudstack.storage.datastore.provider.DataStoreProviderManagerImpl">
>     <property name="primaryDataStoreProviderMgr">
>       <ref bean="primaryDataStoreProviderMgr"/>
>     </property>
>     <property name="imageStoreProviderMgr">
>       <ref bean="imageStoreProviderMgr"/>
>     </property>
>     <property name="providers">
>       <ref bean="storageProviders"/>
>     </property>
>   </bean>
> 
> Since I'm trying to separate storageProviders as plugins I tried putting them
> in the componentContext.xml so I didn't use a <ref local="">. But there's a problem
> 
> DataStoreProvider
>  | PrimaryDataStoreProvider
>  | ImageDataStoreProvider
> 
> All the above are interfaces, so I can't inject them using beans and group all
> vendor-specific PrimaryDataStoreProviders (Solidfire, Default etc) and the
> imageStores (S3, Swift, NFS). 
> 
> Shouldn't they become abstract classes with getter/setter for the List<?> providers

> to be injected into the ProviderManager?
> 

Fixed this as follows:
applicationContext.xml.in:
  <!--
    Data Store Provider Manager
  -->
  <bean id="dataStoreManagerImpl" class="org.apache.cloudstack.storage.datastore.DataStoreManagerImpl">
    <property name="primaryStoreMgr">
      <ref bean="#{dataStoreProviderManager.primaryDataStoreProviderMgr}"/>
    </property>
    <property name="imageDataStoreMgr">
      <ref bean="#{dataStoreProviderManager.imageStoreProviderMgr}"/>
    </property>
  </bean>

  <bean id="dataStoreProviderManager"
        class="org.apache.cloudstack.storage.datastore.provider.DataStoreProviderManagerImpl">
    <property name="primaryDataStoreProviderMgr">
      <bean id="primaryDataStoreProviderMgr" class="org.apache.cloudstack.storage.datastore.manager.PrimaryDataStoreProviderManagerImpl"
/>
    </property>
    <property name="imageStoreProviderMgr">
      <bean id="imageStoreProviderMgr" class="org.apache.cloudstack.storage.image.manager.ImageStoreProviderManagerImpl"
/>
    </property>
    <property name="providers">
      <ref bean="storageProviders"/>
    </property>
  </bean>

componentContext.xml.in:
<!--Storage Providers-->
  <bean id="storageProviders">
    <property name="#{providers}">
      <list>
        <bean id="CloudStackPrimaryDataStoreProviderImpl" class="org.apache.cloudstack.storage.datastore.provider.CloudStackPrimaryDataStoreProviderImpl"/>
        <!--<bean id="SolidfirePrimaryDataStoreProvider" class="org.apache.cloudstack.storage.datastore.provider.SolidfirePrimaryDataStoreProvider"/>-->
        <!--<bean id="SamplePrimaryDataStoreProviderImpl" class="org.apache.cloudstack.storage.datastore.provider.SamplePrimaryDatastoreProviderImpl"/>-->
        <bean id="CloudStackImageStoreProviderImpl" class="org.apache.cloudstack.storage.datastore.provider.CloudStackImageStoreProviderImpl"/>
        <bean id="S3ImageStoreProviderImpl" class="org.apache.cloudstack.storage.datastore.provider.S3ImageStoreProviderImpl"/>
        <bean id="SwiftImageStoreProviderImpl" class="org.apache.cloudstack.storage.datastore.provider.SwiftImageStoreProviderImpl"/>
      </list>
    </property>
  </bean>

Reason I needed to do this is because I need to get the simulator to use a
separate spring context and override the default CloudstackImageStore bean. The
simulator bean has to intercept the template download calls to say everything
is present. 

But looks like the dependency graph for this goes up to the
DataMotionService -> DataMotionStrategy -> DataStoreManager ->
DataStoreProviderManager -> DataStoreProvider.

I will push the changes to a branch for review.

Thanks,

------------------------
Powered by BigRock.com


Mime
View raw message