public static List<KVMHostInventory> valueOf1(Collection<KVMHostVO> vos) { List<KVMHostInventory> invs = new ArrayList<KVMHostInventory>(); for (KVMHostVO vo : vos) { invs.add(valueOf(vo)); } return invs; }
@Override public HostInventory getHostInventory(String uuid) { KVMHostVO vo = dbf.findByUuid(uuid, KVMHostVO.class); return vo == null ? null : KVMHostInventory.valueOf(vo); }
@Override protected HostInventory getSelfInventory() { return KVMHostInventory.valueOf(getSelf()); }
@Override public HostInventory getHostInventory(HostVO vo) { KVMHostVO kvo = vo instanceof KVMHostVO ? (KVMHostVO) vo : dbf.findByUuid(vo.getUuid(), KVMHostVO.class); return KVMHostInventory.valueOf(kvo); }
public KVMHostContext createHostContext(KVMHostVO vo) { UriComponentsBuilder ub = UriComponentsBuilder.newInstance(); ub.scheme(KVMGlobalProperty.AGENT_URL_SCHEME); ub.host(vo.getManagementIp()); ub.port(KVMGlobalProperty.AGENT_PORT); if (!"".equals(KVMGlobalProperty.AGENT_URL_ROOT_PATH)) { ub.path(KVMGlobalProperty.AGENT_URL_ROOT_PATH); } String baseUrl = ub.build().toUriString(); KVMHostContext context = new KVMHostContext(); context.setInventory(KVMHostInventory.valueOf(vo)); context.setBaseUrl(baseUrl); return context; }
extEmitter.beforeRebootVmOnKvm(KVMHostInventory.valueOf(getSelf()), vminv); } catch (KVMException e) { String err = String.format("failed to reboot vm[uuid:%s name:%s] on kvm host[uuid:%s, ip:%s], because %s", vminv.getUuid(), vminv.getName(),
extEmitter.beforeStopVmOnKvm(KVMHostInventory.valueOf(getSelf()), vminv); } catch (KVMException e) { ErrorCode err = operr("failed to stop vm[uuid:%s name:%s] on kvm host[uuid:%s, ip:%s], because %s", vminv.getUuid(), vminv.getName(),
KVMHostInventory khinv = KVMHostInventory.valueOf(getSelf()); extEmitter.beforeStartVmOnKvm(khinv, spec, cmd);
extEmitter.beforeDestroyVmOnKvm(KVMHostInventory.valueOf(getSelf()), vminv); } catch (KVMException e) { ErrorCode err = operr("failed to destroy vm[uuid:%s name:%s] on kvm host[uuid:%s, ip:%s], because %s", vminv.getUuid(), vminv.getName(),