LOGGER.debug("creating pool " + pool); try { if (pool.getType() == StoragePoolType.NetworkFilesystem) { createRepo(pool); } else if (pool.getType() == StoragePoolType.IscsiLUN) { return new Answer(cmd, false, "iSCSI is unsupported at the moment"); } else if (pool.getType() == StoragePoolType.OCFS2) { return new Answer(cmd, false, "OCFS2 is unsupported at the moment"); } else if (pool.getType() == StoragePoolType.PreSetup) { LOGGER.warn("pre setup for pool " + pool); } else { return new Answer(cmd, false, "The pool type: " + pool.getType().name() + " is not supported.");
protected Answer execute(ModifyStoragePoolCommand cmd) { StorageFilerTO pool = cmd.getPool(); try { if (pool.getType() == StoragePoolType.NetworkFilesystem) { createNfsSr(pool); } else if (pool.getType() == StoragePoolType.OCFS2) { createOCFS2Sr(pool); } else { return new Answer(cmd, false, "The pool type: " + pool.getType().name() + " is not supported."); } setupHeartBeat(pool.getUuid()); OvmStoragePool.Details d = OvmStoragePool.getDetailsByUuid(_conn, pool.getUuid()); Map<String, TemplateProp> tInfo = new HashMap<String, TemplateProp>(); ModifyStoragePoolAnswer answer = new ModifyStoragePoolAnswer(cmd, d.totalSpace, d.freeSpace, tInfo); return answer; } catch (Exception e) { s_logger.debug("ModifyStoragePoolCommand failed", e); return new Answer(cmd, false, e.getMessage()); } }
if (pool.getType() == StoragePoolType.NetworkFilesystem) { citrixResourceBase.getNfsSR(conn, Long.toString(pool.getId()), pool.getUuid(), pool.getHost(), pool.getPath(), pool.toString()); } else if (pool.getType() == StoragePoolType.IscsiLUN) { citrixResourceBase.getIscsiSR(conn, pool.getUuid(), pool.getHost(), pool.getPath(), null, null, false); } else if (pool.getType() == StoragePoolType.PreSetup) { } else { return new Answer(command, false, "The pool type: " + pool.getType().name() + " is not supported.");
if (pool.getType() == StoragePoolType.NetworkFilesystem) { createRepo(pool); StoragePlugin store = new StoragePlugin(c); return new ModifyStoragePoolAnswer(cmd, Long.parseLong(ss .getSize()), Long.parseLong(ss.getFreeSize()), tInfo); } else if (pool.getType() == StoragePoolType.OCFS2) { createOCFS2Sr(pool); + pool.getType().name() + " is not supported."); } catch (Exception e) { LOGGER.debug("ModifyStoragePoolCommand failed", e);
final KVMStoragePool primaryPool = storagePoolMgr.getStoragePool(pool.getType(), primaryUuid);
public ModifyStoragePoolAnswer(ModifyStoragePoolCommand cmd, long capacityBytes, long availableBytes, Map<String, TemplateProp> tInfo) { super(cmd); result = true; poolInfo = new StoragePoolInfo(null, cmd.getPool().getHost(), cmd.getPool().getPath(), cmd.getLocalPath(), cmd.getPool().getType(), capacityBytes, availableBytes); templateInfo = tInfo; }
@Override public Answer execute(final DeleteStoragePoolCommand command, final LibvirtComputingResource libvirtComputingResource) { try { // if getRemoveDatastore() is true, then we are dealing with managed storage and can skip the delete logic here if (!command.getRemoveDatastore()) { final StorageFilerTO pool = command.getPool(); final KVMStoragePoolManager storagePoolMgr = libvirtComputingResource.getStoragePoolMgr(); storagePoolMgr.deleteStoragePool(pool.getType(), pool.getUuid()); } return new Answer(command); } catch (final CloudRuntimeException e) { return new Answer(command, false, e.toString()); } } }
primaryStorage.getUuid(), primaryStorage.getHost(), dst); VolumeTO volume = new VolumeTO(cmd.getVolumeId(), disk.getType(), primaryStorage.getType(), primaryStorage.getUuid(), primaryStorage.getPath(), fileName, fp.getName(), fp.getSize(), null);
protected CreateAnswer execute(CreateCommand cmd) { StorageFilerTO primaryStorage = cmd.getPool(); DiskProfile disk = cmd.getDiskCharacteristics(); try { OvmVolume.Details vol = null; if (cmd.getTemplateUrl() != null) { vol = OvmVolume.createFromTemplate(_conn, primaryStorage.getUuid(), cmd.getTemplateUrl()); } else { vol = OvmVolume.createDataDsik(_conn, primaryStorage.getUuid(), Long.toString(disk.getSize()), disk.getType() == Volume.Type.ROOT); } VolumeTO volume = new VolumeTO(cmd.getVolumeId(), disk.getType(), primaryStorage.getType(), primaryStorage.getUuid(), primaryStorage.getPath(), vol.name, vol.path, vol.size, null); return new CreateAnswer(cmd, volume); } catch (Exception e) { s_logger.debug("CreateCommand failed", e); return new CreateAnswer(cmd, e.getMessage()); } }
final KVMStoragePool primaryPool = storagePoolMgr.getStoragePool(command.getPool().getType(), command.getPoolUuid());
@Override public Answer execute(final CheckVMActivityOnStoragePoolCommand command, final LibvirtComputingResource libvirtComputingResource) { final ExecutorService executors = Executors.newSingleThreadExecutor(); final KVMHAMonitor monitor = libvirtComputingResource.getMonitor(); final StorageFilerTO pool = command.getPool(); if (Storage.StoragePoolType.NetworkFilesystem == pool.getType()){ final NfsStoragePool nfspool = monitor.getStoragePool(pool.getUuid()); final KVMHAVMActivityChecker ha = new KVMHAVMActivityChecker(nfspool, command.getHost().getPrivateNetwork().getIp(), command.getVolumeList(), libvirtComputingResource.getVmActivityCheckPath(), command.getSuspectTimeInSeconds()); final Future<Boolean> future = executors.submit(ha); try { final Boolean result = future.get(); if (result) { return new Answer(command, false, "VMHA disk activity detected ..."); } else { return new Answer(command); } } catch (InterruptedException e) { return new Answer(command, false, "CheckVMActivityOnStoragePoolCommand: can't get status of host: InterruptedException"); } catch (ExecutionException e) { return new Answer(command, false, "CheckVMActivityOnStoragePoolCommand: can't get status of host: ExecutionException"); } } return new Answer(command, false, "Unsupported Storage"); } }
String msg; if (cmd.getType() == StoragePoolType.NetworkFilesystem) { Boolean repoExists = false; URI uri = new URI(cmd.getType() + "://" + cmd.getHost() + ":" + +cmd.getPort() + cmd.getPath() + "/VirtualMachines"); setupNfsStorage(uri, cmd.getUuid()); + " create failed, was type " + cmd.getType(); LOGGER.debug(msg); return false;
@Override public Answer execute(final ModifyStoragePoolCommand command, final LibvirtComputingResource libvirtComputingResource) { final KVMStoragePoolManager storagePoolMgr = libvirtComputingResource.getStoragePoolMgr(); final KVMStoragePool storagepool = storagePoolMgr.createStoragePool(command.getPool().getUuid(), command.getPool().getHost(), command.getPool().getPort(), command.getPool().getPath(), command.getPool() .getUserInfo(), command.getPool().getType()); if (storagepool == null) { return new Answer(command, false, " Failed to create storage pool"); } final Map<String, TemplateProp> tInfo = new HashMap<String, TemplateProp>(); final ModifyStoragePoolAnswer answer = new ModifyStoragePoolAnswer(command, storagepool.getCapacity(), storagepool.getAvailable(), tInfo); return answer; } }
new VolumeTO(command.getVolumeId(), dskch.getType(), pool.getType(), pool.getUuid(), vdir.nameLabel, pool.getPath(), vdir.uuid, vdir.virtualSize, null);
primary = storagePoolMgr.getStoragePool(command.getPool().getType(), command.getPrimaryStoragePoolNameLabel()); } catch (final CloudRuntimeException e) { if (e.getMessage().contains("not found")) { primary = storagePoolMgr.createStoragePool(command.getPool().getUuid(), command.getPool().getHost(), command.getPool().getPort(), command.getPool().getPath(), command.getPool().getUserInfo(), command.getPool().getType()); } else { return new CreatePrivateTemplateAnswer(command, false, e.getMessage());
final KVMStoragePool primaryPool = storagePoolMgr.getStoragePool(command.getPool().getType(), command.getPrimaryStoragePoolNameLabel()); final KVMPhysicalDisk snapshotDisk = primaryPool.getPhysicalDisk(command.getVolumePath()); final KVMStoragePool primaryStorage = storagePoolMgr.getStoragePool(command.getPool().getType(), command.getPool().getUuid());
final KVMStoragePool primaryPool = storagePoolMgr.getStoragePool(pool.getType(), pool.getUuid());
try { final KVMStoragePoolManager storagePoolMgr = libvirtComputingResource.getStoragePoolMgr(); primaryPool = storagePoolMgr.getStoragePool(pool.getType(), pool.getUuid()); disksize = dskch.getSize(); final VolumeTO volume = new VolumeTO(command.getVolumeId(), dskch.getType(), pool.getType(), pool.getUuid(), pool.getPath(), vol.getName(), vol.getName(), disksize, null);
primaryPool = storagePoolMgr.getStoragePool(pool.getType(), pool.getUuid()); } catch (final CloudRuntimeException e) { if (e.getMessage().contains("not found")) { primaryPool = storagePoolMgr.createStoragePool(pool.getUuid(), pool.getHost(), pool.getPort(), pool.getPath(), pool.getUserInfo(), pool.getType()); } else { return new CopyVolumeAnswer(command, false, e.getMessage(), null, null);