Skip to content

Commit 3423ba1

Browse files
committed
Fix: improve logging level for openstacknode and openstacknetworking
Change-Id: Ic1f2d847e04b0d5c50fefcc9fc71ed3c053b1fa9
1 parent f7f01d1 commit 3423ba1

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/web/OpenstackManagementWebResource.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ public class OpenstackManagementWebResource extends AbstractWebResource {
9595

9696
private static final String SECURITY_GROUP_FLAG_REQUIRED = "Security Group flag is not specified";
9797

98+
private static final String AUTH_INFO_NOT_FOUND = "Auth info is not found";
99+
private static final String AUTH_INFO_NOT_CORRECT = "Auth info is not correct";
100+
98101
private static final String HTTP_HEADER_ACCEPT = "accept";
99102
private static final String HTTP_HEADER_VALUE_JSON = "application/json";
100103

@@ -132,13 +135,15 @@ public Response syncStates() {
132135

133136
Optional<OpenstackNode> node = osNodeAdminService.nodes(CONTROLLER).stream().findFirst();
134137
if (!node.isPresent()) {
135-
throw new ItemNotFoundException("Auth info is not found");
138+
log.error(AUTH_INFO_NOT_FOUND);
139+
throw new ItemNotFoundException(AUTH_INFO_NOT_FOUND);
136140
}
137141

138142
OSClient osClient = OpenstackNetworkingUtil.getConnectedClient(node.get());
139143

140144
if (osClient == null) {
141-
throw new ItemNotFoundException("Auth info is not correct");
145+
log.error(AUTH_INFO_NOT_CORRECT);
146+
throw new ItemNotFoundException(AUTH_INFO_NOT_CORRECT);
142147
}
143148

144149
try {
@@ -407,6 +412,8 @@ public Response mappedFloatingIps() {
407412
@Produces(MediaType.APPLICATION_JSON)
408413
public Response updateActiveStatus(@PathParam("flag") String flag) {
409414

415+
log.info("Update active status to {}", flag);
416+
410417
if (FLAG_TRUE.equalsIgnoreCase(flag)) {
411418
osHaService.setActive(true);
412419
}
@@ -443,6 +450,8 @@ public Response getActiveStatus() {
443450
@Produces(MediaType.APPLICATION_JSON)
444451
public Response updateActiveIp(@PathParam("ip") String ip) {
445452

453+
log.info("Update active IP address to {}", ip);
454+
446455
osHaService.setActiveIp(IpAddress.valueOf(ip));
447456

448457
return status(Response.Status.OK).build();

apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/web/OpenstackNodeWebResource.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public class OpenstackNodeWebResource extends AbstractWebResource {
9494
@Consumes(MediaType.APPLICATION_JSON)
9595
@Produces(MediaType.APPLICATION_JSON)
9696
public Response createNodes(InputStream input) {
97-
log.trace(String.format(MESSAGE_NODE, CREATE));
97+
log.info(String.format(MESSAGE_NODE, CREATE));
9898

9999
readNodeConfiguration(input).forEach(osNode -> {
100100
OpenstackNode existing = osNodeService.node(osNode.hostname());
@@ -122,7 +122,7 @@ public Response createNodes(InputStream input) {
122122
@Consumes(MediaType.APPLICATION_JSON)
123123
@Produces(MediaType.APPLICATION_JSON)
124124
public Response updateNodes(InputStream input) {
125-
log.trace(String.format(MESSAGE_NODE, UPDATE));
125+
log.info(String.format(MESSAGE_NODE, UPDATE));
126126

127127
Set<OpenstackNode> nodes = readNodeConfiguration(input);
128128
for (OpenstackNode osNode: nodes) {
@@ -151,7 +151,7 @@ public Response updateNodes(InputStream input) {
151151
@Produces(MediaType.APPLICATION_JSON)
152152
@Path("{hostname}")
153153
public Response deleteNodes(@PathParam("hostname") String hostname) {
154-
log.trace(String.format(MESSAGE_NODE, DELETE));
154+
log.info(String.format(MESSAGE_NODE, DELETE));
155155

156156
OpenstackNode existing =
157157
osNodeService.node(nullIsIllegal(hostname, HOST_NAME + ERROR_MESSAGE));
@@ -213,7 +213,7 @@ public Response stateOfNode(@PathParam("hostname") String hostname) {
213213
@Produces(MediaType.APPLICATION_JSON)
214214
@Path("init/node/{hostname}")
215215
public Response initNode(@PathParam("hostname") String hostname) {
216-
log.trace(String.format(MESSAGE_NODE, QUERY));
216+
log.info(String.format(MESSAGE_NODE, INIT));
217217

218218
OpenstackNode osNode = osNodeService.node(hostname);
219219
if (osNode == null) {
@@ -234,7 +234,7 @@ public Response initNode(@PathParam("hostname") String hostname) {
234234
@Produces(MediaType.APPLICATION_JSON)
235235
@Path("init/all")
236236
public Response initAllNodes() {
237-
log.trace(String.format(MESSAGE_NODE, QUERY));
237+
log.info(String.format(MESSAGE_NODE, INIT));
238238

239239
osNodeService.nodes()
240240
.forEach(n -> {
@@ -254,7 +254,7 @@ public Response initAllNodes() {
254254
@Produces(MediaType.APPLICATION_JSON)
255255
@Path("init/incomplete")
256256
public Response initIncompleteNodes() {
257-
log.trace(String.format(MESSAGE_NODE, QUERY));
257+
log.info(String.format(MESSAGE_NODE, INIT));
258258

259259
osNodeService.nodes().stream()
260260
.filter(n -> n.state() != COMPLETE)

0 commit comments

Comments
 (0)