private void sendModifyTargetsCommand(ModifyTargetsCommand cmd, long hostId) { Answer answer = agentMgr.easySend(hostId, cmd); if (answer == null) { String msg = "Unable to get an answer to the modify targets command"; s_logger.warn(msg); } else if (!answer.getResult()) { String msg = "Unable to modify target on the following host: " + hostId; s_logger.warn(msg); } }
private void sendModifyTargetsCommand(ModifyTargetsCommand cmd, long hostId) { Answer answer = _agentMgr.easySend(hostId, cmd); if (answer == null) { String msg = "Unable to get an answer to the modify targets command"; s_logger.warn(msg); } else if (!answer.getResult()) { String msg = "Unable to modify target on the following host: " + hostId; s_logger.warn(msg); } }
private void sendModifyTargetsCommand(ModifyTargetsCommand cmd, long hostId) { Answer answer = _agentMgr.easySend(hostId, cmd); if (answer == null) { String msg = "Unable to get an answer to the modify targets command"; s_logger.warn(msg); } else if (!answer.getResult()) { String msg = "Unable to modify target on the following host: " + hostId; s_logger.warn(msg); } }
private void sendModifyTargetsCommand(ModifyTargetsCommand cmd, long hostId) { Answer answer = _agentMgr.easySend(hostId, cmd); if (answer == null) { String msg = "Unable to get an answer to the modify targets command"; s_logger.warn(msg); } else if (!answer.getResult()) { String msg = "Unable to modify target on the following host: " + hostId; s_logger.warn(msg); } }
private void sendModifyTargetsCommand(ModifyTargetsCommand cmd, long hostId) { Answer answer = agentMgr.easySend(hostId, cmd); if (answer == null) { String msg = "Unable to get an answer to the modify targets command"; LOGGER.warn(msg); } else if (!answer.getResult()) { String msg = "Unable to modify target on the following host: " + hostId; LOGGER.warn(msg); } }
@Override public boolean processAnswers(long agentId, long seq, Answer[] answers) { for (Answer answer : answers) { if (answer.getResult() == false) { s_logger.warn("Unable to execute sync command: " + answer.toString()); } else { s_logger.debug("Sync command executed: " + answer.toString()); } } return true; }
private void sendModifyTargetsCommand(ModifyTargetsCommand cmd, long hostId) { Answer answer = agentMgr.easySend(hostId, cmd); if (answer == null) { throw new CloudRuntimeException("Unable to get an answer to the modify targets command"); } if (!answer.getResult()) { String msg = "Unable to modify targets on the following host: " + hostId; throw new CloudRuntimeException(msg); } }
protected void sendPortForwardingRules(List<PortForwardingRuleTO> portForwardingRules, DataCenter zone, long externalFirewallId) throws ResourceUnavailableException { if (!portForwardingRules.isEmpty()) { SetPortForwardingRulesCommand cmd = new SetPortForwardingRulesCommand(portForwardingRules); Answer answer = _agentMgr.easySend(externalFirewallId, cmd); if (answer == null || !answer.getResult()) { String details = (answer != null) ? answer.getDetails() : "details unavailable"; String msg = "External firewall was unable to apply port forwarding rules to the SRX appliance in zone " + zone.getName() + " due to: " + details + "."; s_logger.error(msg); throw new ResourceUnavailableException(msg, DataCenter.class, zone.getId()); } } }
protected void sendFirewallRules(List<FirewallRuleTO> firewallRules, DataCenter zone, long externalFirewallId) throws ResourceUnavailableException { if (!firewallRules.isEmpty()) { SetFirewallRulesCommand cmd = new SetFirewallRulesCommand(firewallRules); Answer answer = _agentMgr.easySend(externalFirewallId, cmd); if (answer == null || !answer.getResult()) { String details = (answer != null) ? answer.getDetails() : "details unavailable"; String msg = "External firewall was unable to apply static nat rules to the SRX appliance in zone " + zone.getName() + " due to: " + details + "."; s_logger.error(msg); throw new ResourceUnavailableException(msg, DataCenter.class, zone.getId()); } } }
protected void sendStaticNatRules(List<StaticNatRuleTO> staticNatRules, DataCenter zone, long externalFirewallId) throws ResourceUnavailableException { if (!staticNatRules.isEmpty()) { SetStaticNatRulesCommand cmd = new SetStaticNatRulesCommand(staticNatRules, null); Answer answer = _agentMgr.easySend(externalFirewallId, cmd); if (answer == null || !answer.getResult()) { String details = (answer != null) ? answer.getDetails() : "details unavailable"; String msg = "External firewall was unable to apply static nat rules to the SRX appliance in zone " + zone.getName() + " due to: " + details + "."; s_logger.error(msg); throw new ResourceUnavailableException(msg, DataCenter.class, zone.getId()); } } }
@Override public boolean entityExist(EntityExistsCommand cmd, Long physicalNetworkId){ Long hostId = getNuageVspHostId(physicalNetworkId); if (hostId == null) { throw new CloudRuntimeException("There is no Nuage VSP device configured on physical network " + physicalNetworkId); } Answer answer = _agentMgr.easySend(hostId, cmd); if (answer != null) { return answer.getResult(); } throw new CloudRuntimeException("No answer received from the client"); }
/** * PlugNicAnswer: plug a network interface into a VM * @param cmd * @return */ public PlugNicAnswer execute(PlugNicCommand cmd) { Answer ans = plugNunplugNic(cmd.getNic(), cmd.getVmName(), true); return new PlugNicAnswer(cmd, ans.getResult(), ans.getDetails()); }
/** * UnPlugNicAnswer: remove a nic from a VM * @param cmd * @return */ public UnPlugNicAnswer execute(UnPlugNicCommand cmd) { Answer ans = plugNunplugNic(cmd.getNic(), cmd.getVmName(), false); return new UnPlugNicAnswer(cmd, ans.getResult(), ans.getDetails()); } }
public Void deleteCallback(AsyncCallbackDispatcher<SamplePrimaryDataStoreDriverImpl, Answer> callback, AsyncRpcContext<CommandResult> context) { CommandResult result = new CommandResult(); Answer answer = callback.getResult(); if (!answer.getResult()) { result.setResult(answer.getDetails()); } context.getParentCallback().complete(result); return null; }
@Override public boolean updateNuageUnderlayVlanIpRange(long vlanIpRangeId, boolean enabled) { VlanVO staticNatVlan = _vlanDao.findById(vlanIpRangeId); HostVO nuageVspHost = getNuageVspHost(staticNatVlan.getPhysicalNetworkId()); EntityExistsCommand<Vlan> cmd = new EntityExistsCommand<Vlan>(Vlan.class, staticNatVlan.getUuid()); Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd); if (answer != null && !answer.getResult()) { _vlanDetailsDao.addDetail(staticNatVlan.getId(), NuageVspManager.nuageUnderlayVlanIpRangeDetailKey, String.valueOf(enabled), false); return true; } return false; }
@Test public final void testDestroyCommand() { // TODO: how does the command vary when we are only deleting a vm versus // deleting a volume? // String sample2 = "{\"volume\":" + getSampleVolumeObjectTO() + "}"; String sample2 = "{\"volume\":{\"name\":\"" + s_testSampleVolumeWorkingUUIDNoExt + "\",\"storagePoolType\":\"Filesystem\"," + "\"mountPoint\":" + s_testLocalStorePathJSON + ",\"path\":" + s_testSampleVolumeTempURIJSON + ",\"storagePoolUuid\":\"" + s_testLocalStoreUUID + "\"," + "\"type\":\"ROOT\",\"id\":9,\"size\":0}}"; DestroyCommand cmd = s_gson.fromJson(sample2, DestroyCommand.class); Answer ans = s_hypervresource.executeRequest(cmd); Assert.assertTrue(ans.getDetails(), ans.getResult()); }
private void sendModifyTargetsCommand(ModifyTargetsCommand cmd, long hostId) { Answer answer = agentMgr.easySend(hostId, cmd); if (answer == null) { throw new CloudRuntimeException("Unable to get an answer to the modify targets command"); } if (!answer.getResult()) { String msg = "Unable to modify targets on the following host: " + hostId; HostVO host = hostDao.findById(hostId); alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), msg, msg); throw new CloudRuntimeException(msg); } }
@Test public final void testCreateStoragePoolCommand() { String folderName = "." + File.separator + "Dummy"; StoragePoolVO pool = createTestStoragePoolVO(folderName); CreateStoragePoolCommand cmd = new CreateStoragePoolCommand(true, pool); s_logger.debug("TestCreateStoragePoolCommand sending " + s_gson.toJson(cmd)); Answer ans = s_hypervresource.executeRequest(cmd); Assert.assertTrue(ans.getResult()); }
private void sendModifyTargetsCommand(ModifyTargetsCommand cmd, long hostId) { Answer answer = agentMgr.easySend(hostId, cmd); if (answer == null) { throw new CloudRuntimeException("Unable to get an answer to the modify targets command"); } if (!answer.getResult()) { String msg = "Unable to modify targets on the following host: " + hostId; HostVO host = hostDao.findById(hostId); alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), msg, msg); throw new CloudRuntimeException(msg); } }
@Test public final void testModifyStoragePoolCommand() { // Create dummy folder String folderName = "." + File.separator + "Dummy"; StoragePoolVO pool = createTestStoragePoolVO(folderName); ModifyStoragePoolCommand cmd = new ModifyStoragePoolCommand(true, pool, folderName); Answer ans = s_hypervresource.executeRequest(cmd); Assert.assertTrue(ans.getResult()); DeleteStoragePoolCommand delCmd = new DeleteStoragePoolCommand(pool, folderName); Answer ans2 = s_hypervresource.executeRequest(delCmd); Assert.assertTrue(ans2.getResult()); }