use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.
the class VolumeListModel method onConfigureClusterSnapshotOptions.
public void onConfigureClusterSnapshotOptions() {
GlusterClusterSnapshotConfigModel clusterSnapshotConfigModel = (GlusterClusterSnapshotConfigModel) getWindow();
Guid clusterId = clusterSnapshotConfigModel.getClusters().getSelectedItem().getId();
List<GlusterVolumeSnapshotConfig> vdsParams = new ArrayList<>();
for (EntityModel<GlusterVolumeSnapshotConfig> clusterCfg : clusterSnapshotConfigModel.getClusterConfigOptions().getItems()) {
vdsParams.add(new GlusterVolumeSnapshotConfig(clusterId, null, clusterCfg.getEntity().getParamName(), clusterCfg.getEntity().getParamValue()));
}
Frontend.getInstance().runAction(ActionType.UpdateGlusterVolumeSnapshotConfig, new UpdateGlusterVolumeSnapshotConfigParameters(clusterId, null, vdsParams), result -> {
if (result.getReturnValue() != null && result.getReturnValue().getSucceeded()) {
cancel();
}
if (getConfirmWindow() != null) {
setConfirmWindow(null);
}
}, this);
}
use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.
the class GlusterVolumeGeoRepCreateSessionPopupView method initEditors.
private void initEditors() {
showEligibleVolumes = new EntityModelCheckBoxEditor(Align.RIGHT);
startSessionEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
slaveClusterEditor = new ListModelTypeAheadListBoxEditor<>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<String>() {
@Override
public String getReplacementStringNullSafe(String data) {
return data;
}
@Override
public String getDisplayStringNullSafe(String data) {
return templates.typeAheadNameDescription(data == null ? constants.empty() : data, constants.empty()).asString();
}
});
slaveHostIpEditor = new ListModelTypeAheadListBoxEditor<>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<Pair<String, Guid>>() {
@Override
public String getReplacementStringNullSafe(Pair<String, Guid> data) {
return data.getFirst();
}
@Override
public String getDisplayStringNullSafe(Pair<String, Guid> data) {
return templates.typeAheadNameDescription(data == null ? constants.empty() : data.getFirst(), constants.empty()).asString();
}
});
slaveVolumeEditor = new ListModelTypeAheadListBoxEditor<>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<GlusterVolumeEntity>() {
@Override
public String getReplacementStringNullSafe(GlusterVolumeEntity data) {
return data.getName();
}
@Override
public String getDisplayStringNullSafe(GlusterVolumeEntity data) {
return templates.typeAheadNameDescription(data.getName() == null ? constants.empty() : data.getName(), data.getClusterName() == null ? constants.empty() : data.getClusterName()).asString();
}
});
}
use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.
the class AddVmCommand method validateSpaceRequirements.
/**
* Check if destination storage has enough space
*/
protected boolean validateSpaceRequirements() {
for (Map.Entry<Guid, List<DiskImage>> sdImageEntry : storageToDisksMap.entrySet()) {
StorageDomain destStorageDomain = destStorages.get(sdImageEntry.getKey());
List<DiskImage> disksList = sdImageEntry.getValue();
StorageDomainValidator storageDomainValidator = createStorageDomainValidator(destStorageDomain);
if (!validateDomainsThreshold(storageDomainValidator) || !validateFreeSpace(storageDomainValidator, disksList)) {
return false;
}
}
return true;
}
use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.
the class AddVmCommand method addVmNetwork.
protected void addVmNetwork() {
List<? extends VmNic> nics = getVmInterfaces();
VmInterfaceManager vmInterfaceManager = new VmInterfaceManager(getMacPool());
vmInterfaceManager.sortVmNics(nics, getVmInterfaceDevices());
List<String> macAddresses = getMacPool().allocateMacAddresses(nics.size());
// Add interfaces from template
for (int i = 0; i < nics.size(); ++i) {
VmNic iface = nics.get(i);
Guid id = Guid.newGuid();
srcVmNicIdToTargetVmNicIdMapping.put(iface.getId(), id);
iface.setId(id);
iface.setMacAddress(macAddresses.get(i));
iface.setSpeed(VmInterfaceType.forValue(iface.getType()).getSpeed());
iface.setVmTemplateId(null);
iface.setVmId(getParameters().getVmStaticData().getId());
updateProfileOnNic(iface);
vmNicDao.save(iface);
getCompensationContext().snapshotNewEntity(iface);
vmNetworkStatisticsDao.save(iface.getStatistics());
getCompensationContext().snapshotNewEntity(iface.getStatistics());
}
}
use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.
the class AddVmCommand method addVmCinderDisks.
protected void addVmCinderDisks(Collection<DiskImage> templateDisks) {
List<CinderDisk> cinderDisks = DisksFilter.filterCinderDisks(templateDisks);
if (cinderDisks.isEmpty()) {
return;
}
Map<Guid, Guid> diskImageMap = new HashMap<>();
for (CinderDisk cinderDisk : cinderDisks) {
ImagesContainterParametersBase params = buildCloneCinderDiskCommandParameters(cinderDisk);
ActionReturnValue actionReturnValue = runInternalAction(ActionType.CloneSingleCinderDisk, params, cloneContext().withoutExecutionContext().withoutLock());
if (!actionReturnValue.getSucceeded()) {
log.error("Error cloning Cinder disk '{}': {}", cinderDisk.getDiskAlias());
getReturnValue().setFault(actionReturnValue.getFault());
return;
}
Guid imageId = actionReturnValue.getActionReturnValue();
diskImageMap.put(cinderDisk.getId(), imageId);
}
srcDiskIdToTargetDiskIdMapping.putAll(diskImageMap);
}
Aggregations