use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.
the class VmListModel method changeCD.
private void changeCD() {
final VM vm = getSelectedItem();
if (vm == null) {
return;
}
AttachCdModel model = new AttachCdModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().changeCDTitle());
model.setHelpTag(HelpTag.change_cd);
// $NON-NLS-1$
model.setHashName("change_cd");
AttachCdModel attachCdModel = (AttachCdModel) getWindow();
List<RepoImage> images1 = new ArrayList<>(Arrays.asList(new RepoImage(ConstantsManager.getInstance().getConstants().noCds())));
attachCdModel.getIsoImage().setItems(images1);
attachCdModel.getIsoImage().setSelectedItem(Linq.firstOrNull(images1));
ImagesDataProvider.getISOImagesList(new AsyncQuery<>(images -> {
AttachCdModel _attachCdModel = (AttachCdModel) getWindow();
RepoImage eject = new RepoImage(ConsoleModel.getEjectLabel());
images.add(0, eject);
_attachCdModel.getIsoImage().setItems(images);
if (_attachCdModel.getIsoImage().getIsChangable()) {
RepoImage selectedIso = Linq.firstOrNull(images, s -> vm.getCurrentCd() != null && vm.getCurrentCd().equals(s.getRepoImageId()));
_attachCdModel.getIsoImage().setSelectedItem(selectedIso == null ? eject : selectedIso);
}
}), vm.getStoragePoolId());
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnChangeCD", this);
model.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(tempVar2);
}
use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.
the class VmModelBehaviorBase method updateSelectedCdImage.
protected void updateSelectedCdImage(VmBase vmBase) {
boolean hasCd = !StringHelper.isNullOrEmpty(vmBase.getIsoPath());
if (hasCd) {
getModel().getCdImage().setSelectedItem(new RepoImage(vmBase.getIsoPath()));
}
getModel().getCdImage().setIsChangeable(hasCd);
getModel().getCdAttached().setEntity(hasCd);
}
use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.
the class VmModelBehaviorBase method setImagesToModel.
protected void setImagesToModel(UnitVmModel model, List<RepoImage> images) {
RepoImage oldCdImage = model.getCdImage().getSelectedItem();
model.getCdImage().setItems(images);
model.getCdImage().setSelectedItem((oldCdImage != null) ? oldCdImage : Linq.firstOrNull(images));
}
use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.
the class OpenStackImageProviderProxy method getAllImagesAsRepoImages.
public List<RepoImage> getAllImagesAsRepoImages(Integer listSize, Integer totalListSize) {
ArrayList<RepoImage> repoImages = new ArrayList<>();
long currentTime = System.currentTimeMillis();
Images images = null;
do {
OpenStackRequest<Images> listRequest = getClient().images().list(true).queryParam("limit", listSize).queryParam("sort_key", "name").queryParam("sort_dir", "asc");
if (images != null) {
listRequest.queryParam("marker", images.getList().get(images.getList().size() - 1).getId());
}
images = listRequest.execute();
for (Image glanceImage : images) {
RepoImage repoImage = imageToRepoImage(glanceImage);
repoImage.setLastRefreshed(currentTime);
repoImages.add(repoImage);
}
} while ((images.getList().size() >= listSize) && (totalListSize != null && repoImages.size() < totalListSize));
return repoImages;
}
use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.
the class BackendStorageDomainImageResourceTest method getEntity.
@Override
protected RepoImage getEntity(int index) {
RepoImage entity = new RepoImage();
entity.setRepoImageId(GUIDS[index].toString());
entity.setFileType(ImageFileType.Disk);
entity.setRepoImageName("RepoImage " + entity.getRepoImageId());
return entity;
}
Aggregations