use of com.cloud.hypervisor.ovm3.objects.StoragePlugin.StorageDetails in project cloudstack by apache.
the class StoragePluginTest method testNFSStorageMountCreation.
@Test
public void testNFSStorageMountCreation() throws Ovm3ResourceException {
con.setResult(results.simpleResponseWrapWrapper(NFSMOUNTRESPONSEXML));
StorageDetails sd = sPt.storagePluginMountNFS(NFSHOST, NFSPATH, FSMNTUUID, NFSMNT);
con.setResult(results.simpleResponseWrapWrapper(NFSMOUNTRESPONSEXML));
NFSMNT = NFSMNT + "/" + FSMNTUUID;
sd = sPt.storagePluginMountNFS(NFSHOST, NFSPATH, FSMNTUUID, NFSMNT);
results.basicLongTest(Long.valueOf(sd.getSize()), 263166853120L);
results.basicLongTest(Long.valueOf(sd.getFreeSize()), 259377299456L);
results.basicStringTest(sd.getName(), "nfs:" + NFSPATH);
results.basicStringTest(sd.getUuid(), FSPROPUUID);
results.basicStringTest(sd.getDetailsRelationalUuid(), FSMNTUUID);
}
use of com.cloud.hypervisor.ovm3.objects.StoragePlugin.StorageDetails in project cloudstack by apache.
the class Ovm3StoragePool method execute.
/**
* Gets statistics for storage.
*
* @param cmd
* @return
*/
public GetStorageStatsAnswer execute(final GetStorageStatsCommand cmd) {
LOGGER.debug("Getting stats for: " + cmd.getStorageId());
try {
Linux host = new Linux(c);
Linux.FileSystem fs = host.getFileSystemByUuid(cmd.getStorageId(), "nfs");
StoragePlugin store = new StoragePlugin(c);
String propUuid = store.deDash(cmd.getStorageId());
String mntUuid = cmd.getStorageId();
if (store == null || propUuid == null || mntUuid == null || fs == null) {
String msg = "Null returned when retrieving stats for " + cmd.getStorageId();
LOGGER.error(msg);
return new GetStorageStatsAnswer(cmd, msg);
}
/* or is it mntUuid ish ? */
StorageDetails sd = store.storagePluginGetFileSystemInfo(propUuid, mntUuid, fs.getHost(), fs.getDevice());
/*
* FIXME: cure me or kill me, this needs to trigger a reinit of
* primary storage, actually the problem is more deeprooted, as when
* the hypervisor reboots it looses partial context and needs to be
* reinitiated.... actually a full configure round... how to trigger
* that ?
*/
if ("".equals(sd.getSize())) {
String msg = "No size when retrieving stats for " + cmd.getStorageId();
LOGGER.debug(msg);
return new GetStorageStatsAnswer(cmd, msg);
}
long total = Long.parseLong(sd.getSize());
long used = total - Long.parseLong(sd.getFreeSize());
return new GetStorageStatsAnswer(cmd, total, used);
} catch (Ovm3ResourceException e) {
LOGGER.debug("GetStorageStatsCommand for " + cmd.getStorageId() + " failed", e);
return new GetStorageStatsAnswer(cmd, e.getMessage());
}
}
use of com.cloud.hypervisor.ovm3.objects.StoragePlugin.StorageDetails in project cloudstack by apache.
the class Ovm3StoragePool method execute.
/**
* Gets the details of a storage pool, size etc
*
* @param cmd
* @return
*/
public Answer execute(ModifyStoragePoolCommand cmd) {
StorageFilerTO pool = cmd.getPool();
LOGGER.debug("modifying pool " + pool);
try {
if (config.getAgentInOvm3Cluster()) {
// no native ovm cluster for now, I got to break it in horrible
// ways
}
if (pool.getType() == StoragePoolType.NetworkFilesystem) {
createRepo(pool);
StoragePlugin store = new StoragePlugin(c);
String propUuid = store.deDash(pool.getUuid());
String mntUuid = pool.getUuid();
String nfsHost = pool.getHost();
String nfsPath = pool.getPath();
StorageDetails ss = store.storagePluginGetFileSystemInfo(propUuid, mntUuid, nfsHost, nfsPath);
Map<String, TemplateProp> tInfo = new HashMap<String, TemplateProp>();
return new ModifyStoragePoolAnswer(cmd, Long.parseLong(ss.getSize()), Long.parseLong(ss.getFreeSize()), tInfo);
} else if (pool.getType() == StoragePoolType.OCFS2) {
createOCFS2Sr(pool);
}
return new Answer(cmd, false, "The pool type: " + pool.getType().name() + " is not supported.");
} catch (Exception e) {
LOGGER.debug("ModifyStoragePoolCommand failed", e);
return new Answer(cmd, false, e.getMessage());
}
}
Aggregations