mirror of https://github.com/apache/cloudstack.git
Log4j2 refactor cloud api module (#8728)
This commit is contained in:
parent
bb5da0e49c
commit
13f805fbf3
|
|
@ -119,8 +119,7 @@ public class OVFHelper {
|
||||||
boolean password = StringUtils.isNotBlank(passStr) && passStr.equalsIgnoreCase("true");
|
boolean password = StringUtils.isNotBlank(passStr) && passStr.equalsIgnoreCase("true");
|
||||||
String label = ovfParser.getChildNodeValue(node, "Label");
|
String label = ovfParser.getChildNodeValue(node, "Label");
|
||||||
String description = ovfParser.getChildNodeValue(node, "Description");
|
String description = ovfParser.getChildNodeValue(node, "Description");
|
||||||
logger.debug("Creating OVF property index " + index + (category == null ? "" : " for category " + category)
|
logger.debug("Creating OVF property index {} {} with key = {}", index, (category == null ? "" : " for category " + category), key);
|
||||||
+ " with key = " + key);
|
|
||||||
return new OVFPropertyTO(key, type, value, qualifiers, userConfigurable,
|
return new OVFPropertyTO(key, type, value, qualifiers, userConfigurable,
|
||||||
label, description, password, index, category);
|
label, description, password, index, category);
|
||||||
}
|
}
|
||||||
|
|
@ -152,7 +151,7 @@ public class OVFHelper {
|
||||||
if (child.getNodeName().equalsIgnoreCase("Category") ||
|
if (child.getNodeName().equalsIgnoreCase("Category") ||
|
||||||
child.getNodeName().endsWith(":Category")) {
|
child.getNodeName().endsWith(":Category")) {
|
||||||
lastCategoryFound = child.getTextContent();
|
lastCategoryFound = child.getTextContent();
|
||||||
logger.info("Category found " + lastCategoryFound);
|
logger.info("Category found {}", lastCategoryFound);
|
||||||
} else if (child.getNodeName().equalsIgnoreCase("Property") ||
|
} else if (child.getNodeName().equalsIgnoreCase("Property") ||
|
||||||
child.getNodeName().endsWith(":Property")) {
|
child.getNodeName().endsWith(":Property")) {
|
||||||
OVFPropertyTO prop = createOVFPropertyFromNode(child, propertyIndex, lastCategoryFound);
|
OVFPropertyTO prop = createOVFPropertyFromNode(child, propertyIndex, lastCategoryFound);
|
||||||
|
|
@ -250,13 +249,13 @@ public class OVFHelper {
|
||||||
int diskNumber = 0;
|
int diskNumber = 0;
|
||||||
for (OVFVirtualHardwareItemTO diskItem : diskHardwareItems) {
|
for (OVFVirtualHardwareItemTO diskItem : diskHardwareItems) {
|
||||||
if (StringUtils.isBlank(diskItem.getHostResource())) {
|
if (StringUtils.isBlank(diskItem.getHostResource())) {
|
||||||
logger.error("Missing disk information for hardware item " + diskItem.getElementName() + " " + diskItem.getInstanceId());
|
logger.error("Missing disk information for hardware item {} {}", diskItem.getElementName(), diskItem.getInstanceId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String diskId = extractDiskIdFromDiskHostResource(diskItem.getHostResource());
|
String diskId = extractDiskIdFromDiskHostResource(diskItem.getHostResource());
|
||||||
OVFDisk diskDefinition = getDiskDefinitionFromDiskId(diskId, disks);
|
OVFDisk diskDefinition = getDiskDefinitionFromDiskId(diskId, disks);
|
||||||
if (diskDefinition == null) {
|
if (diskDefinition == null) {
|
||||||
logger.error("Missing disk definition for disk ID " + diskId);
|
logger.error("Missing disk definition for disk ID {}", diskId);
|
||||||
}
|
}
|
||||||
OVFFile fileDefinition = getFileDefinitionFromDiskDefinition(diskDefinition._fileRef, files);
|
OVFFile fileDefinition = getFileDefinitionFromDiskDefinition(diskDefinition._fileRef, files);
|
||||||
DatadiskTO datadiskTO = generateDiskTO(fileDefinition, diskDefinition, ovfParentPath, diskNumber, diskItem);
|
DatadiskTO datadiskTO = generateDiskTO(fileDefinition, diskDefinition, ovfParentPath, diskNumber, diskItem);
|
||||||
|
|
@ -278,7 +277,7 @@ public class OVFHelper {
|
||||||
if (StringUtils.isNotBlank(path)) {
|
if (StringUtils.isNotBlank(path)) {
|
||||||
File f = new File(path);
|
File f = new File(path);
|
||||||
if (!f.exists() || f.isDirectory()) {
|
if (!f.exists() || f.isDirectory()) {
|
||||||
logger.error("One of the attached disk or iso does not exists " + path);
|
logger.error("One of the attached disk or iso does not exists {}", path);
|
||||||
throw new InternalErrorException("One of the attached disk or iso as stated on OVF does not exists " + path);
|
throw new InternalErrorException("One of the attached disk or iso as stated on OVF does not exists " + path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -334,9 +333,7 @@ public class OVFHelper {
|
||||||
od._controller = getControllerType(items, od._diskId);
|
od._controller = getControllerType(items, od._diskId);
|
||||||
vd.add(od);
|
vd.add(od);
|
||||||
}
|
}
|
||||||
if (logger.isTraceEnabled()) {
|
logger.trace("Found {} disk definitions", vd.size());
|
||||||
logger.trace(String.format("found %d disk definitions",vd.size()));
|
|
||||||
}
|
|
||||||
return vd;
|
return vd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -366,9 +363,7 @@ public class OVFHelper {
|
||||||
vf.add(of);
|
vf.add(of);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (logger.isTraceEnabled()) {
|
logger.trace("Found {} file definitions in {}", vf.size(), ovfFile.getPath());
|
||||||
logger.trace(String.format("found %d file definitions in %s",vf.size(), ovfFile.getPath()));
|
|
||||||
}
|
|
||||||
return vf;
|
return vf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -506,7 +501,7 @@ public class OVFHelper {
|
||||||
outfile.write(writer.toString());
|
outfile.write(writer.toString());
|
||||||
outfile.close();
|
outfile.close();
|
||||||
} catch (IOException | TransformerException e) {
|
} catch (IOException | TransformerException e) {
|
||||||
logger.info("Unexpected exception caught while rewriting OVF:" + e.getMessage(), e);
|
logger.info("Unexpected exception caught while rewriting OVF: {}", e.getMessage(), e);
|
||||||
throw new CloudRuntimeException(e);
|
throw new CloudRuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -522,9 +517,7 @@ public class OVFHelper {
|
||||||
|
|
||||||
public List<OVFNetworkTO> getNetPrerequisitesFromDocument(Document doc) throws InternalErrorException {
|
public List<OVFNetworkTO> getNetPrerequisitesFromDocument(Document doc) throws InternalErrorException {
|
||||||
if (doc == null) {
|
if (doc == null) {
|
||||||
if (logger.isTraceEnabled()) {
|
logger.trace("No document to parse; returning no prerequisite networks");
|
||||||
logger.trace("no document to parse; returning no prerequisite networks");
|
|
||||||
}
|
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -540,9 +533,7 @@ public class OVFHelper {
|
||||||
private void matchNicsToNets(Map<String, OVFNetworkTO> nets, Node systemElement) {
|
private void matchNicsToNets(Map<String, OVFNetworkTO> nets, Node systemElement) {
|
||||||
final DocumentTraversal traversal = (DocumentTraversal) systemElement;
|
final DocumentTraversal traversal = (DocumentTraversal) systemElement;
|
||||||
final NodeIterator iterator = traversal.createNodeIterator(systemElement, NodeFilter.SHOW_ELEMENT, null, true);
|
final NodeIterator iterator = traversal.createNodeIterator(systemElement, NodeFilter.SHOW_ELEMENT, null, true);
|
||||||
if (logger.isTraceEnabled()) {
|
logger.trace("Starting out with {} network-prerequisites, parsing hardware", nets.size());
|
||||||
logger.trace(String.format("starting out with %d network-prerequisites, parsing hardware",nets.size()));
|
|
||||||
}
|
|
||||||
int nicCount = 0;
|
int nicCount = 0;
|
||||||
for (Node n = iterator.nextNode(); n != null; n = iterator.nextNode()) {
|
for (Node n = iterator.nextNode(); n != null; n = iterator.nextNode()) {
|
||||||
final Element e = (Element) n;
|
final Element e = (Element) n;
|
||||||
|
|
@ -550,9 +541,7 @@ public class OVFHelper {
|
||||||
nicCount++;
|
nicCount++;
|
||||||
String name = e.getTextContent(); // should be in our nets
|
String name = e.getTextContent(); // should be in our nets
|
||||||
if(nets.get(name) == null) {
|
if(nets.get(name) == null) {
|
||||||
if(logger.isInfoEnabled()) {
|
logger.info("Found a nic definition without a network definition by name {}, adding it to the list.", name);
|
||||||
logger.info(String.format("found a nic definition without a network definition byname %s, adding it to the list.", name));
|
|
||||||
}
|
|
||||||
nets.put(name, new OVFNetworkTO());
|
nets.put(name, new OVFNetworkTO());
|
||||||
}
|
}
|
||||||
OVFNetworkTO thisNet = nets.get(name);
|
OVFNetworkTO thisNet = nets.get(name);
|
||||||
|
|
@ -561,9 +550,7 @@ public class OVFHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (logger.isTraceEnabled()) {
|
logger.trace("Ending up with {} network-prerequisites, parsed {} nics", nets.size(), nicCount);
|
||||||
logger.trace(String.format("ending up with %d network-prerequisites, parsed %d nics", nets.size(), nicCount));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -585,7 +572,7 @@ public class OVFHelper {
|
||||||
int addressOnParent = Integer.parseInt(addressOnParentStr);
|
int addressOnParent = Integer.parseInt(addressOnParentStr);
|
||||||
nic.setAddressOnParent(addressOnParent);
|
nic.setAddressOnParent(addressOnParent);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
logger.warn("Encountered element of type \"AddressOnParent\", that could not be parse to an integer number: " + addressOnParentStr);
|
logger.warn("Encountered element of type \"AddressOnParent\", that could not be parse to an integer number: {}", addressOnParentStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean automaticAllocation = StringUtils.isNotBlank(automaticAllocationStr) && Boolean.parseBoolean(automaticAllocationStr);
|
boolean automaticAllocation = StringUtils.isNotBlank(automaticAllocationStr) && Boolean.parseBoolean(automaticAllocationStr);
|
||||||
|
|
@ -597,7 +584,7 @@ public class OVFHelper {
|
||||||
int instanceId = Integer.parseInt(instanceIdStr);
|
int instanceId = Integer.parseInt(instanceIdStr);
|
||||||
nic.setInstanceID(instanceId);
|
nic.setInstanceID(instanceId);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
logger.warn("Encountered element of type \"InstanceID\", that could not be parse to an integer number: " + instanceIdStr);
|
logger.warn("Encountered element of type \"InstanceID\", that could not be parse to an integer number: {}", instanceIdStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
nic.setResourceSubType(resourceSubType);
|
nic.setResourceSubType(resourceSubType);
|
||||||
|
|
@ -630,9 +617,7 @@ public class OVFHelper {
|
||||||
|
|
||||||
nets.put(networkName,network);
|
nets.put(networkName,network);
|
||||||
}
|
}
|
||||||
if (logger.isTraceEnabled()) {
|
logger.trace("Found {} networks in template", nets.size());
|
||||||
logger.trace(String.format("found %d networks in template", nets.size()));
|
|
||||||
}
|
|
||||||
return nets;
|
return nets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -771,7 +756,7 @@ public class OVFHelper {
|
||||||
try {
|
try {
|
||||||
return Long.parseLong(value);
|
return Long.parseLong(value);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
logger.debug("Could not parse the value: " + value + ", ignoring it");
|
logger.debug("Could not parse the value: {}, ignoring it", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -782,7 +767,7 @@ public class OVFHelper {
|
||||||
try {
|
try {
|
||||||
return Integer.parseInt(value);
|
return Integer.parseInt(value);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
logger.debug("Could not parse the value: " + value + ", ignoring it");
|
logger.debug("Could not parse the value: {}, ignoring it", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -820,7 +805,7 @@ public class OVFHelper {
|
||||||
try {
|
try {
|
||||||
compressedLicense = compressOVFEula(eulaLicense);
|
compressedLicense = compressOVFEula(eulaLicense);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("Could not compress the license for info " + eulaInfo);
|
logger.error("Could not compress the license for info {}", eulaInfo);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
OVFEulaSectionTO eula = new OVFEulaSectionTO(eulaInfo, compressedLicense, eulaIndex);
|
OVFEulaSectionTO eula = new OVFEulaSectionTO(eulaInfo, compressedLicense, eulaIndex);
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class OVFParser {
|
||||||
documentBuilderFactory.setNamespaceAware(true);
|
documentBuilderFactory.setNamespaceAware(true);
|
||||||
documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
||||||
} catch (ParserConfigurationException e) {
|
} catch (ParserConfigurationException e) {
|
||||||
logger.error("Cannot start the OVF parser: " + e.getMessage(), e);
|
logger.error("Cannot start the OVF parser: {}", e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,7 +70,7 @@ public class OVFParser {
|
||||||
try {
|
try {
|
||||||
return documentBuilder.parse(new File(ovfFilePath));
|
return documentBuilder.parse(new File(ovfFilePath));
|
||||||
} catch (SAXException | IOException e) {
|
} catch (SAXException | IOException e) {
|
||||||
logger.error("Error parsing " + ovfFilePath + " " + e.getMessage(), e);
|
logger.error("Error parsing {} {}", ovfFilePath, e.getMessage(), e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -132,10 +132,10 @@ public enum RoleType {
|
||||||
* */
|
* */
|
||||||
public static Account.Type getAccountTypeByRole(final Role role, final Account.Type defautAccountType) {
|
public static Account.Type getAccountTypeByRole(final Role role, final Account.Type defautAccountType) {
|
||||||
if (role != null) {
|
if (role != null) {
|
||||||
LOGGER.debug(String.format("Role [%s] is not null; therefore, we use its account type [%s].", role, defautAccountType));
|
LOGGER.debug("Role [{}] is not null; therefore, we use its account type [{}].", role, defautAccountType);
|
||||||
return role.getRoleType().getAccountType();
|
return role.getRoleType().getAccountType();
|
||||||
}
|
}
|
||||||
LOGGER.debug(String.format("Role is null; therefore, we use the default account type [%s] value.", defautAccountType));
|
LOGGER.debug("Role is null; therefore, we use the default account type [{}] value.", defautAccountType);
|
||||||
return defautAccountType;
|
return defautAccountType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -382,7 +382,7 @@ public abstract class BaseCmd {
|
||||||
if (roleIsAllowed) {
|
if (roleIsAllowed) {
|
||||||
validFields.add(field);
|
validFields.add(field);
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Ignoring parameter " + parameterAnnotation.name() + " as the caller is not authorized to pass it in");
|
logger.debug("Ignoring parameter {} as the caller is not authorized to pass it in", parameterAnnotation.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public class DeleteCounterCmd extends BaseAsyncCmd {
|
||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Failed to delete counter with Id: " + getId());
|
logger.warn("Failed to delete counter with Id: {}", getId());
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete counter.");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete counter.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ public class UpdateBackupOfferingCmd extends BaseCmd {
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} catch (CloudRuntimeException e) {
|
} catch (CloudRuntimeException e) {
|
||||||
ApiErrorCode paramError = e instanceof InvalidParameterValueException ? ApiErrorCode.PARAM_ERROR : ApiErrorCode.INTERNAL_ERROR;
|
ApiErrorCode paramError = e instanceof InvalidParameterValueException ? ApiErrorCode.PARAM_ERROR : ApiErrorCode.INTERNAL_ERROR;
|
||||||
logger.error(String.format("Failed to update Backup Offering [id: %s] due to: [%s].", id, e.getMessage()), e);
|
logger.error("Failed to update Backup Offering [id: {}] due to: [{}].", id, e.getMessage(), e);
|
||||||
throw new ServerApiException(paramError, e.getMessage());
|
throw new ServerApiException(paramError, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ public class UploadTemplateDirectDownloadCertificateCmd extends BaseCmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.debug("Uploading certificate " + name + " to agents for Direct Download");
|
logger.debug("Uploading certificate {} to agents for Direct Download", name);
|
||||||
Pair<DirectDownloadCertificate, List<HostCertificateStatus>> uploadStatus =
|
Pair<DirectDownloadCertificate, List<HostCertificateStatus>> uploadStatus =
|
||||||
directDownloadManager.uploadCertificateToHosts(certificate, name, hypervisor, zoneId, hostId);
|
directDownloadManager.uploadCertificateToHosts(certificate, name, hypervisor, zoneId, hostId);
|
||||||
DirectDownloadCertificate certificate = uploadStatus.first();
|
DirectDownloadCertificate certificate = uploadStatus.first();
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ public class UpdateHostCmd extends BaseCmd {
|
||||||
this.setResponseObject(hostResponse);
|
this.setResponseObject(hostResponse);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Host host = _entityMgr.findById(Host.class, getId());
|
Host host = _entityMgr.findById(Host.class, getId());
|
||||||
logger.debug("Failed to update host: {} with id {}", host, getId(), e);
|
logger.error("Failed to update {}", host, e);
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to update host: %s with id %d, %s", host, getId(), e.getMessage()));
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to update host: %s with id %d, %s", host, getId(), e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ public class DeleteManagementNetworkIpRangeCmd extends BaseAsyncCmd {
|
||||||
logger.warn("Exception: ", ex);
|
logger.warn("Exception: ", ex);
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn("Failed to delete management ip range from " + getStartIp() + " to " + getEndIp() + " of Pod: " + getPodId(), e);
|
logger.warn("Failed to delete management ip range from {} to {} of Pod: {}", getStartIp(), getEndIp(), getPodId(), e);
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ public class DeleteStorageNetworkIpRangeCmd extends BaseAsyncCmd {
|
||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn("Failed to delete storage network ip range " + getId(), e);
|
logger.warn("Failed to delete storage network ip range {}", getId(), e);
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ public class ListStorageNetworkIpRangeCmd extends BaseListCmd {
|
||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn("Failed to list storage network ip range for rangeId=" + getRangeId() + " podId=" + getPodId() + " zoneId=" + getZoneId());
|
logger.warn("Failed to list storage network ip range for rangeId={} podId={} zoneId={}", getRangeId(), getPodId(), getZoneId());
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ public class UpdatePodManagementNetworkIpRangeCmd extends BaseAsyncCmd {
|
||||||
logger.warn("Exception: ", ex);
|
logger.warn("Exception: ", ex);
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn("Failed to update pod management IP range " + getNewStartIP() + "-" + getNewEndIP() + " of Pod: " + getPodId(), e);
|
logger.warn("Failed to update pod management IP range {}-{} of Pod: {}", getNewStartIP(), getNewEndIP(), getPodId(), e);
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,7 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
|
||||||
logger.warn("Exception: ", ex);
|
logger.warn("Exception: ", ex);
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||||
} catch (InsufficientCapacityException ex) {
|
} catch (InsufficientCapacityException ex) {
|
||||||
logger.info(ex);
|
logger.error(ex);
|
||||||
throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -201,9 +201,7 @@ public class ImportUnmanagedInstanceCmd extends BaseAsyncCmd {
|
||||||
for (Map<String, String> entry : (Collection<Map<String, String>>)nicNetworkList.values()) {
|
for (Map<String, String> entry : (Collection<Map<String, String>>)nicNetworkList.values()) {
|
||||||
String nic = entry.get(VmDetailConstants.NIC);
|
String nic = entry.get(VmDetailConstants.NIC);
|
||||||
String networkUuid = entry.get(VmDetailConstants.NETWORK);
|
String networkUuid = entry.get(VmDetailConstants.NETWORK);
|
||||||
if (logger.isDebugEnabled()) {
|
logger.debug("Checking if NIC '{}' can be mapped on network '{}'", nic, networkUuid);
|
||||||
logger.debug(String.format("nic, '%s', goes on net, '%s'", nic, networkUuid));
|
|
||||||
}
|
|
||||||
if (StringUtils.isAnyEmpty(nic, networkUuid) || _entityMgr.findByUuid(Network.class, networkUuid) == null) {
|
if (StringUtils.isAnyEmpty(nic, networkUuid) || _entityMgr.findByUuid(Network.class, networkUuid) == null) {
|
||||||
throw new InvalidParameterValueException(String.format("Network ID: %s for NIC ID: %s is invalid", networkUuid, nic));
|
throw new InvalidParameterValueException(String.format("Network ID: %s for NIC ID: %s is invalid", networkUuid, nic));
|
||||||
}
|
}
|
||||||
|
|
@ -219,9 +217,7 @@ public class ImportUnmanagedInstanceCmd extends BaseAsyncCmd {
|
||||||
for (Map<String, String> entry : (Collection<Map<String, String>>)nicIpAddressList.values()) {
|
for (Map<String, String> entry : (Collection<Map<String, String>>)nicIpAddressList.values()) {
|
||||||
String nic = entry.get(VmDetailConstants.NIC);
|
String nic = entry.get(VmDetailConstants.NIC);
|
||||||
String ipAddress = StringUtils.defaultIfEmpty(entry.get(VmDetailConstants.IP4_ADDRESS), null);
|
String ipAddress = StringUtils.defaultIfEmpty(entry.get(VmDetailConstants.IP4_ADDRESS), null);
|
||||||
if (logger.isDebugEnabled()) {
|
logger.debug("Checking if IP address '{}' can be mapped to NIC '{}'", ipAddress, nic);
|
||||||
logger.debug(String.format("nic, '%s', gets ip, '%s'", nic, ipAddress));
|
|
||||||
}
|
|
||||||
if (StringUtils.isEmpty(nic)) {
|
if (StringUtils.isEmpty(nic)) {
|
||||||
throw new InvalidParameterValueException(String.format("NIC ID: '%s' is invalid for IP address mapping", nic));
|
throw new InvalidParameterValueException(String.format("NIC ID: '%s' is invalid for IP address mapping", nic));
|
||||||
}
|
}
|
||||||
|
|
@ -244,9 +240,7 @@ public class ImportUnmanagedInstanceCmd extends BaseAsyncCmd {
|
||||||
for (Map<String, String> entry : (Collection<Map<String, String>>)dataDiskToDiskOfferingList.values()) {
|
for (Map<String, String> entry : (Collection<Map<String, String>>)dataDiskToDiskOfferingList.values()) {
|
||||||
String disk = entry.get(VmDetailConstants.DISK);
|
String disk = entry.get(VmDetailConstants.DISK);
|
||||||
String offeringUuid = entry.get(VmDetailConstants.DISK_OFFERING);
|
String offeringUuid = entry.get(VmDetailConstants.DISK_OFFERING);
|
||||||
if (logger.isTraceEnabled()) {
|
logger.trace("Checking if offering '{}' can be used on disk '{}'", offeringUuid, disk);
|
||||||
logger.trace(String.format("disk, '%s', gets offering, '%s'", disk, offeringUuid));
|
|
||||||
}
|
|
||||||
if (StringUtils.isAnyEmpty(disk, offeringUuid) || _entityMgr.findByUuid(DiskOffering.class, offeringUuid) == null) {
|
if (StringUtils.isAnyEmpty(disk, offeringUuid) || _entityMgr.findByUuid(DiskOffering.class, offeringUuid) == null) {
|
||||||
throw new InvalidParameterValueException(String.format("Disk offering ID: %s for disk ID: %s is invalid", offeringUuid, disk));
|
throw new InvalidParameterValueException(String.format("Disk offering ID: %s for disk ID: %s is invalid", offeringUuid, disk));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ public class MigrateVirtualMachineWithVolumeCmd extends BaseAsyncCmd {
|
||||||
Host destinationHost = _resourceService.getHost(getHostId());
|
Host destinationHost = _resourceService.getHost(getHostId());
|
||||||
// OfflineVmwareMigration: destination host would have to not be a required parameter for stopped VMs
|
// OfflineVmwareMigration: destination host would have to not be a required parameter for stopped VMs
|
||||||
if (destinationHost == null) {
|
if (destinationHost == null) {
|
||||||
logger.error(String.format("Unable to find the host with ID [%s].", getHostId()));
|
logger.error("Unable to find the host with ID [{}].", getHostId());
|
||||||
throw new InvalidParameterValueException("Unable to find the specified host to migrate the VM.");
|
throw new InvalidParameterValueException("Unable to find the specified host to migrate the VM.");
|
||||||
}
|
}
|
||||||
return destinationHost;
|
return destinationHost;
|
||||||
|
|
|
||||||
|
|
@ -224,10 +224,8 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
|
||||||
Iterator<? extends Map<String, String>> iter = servicesCollection.iterator();
|
Iterator<? extends Map<String, String>> iter = servicesCollection.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Map<String, String> obj = iter.next();
|
Map<String, String> obj = iter.next();
|
||||||
if (logger.isTraceEnabled()) {
|
logger.trace("Service provider entry specified: {}", obj);
|
||||||
logger.trace("service provider entry specified: " + obj);
|
HashMap<String, String> services = (HashMap<String, String>)obj;
|
||||||
}
|
|
||||||
HashMap<String, String> services = (HashMap<String, String>) obj;
|
|
||||||
String service = services.get("service");
|
String service = services.get("service");
|
||||||
String provider = services.get("provider");
|
String provider = services.get("provider");
|
||||||
List<String> providerList = null;
|
List<String> providerList = null;
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ public class DeleteAutoScalePolicyCmd extends BaseAsyncCmd {
|
||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
setResponseObject(response);
|
setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Failed to delete autoscale policy " + getId());
|
logger.warn("Failed to delete autoscale policy {}", getId());
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete AutoScale Policy");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete AutoScale Policy");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd {
|
||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
setResponseObject(response);
|
setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Failed to delete autoscale vm group " + getId());
|
logger.warn("Failed to delete autoscale vm group {}", getId());
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm group");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm group");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd {
|
||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
setResponseObject(response);
|
setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Failed to delete autoscale vm profile " + getId());
|
logger.warn("Failed to delete autoscale vm profile {}", getId());
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm profile");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm profile");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ public class DeleteConditionCmd extends BaseAsyncCmd {
|
||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
setResponseObject(response);
|
setResponseObject(response);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Failed to delete condition " + getId());
|
logger.warn("Failed to delete condition {}", getId());
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete condition.");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete condition.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ public class ListBackupsCmd extends BaseListProjectAndAccountResourcesCmd {
|
||||||
Pair<List<Backup>, Integer> result = backupManager.listBackups(this);
|
Pair<List<Backup>, Integer> result = backupManager.listBackups(this);
|
||||||
setupResponseBackupList(result.first(), result.second());
|
setupResponseBackupList(result.first(), result.second());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.debug("Exception while listing backups", e);
|
logger.error("Exception while listing backups", e);
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -255,11 +255,8 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F
|
||||||
}
|
}
|
||||||
} catch (NetworkRuleConflictException ex) {
|
} catch (NetworkRuleConflictException ex) {
|
||||||
String message = "Network rule conflict: ";
|
String message = "Network rule conflict: ";
|
||||||
if (!logger.isTraceEnabled()) {
|
logger.error("{}{}", message, ex.getMessage());
|
||||||
logger.info(message + ex.getMessage());
|
logger.trace(message, ex);
|
||||||
} else {
|
|
||||||
logger.trace(message, ex);
|
|
||||||
}
|
|
||||||
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
|
||||||
setEntityUuid(result.getUuid());
|
setEntityUuid(result.getUuid());
|
||||||
}
|
}
|
||||||
} catch (NetworkRuleConflictException ex) {
|
} catch (NetworkRuleConflictException ex) {
|
||||||
logger.trace("Network Rule Conflict: ", ex);
|
logger.error("Network Rule Conflict: ", ex);
|
||||||
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage(), ex);
|
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,10 +95,10 @@ public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd implements Use
|
||||||
public void execute() {
|
public void execute() {
|
||||||
Pair<List<? extends UserVm>, List<String>> vmServiceMap = _lbService.listLoadBalancerInstances(this);
|
Pair<List<? extends UserVm>, List<String>> vmServiceMap = _lbService.listLoadBalancerInstances(this);
|
||||||
List<? extends UserVm> result = vmServiceMap.first();
|
List<? extends UserVm> result = vmServiceMap.first();
|
||||||
logger.debug(String.format("A total of [%s] user VMs were obtained when listing the load balancer instances: [%s].", result.size(), result));
|
logger.debug("A total of [{}] user VMs were obtained when listing the load balancer instances: [{}].", result.size(), result);
|
||||||
|
|
||||||
List<String> serviceStates = vmServiceMap.second();
|
List<String> serviceStates = vmServiceMap.second();
|
||||||
logger.debug(String.format("A total of [%s] service states were obtained when listing the load balancer instances: [%s].", serviceStates.size(), serviceStates));
|
logger.debug("A total of [{}] service states were obtained when listing the load balancer instances: [{}].", serviceStates.size(), serviceStates);
|
||||||
|
|
||||||
if (!isListLbVmip()) {
|
if (!isListLbVmip()) {
|
||||||
ListResponse<UserVmResponse> response = new ListResponse<>();
|
ListResponse<UserVmResponse> response = new ListResponse<>();
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta
|
||||||
setEntityId(rule.getId());
|
setEntityId(rule.getId());
|
||||||
setEntityUuid(rule.getUuid());
|
setEntityUuid(rule.getUuid());
|
||||||
} catch (NetworkRuleConflictException e) {
|
} catch (NetworkRuleConflictException e) {
|
||||||
logger.info("Unable to create static NAT rule due to ", e);
|
logger.error("Unable to create static NAT rule due to ", e);
|
||||||
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
|
||||||
} else {
|
} else {
|
||||||
account = CallContext.current().getCallingAccount();
|
account = CallContext.current().getCallingAccount();
|
||||||
if (!Account.Type.ADMIN.equals(account.getType())) {
|
if (!Account.Type.ADMIN.equals(account.getType())) {
|
||||||
logger.warn(String.format("Only Root Admin can create global ACLs. Account [%s] cannot create any global ACL.", account));
|
logger.error("Only Root Admin can create global ACLs. {} cannot create any global ACL.", account);
|
||||||
throw new PermissionDeniedException("Only Root Admin can create global ACLs.");
|
throw new PermissionDeniedException("Only Root Admin can create global ACLs.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ public class CreateRoutingFirewallRuleCmd extends BaseAsyncCreateCmd {
|
||||||
}
|
}
|
||||||
ruleResponse.setResponseName(getCommandName());
|
ruleResponse.setResponseName(getCommandName());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.error("Got exception when create Routing firewall rules: " + ex);
|
logger.error("Got exception when create Routing firewall rules: ", ex);
|
||||||
} finally {
|
} finally {
|
||||||
if (!success || rule == null) {
|
if (!success || rule == null) {
|
||||||
routedIpv4Manager.revokeRoutingFirewallRule(getEntityId());
|
routedIpv4Manager.revokeRoutingFirewallRule(getEntityId());
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ public class CreateSnapshotFromVMSnapshotCmd extends BaseAsyncCreateCmd {
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
VMSnapshot vmSnapshot = _vmSnapshotService.getVMSnapshotById(getVMSnapshotId());
|
VMSnapshot vmSnapshot = _vmSnapshotService.getVMSnapshotById(getVMSnapshotId());
|
||||||
logger.info("CreateSnapshotFromVMSnapshotCmd with vm snapshot {} with id {} and snapshot [id: {}, uuid: {}]", vmSnapshot, getVMSnapshotId(), getEntityId(), getEntityUuid());
|
logger.info("CreateSnapshotFromVMSnapshotCmd with {} and snapshot [id: {}, uuid: {}]", vmSnapshot, getEntityId(), getEntityUuid());
|
||||||
CallContext.current().setEventDetails("Vm Snapshot Id: " + vmSnapshot.getUuid());
|
CallContext.current().setEventDetails("Vm Snapshot Id: " + vmSnapshot.getUuid());
|
||||||
Snapshot snapshot = null;
|
Snapshot snapshot = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -356,12 +356,10 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd implements UserCmd {
|
||||||
try {
|
try {
|
||||||
accountIdToUse = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
accountIdToUse = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||||
} catch (InvalidParameterValueException | PermissionDeniedException ex) {
|
} catch (InvalidParameterValueException | PermissionDeniedException ex) {
|
||||||
if (logger.isDebugEnabled()) {
|
logger.error("Unable to find accountId associated with accountName={} and domainId={} or projectId={}" +
|
||||||
logger.debug(String.format("An exception occurred while finalizing account id with accountName, domainId and projectId" +
|
", using callingAccountId={}", accountName, domainId, projectId, callingAccount.getUuid());
|
||||||
"using callingAccountId=%s", callingAccount.getUuid()), ex);
|
logger.debug("An exception occurred while finalizing account id with accountName, domainId and projectId" +
|
||||||
}
|
"using callingAccountId={}", callingAccount.getUuid(), ex);
|
||||||
logger.warn("Unable to find accountId associated with accountName=" + accountName + " and domainId="
|
|
||||||
+ domainId + " or projectId=" + projectId + ", using callingAccountId=" + callingAccount.getUuid());
|
|
||||||
}
|
}
|
||||||
return accountIdToUse != null ? accountIdToUse : callingAccount.getAccountId();
|
return accountIdToUse != null ? accountIdToUse : callingAccount.getAccountId();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -416,9 +416,7 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
|
||||||
nic = null;
|
nic = null;
|
||||||
}
|
}
|
||||||
String networkUuid = entry.get(VmDetailConstants.NETWORK);
|
String networkUuid = entry.get(VmDetailConstants.NETWORK);
|
||||||
if (logger.isTraceEnabled()) {
|
logger.trace("Checking if NIC '{}' can be mapped on network '{}'", nic, networkUuid);
|
||||||
logger.trace(String.format("nic, '%s', goes on net, '%s'", nic, networkUuid));
|
|
||||||
}
|
|
||||||
if (nic == null || StringUtils.isEmpty(networkUuid) || _entityMgr.findByUuid(Network.class, networkUuid) == null) {
|
if (nic == null || StringUtils.isEmpty(networkUuid) || _entityMgr.findByUuid(Network.class, networkUuid) == null) {
|
||||||
throw new InvalidParameterValueException(String.format("Network ID: %s for NIC ID: %s is invalid", networkUuid, nic));
|
throw new InvalidParameterValueException(String.format("Network ID: %s for NIC ID: %s is invalid", networkUuid, nic));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ public class CreateVMFromBackupCmd extends BaseDeployVMCmd {
|
||||||
message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them");
|
message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.info(String.format("%s: %s", message.toString(), ex.getLocalizedMessage()));
|
logger.info("{}: {}", message.toString(), ex.getLocalizedMessage());
|
||||||
logger.debug(message.toString(), ex);
|
logger.debug(message.toString(), ex);
|
||||||
throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, message.toString());
|
throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, message.toString());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,12 +111,12 @@ public class DeployVMCmd extends BaseDeployVMCmd {
|
||||||
message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them");
|
message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.info(String.format("%s: %s", message.toString(), ex.getLocalizedMessage()));
|
logger.info("{}: {}", message.toString(), ex.getLocalizedMessage());
|
||||||
logger.debug(message.toString(), ex);
|
logger.debug(message.toString(), ex);
|
||||||
throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, message.toString());
|
throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, message.toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.info("VM " + getEntityUuid() + " already created, load UserVm from DB");
|
logger.info("VM {} already created, load UserVm from DB", getEntityUuid());
|
||||||
result = _userVmService.finalizeCreateVirtualMachine(getEntityId());
|
result = _userVmService.finalizeCreateVirtualMachine(getEntityId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,9 +120,9 @@ public class ResetVMPasswordCmd extends BaseAsyncCmd implements UserCmd {
|
||||||
UserVm vm = _responseGenerator.findUserVmById(getId());
|
UserVm vm = _responseGenerator.findUserVmById(getId());
|
||||||
if (StringUtils.isBlank(password)) {
|
if (StringUtils.isBlank(password)) {
|
||||||
password = _mgr.generateRandomPassword();
|
password = _mgr.generateRandomPassword();
|
||||||
logger.debug(String.format("Resetting VM [%s] password to a randomly generated password.", vm.getUuid()));
|
logger.debug("Resetting VM [{}] password to a randomly generated password.", vm.getUuid());
|
||||||
} else {
|
} else {
|
||||||
logger.debug(String.format("Resetting VM [%s] password to password defined by user.", vm.getUuid()));
|
logger.debug("Resetting VM [{}] password to password defined by user.", vm.getUuid());
|
||||||
}
|
}
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + getId());
|
||||||
UserVm result = _userVmService.resetVMPassword(this, password);
|
UserVm result = _userVmService.resetVMPassword(this, password);
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd {
|
||||||
setEntityId(result.getId());
|
setEntityId(result.getId());
|
||||||
setEntityUuid(result.getUuid());
|
setEntityUuid(result.getUuid());
|
||||||
} catch (NetworkRuleConflictException ex) {
|
} catch (NetworkRuleConflictException ex) {
|
||||||
logger.info("Network rule conflict: " + ex.getMessage());
|
logger.info("Network rule conflict: {}", ex.getMessage());
|
||||||
logger.trace("Network rule conflict: ", ex);
|
logger.trace("Network rule conflict: ", ex);
|
||||||
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
|
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd {
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create remote access vpn");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create remote access vpn");
|
||||||
}
|
}
|
||||||
} catch (NetworkRuleConflictException e) {
|
} catch (NetworkRuleConflictException e) {
|
||||||
logger.info("Network rule conflict: " + e.getMessage());
|
logger.info("Network rule conflict: {}", e.getMessage());
|
||||||
logger.trace("Network Rule Conflict: ", e);
|
logger.trace("Network Rule Conflict: ", e);
|
||||||
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd {
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create site to site vpn connection");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create site to site vpn connection");
|
||||||
}
|
}
|
||||||
} catch (NetworkRuleConflictException e) {
|
} catch (NetworkRuleConflictException e) {
|
||||||
logger.info("Network rule conflict: " + e.getMessage());
|
logger.info("Network rule conflict: {}", e.getMessage());
|
||||||
logger.trace("Network Rule Conflict: ", e);
|
logger.trace("Network Rule Conflict: ", e);
|
||||||
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
|
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -180,9 +180,7 @@ public class CallContext {
|
||||||
}
|
}
|
||||||
s_currentContext.set(callingContext);
|
s_currentContext.set(callingContext);
|
||||||
ThreadContext.push("ctx-" + UuidUtils.first(contextId));
|
ThreadContext.push("ctx-" + UuidUtils.first(contextId));
|
||||||
if (LOGGER.isTraceEnabled()) {
|
LOGGER.trace("Registered: {}", callingContext);
|
||||||
LOGGER.trace("Registered: " + callingContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
s_currentContextStack.get().push(callingContext);
|
s_currentContextStack.get().push(callingContext);
|
||||||
|
|
||||||
|
|
@ -279,9 +277,7 @@ public class CallContext {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
s_currentContext.remove();
|
s_currentContext.remove();
|
||||||
if (LOGGER.isTraceEnabled()) {
|
LOGGER.trace("Unregistered: {}", context);
|
||||||
LOGGER.trace("Unregistered: " + context);
|
|
||||||
}
|
|
||||||
String contextId = context.getContextId();
|
String contextId = context.getContextId();
|
||||||
String sessionIdOnStack = null;
|
String sessionIdOnStack = null;
|
||||||
String sessionIdPushedToNDC = "ctx-" + UuidUtils.first(contextId);
|
String sessionIdPushedToNDC = "ctx-" + UuidUtils.first(contextId);
|
||||||
|
|
@ -289,9 +285,7 @@ public class CallContext {
|
||||||
if (sessionIdOnStack.isEmpty() || sessionIdPushedToNDC.equals(sessionIdOnStack)) {
|
if (sessionIdOnStack.isEmpty() || sessionIdPushedToNDC.equals(sessionIdOnStack)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (LOGGER.isTraceEnabled()) {
|
LOGGER.trace("Popping from NDC: {}", contextId);
|
||||||
LOGGER.trace("Popping from NDC: " + contextId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Stack<CallContext> stack = s_currentContextStack.get();
|
Stack<CallContext> stack = s_currentContextStack.get();
|
||||||
|
|
|
||||||
|
|
@ -136,9 +136,7 @@ public class LogContext {
|
||||||
}
|
}
|
||||||
s_currentContext.set(callingContext);
|
s_currentContext.set(callingContext);
|
||||||
ThreadContext.put("logcontextid", UuidUtils.first(contextId));
|
ThreadContext.put("logcontextid", UuidUtils.first(contextId));
|
||||||
if (LOGGER.isTraceEnabled()) {
|
LOGGER.trace("Registered for log: {}", callingContext);
|
||||||
LOGGER.trace("Registered for log: " + callingContext);
|
|
||||||
}
|
|
||||||
return callingContext;
|
return callingContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -207,9 +205,7 @@ public class LogContext {
|
||||||
LogContext context = s_currentContext.get();
|
LogContext context = s_currentContext.get();
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
s_currentContext.remove();
|
s_currentContext.remove();
|
||||||
if (LOGGER.isTraceEnabled()) {
|
LOGGER.trace("Unregistered: {}", context);
|
||||||
LOGGER.trace("Unregistered: " + context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ThreadContext.clearMap();
|
ThreadContext.clearMap();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue