Skip to content

Commit

Permalink
fix adding nfs primary storage and build and load
Browse files Browse the repository at this point in the history
  • Loading branch information
sudison committed Feb 22, 2013
1 parent 8a52347 commit 3bb713c
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ public DataStore initialize(Map<String, Object> dsInfos) {

String scheme = uri.getScheme();
String storageHost = uri.getHost();
String hostPath = uri.getPath().replaceFirst("/", "");
String hostPath = uri.getPath();
Object localStorage = dsInfos.get("localStorage");
if (localStorage != null) {
hostPath = hostPath.replace("/", "");
}
String userInfo = uri.getUserInfo();
int port = uri.getPort();
StoragePoolVO pool = null;
Expand Down Expand Up @@ -310,7 +314,6 @@ public DataStore initialize(Map<String, Object> dsInfos) {
"Unable to figure out the scheme for URI: " + uri);
}

Object localStorage = dsInfos.get("localStorage");
if (localStorage == null) {
List<StoragePoolVO> pools = primaryDataStoreDao
.listPoolByHostPath(storageHost, hostPath);
Expand Down Expand Up @@ -463,8 +466,11 @@ public boolean attachCluster(DataStore store, ClusterScope scope) {

@Override
public boolean attachZone(DataStore dataStore, ZoneScope scope) {
// TODO Auto-generated method stub
return false;
StoragePoolVO pool = this.primaryDataStoreDao.findById(dataStore.getId());
pool.setScope(ScopeType.ZONE);
pool.setStatus(StoragePoolStatus.Up);
this.primaryDataStoreDao.update(pool.getId(), pool);
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.springframework.stereotype.Component;

import com.cloud.storage.StorageManager;

@Component
public class DefaultPrimaryDataStoreProviderManagerImpl implements PrimaryDataStoreProviderManager {
@Inject
Expand All @@ -45,6 +47,7 @@ public class DefaultPrimaryDataStoreProviderManagerImpl implements PrimaryDataSt
@Inject
PrimaryDataStoreDao dataStoreDao;
Map<String, PrimaryDataStoreDriver> driverMaps;
@Inject StorageManager storageMgr;

@PostConstruct
public void config() {
Expand Down Expand Up @@ -77,7 +80,6 @@ public PrimaryDataStore getPrimaryDataStore(String uuid) {

@Override
public boolean registerHostListener(String uuid, HypervisorHostListener listener) {
// TODO Auto-generated method stub
return false;
return storageMgr.registerHostListener(uuid, listener);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import javax.inject.Inject;

import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle;
import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener;
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
import org.apache.cloudstack.storage.datastore.PrimaryDataStoreProviderManager;
import org.apache.cloudstack.storage.datastore.driver.AncientPrimaryDataStoreDriverImpl;
Expand Down Expand Up @@ -59,6 +60,8 @@ public boolean configure(Map<String, Object> params) {
uuid = (String)params.get("uuid");
id = (Long)params.get("id");
storeMgr.registerDriver(uuid, this.driver);
HypervisorHostListener listener = ComponentContext.inject(DefaultHostListener.class);
storeMgr.registerHostListener(uuid, listener);
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
package com.cloud.ucs.database;

import javax.ejb.Local;

import org.springframework.stereotype.Component;

import com.cloud.utils.db.DB;
import com.cloud.utils.db.GenericDaoBase;
@Local(value = { UcsBladeDao.class })
@DB(txn = false)
@DB(txn = false)
@Component
public class UcsBladeDaoImpl extends GenericDaoBase<UcsBladeVO, Long> implements UcsBladeDao {

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
package com.cloud.ucs.database;

import javax.ejb.Local;

import org.springframework.stereotype.Component;

import com.cloud.utils.db.DB;
import com.cloud.utils.db.GenericDaoBase;

@Local(value = { UcsManagerDao.class })
@DB(txn = false)
@DB(txn = false)
@Component
public class UcsManagerDaoImpl extends GenericDaoBase<UcsManagerVO, Long> implements UcsManagerDao {
}

13 changes: 3 additions & 10 deletions server/src/com/cloud/storage/StorageManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -772,8 +772,10 @@ public PrimaryDataStoreInfo createPool(CreateStoragePoolCmd cmd)

if (storeProvider == null) {
storeProvider = dataStoreProviderMgr.getDefaultPrimaryDataStoreProvider();
if (storeProvider == null) {
throw new InvalidParameterValueException(
"invalid storage provider uuid" + providerUuid);
"can't find storage provider: " + providerUuid);
}
}

Long clusterId = cmd.getClusterId();
Expand Down Expand Up @@ -983,15 +985,6 @@ public void connectHostToSharedPool(long hostId, long poolId)
HypervisorHostListener listener = hostListeners.get(provider.getUuid());
listener.hostConnect(hostId, pool.getId());
}










@Override
public void createCapacityEntry(StoragePoolVO storagePool, short capacityType, long allocated) {
Expand Down

0 comments on commit 3bb713c

Please sign in to comment.