/** * Terremark does not provide vApp templates in the vDC resourceEntity list. Rather, you must * query the catalog. */ @Override public Set<? extends Image> get() { logger.debug(">> providing vAppTemplates"); return newLinkedHashSet(concat(transform(organizationsForLocations.apply(locations.get()), imagesInOrg))); } }
protected Hardware parseHardware(Server from) { try { return Iterables.find(hardwares.get(), new FindHardwareForServer(from)); } catch (NoSuchElementException e) { logger.debug("could not find a matching hardware for server %s", from); } return null; }
protected Hardware parseHardware(Server from) { Hardware hardware = null; try { hardware = Iterables.find(hardwares.get(), new FindHardwareForServer(from)); } catch (NoSuchElementException e) { logger.debug("could not find a matching hardware for server %s", from); } return hardware; } }
protected OperatingSystem parseOperatingSystem(Server from) { try { return Iterables.find(images.get(), new FindImageForServer(from)).getOperatingSystem(); } catch (NoSuchElementException e) { logger.debug("could not find a matching image for server %s in location %s", from, location.get()); } return null; } }
@Override public ListenableFuture<DriveInfo> apply(String input) { try { return Futures.immediateFuture(cache.getUnchecked(input)); } catch (CacheLoader.InvalidCacheLoadException e) { logger.debug("drive %s not found", input); } catch (UncheckedExecutionException e) { logger.warn(e, "error finding drive %s: %s", input, e.getMessage()); } return Futures.immediateFuture(null); }
public Date parseExpires(String expires) { try { return (expires != null) ? getExpiresDateCodec().toDate(expires) : null; } catch (IllegalArgumentException e) { logger.debug("Invalid Expires header (%s); should be in RFC-1123 format; treating as already expired: %s", expires, e.getMessage()); return new Date(0); } } }
protected void authorizeGroupToItself(String region, String name) { logger.debug(">> authorizing securityGroup region(%s) name(%s) permission to itself", region, name); String myOwnerId = Iterables.get(securityClient.describeSecurityGroupsInRegion(region, name), 0).getOwnerId(); securityClient.authorizeSecurityGroupIngressInRegion(region, name, new UserIdGroupPair(myOwnerId, name)); logger.debug("<< authorized securityGroup(%s)", name); }
public void awaitCompletion(Iterable<String> jobs) { logger.debug(">> awaiting completion of jobs(%s)", jobs); for (String job : jobs) awaitCompletion(job); logger.trace("<< completed jobs(%s)", jobs); }
public void disassociateIPAddresses(Set<String> ipAddresses) { for (String ipAddress : ipAddresses) { logger.debug(">> disassociating IPAddress(%s)", ipAddress); client.getAddressClient().disassociateIPAddress(ipAddress); } }
public void logResponse(Logger logger, HttpResponse response, String prefix) { if (logger.isDebugEnabled()) { logger.debug("%s %s", prefix, response.getStatusLine().toString()); logMessage(logger, response, prefix); } }
@Override public ZoneAndId apply(ZoneAndId id) { FloatingIPApi floatingIpApi = novaApi.getFloatingIPExtensionForZone(id.getZone()).get(); for (FloatingIP ip : floatingIpCache.getUnchecked(id)) { logger.debug(">> removing floatingIp(%s) from node(%s)", ip, id); floatingIpApi.removeFromServer(ip.getIp(), id.getId()); logger.debug(">> deallocating floatingIp(%s)", ip); floatingIpApi.delete(ip.getId()); } floatingIpCache.invalidate(id); return id; }
@Override public void rebootNode(String id) { String virtualMachineId = id; String job = client.getVirtualMachineClient().rebootVirtualMachine(virtualMachineId); if (job != null) { logger.debug(">> rebooting virtualMachine(%s) job(%s)", virtualMachineId, job); awaitCompletion(job); } }
@Override public void suspendNode(String id) { String virtualMachineId = id; String job = client.getVirtualMachineClient().stopVirtualMachine(id); if (job != null) { logger.debug(">> stopping virtualMachine(%s) job(%s)", virtualMachineId, job); awaitCompletion(job); } }
public void execute(OrgAndName orgTag) { for (KeyPair keyPair : terremarkClient.listKeyPairsInOrg(orgTag.getOrg())) { if (keyPair.getName().matches("jclouds_" + orgTag.getName().replaceAll("-", "_") + "_[0-9a-f]+")) { logger.debug(">> deleting keyPair(%s)", keyPair.getName()); terremarkClient.deleteKeyPair(keyPair.getId()); logger.debug("<< deleted keyPair(%s)", keyPair.getName()); credentialStore.remove("group#" + orgTag.getName()); } } } }
private void powerOffAndWait(VApp vApp) { logger.debug(">> powering off vApp(%s), current status: %s", vApp.getName(), vApp.getStatus()); Task task = client.powerOffVApp(vApp.getHref()); if (!taskTester.apply(task.getHref())) throw new RuntimeException(String.format("failed to %s %s: %s", "powerOff", vApp.getName(), task)); }
@Override public void resumeNode(String id) { String virtualMachineId = id; String job = client.getVirtualMachineClient().startVirtualMachine(id); if (job != null) { logger.debug(">> starting virtualMachine(%s) job(%s)", virtualMachineId, job); awaitCompletion(job); } }
private void authorizeGroupToItselfAndAllIPsToTCPPort(SecurityGroupApi securityGroupApi, SecurityGroup securityGroup, int port) { logger.debug(">> authorizing securityGroup(%s) permission to 0.0.0.0/0 on port %d", securityGroup, port); securityGroupApi.createRuleAllowingCidrBlock(securityGroup.getId(), Ingress.builder().ipProtocol( IpProtocol.TCP).fromPort(port).toPort(port).build(), "0.0.0.0/0"); logger.debug("<< authorized securityGroup(%s) permission to 0.0.0.0/0 on port %d", securityGroup, port); } }
protected ExecResponse runCommand(String command) { ExecResponse returnVal; logger.debug(">> running [%s] as %s@%s", command.replace(node.getCredentials().getPassword() != null ? node .getCredentials().getPassword() : "XXXXX", "XXXXX"), ssh.getUsername(), ssh.getHostAddress()); returnVal = ssh.exec(command); return returnVal; }
@Override protected void interruptTask() { logger.debug("<< cancelled(%s)", commandRunner.getStatement().getInstanceName()); ExecResponse returnVal = commandRunner.refreshAndRunAction("stop"); CancellationException e = new CancellationException(String.format( "cancelled %s on node: %s; stop command had exit status: %s", getCommandRunner().getStatement() .getInstanceName(), getCommandRunner().getNode().getId(), returnVal)); eventBus.post(new StatementOnNodeFailure(getCommandRunner().getStatement(), getCommandRunner().getNode(), e)); super.interruptTask(); }
public HTTPRequest filterLogAndConvertRe(HttpRequest request) { for (HttpRequestFilter filter : request.getFilters()) { request = filter.filter(request); } checkRequestHasContentLengthOrChunkedEncoding(request, "After filtering, the request has neither chunked encoding nor content length: " + request); logger.debug("Sending request %s: %s", request.hashCode(), request.getRequestLine()); wirePayloadIfEnabled(wire, request); HTTPRequest nativeRequest = convertToGaeRequest.apply(request); utils.logRequest(headerLog, request, ">>"); return nativeRequest; }