summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoss Armstrong <joss.armstrong@ericsson.com>2019-01-14 12:24:00 +0000
committerJoss Armstrong <joss.armstrong@ericsson.com>2019-01-14 12:47:58 +0000
commita62be82248cf7877fbc68a90327f58018f5bf832 (patch)
tree8fe235b4cac738b55e20d0ae9341815c35bac7b2
parenta150e98e563138d5d0ed6d87fa0d32c57efe5f85 (diff)
Fix VM Snapshot error during image validation
prefix image name with 'in:' and surround with quotes to deal with change to Glance that no longer supports image names including colons passed as plain strings Issue-ID: APPC-869 Change-Id: If81accc3edd7b4805eb965b11f466df9654d6010 Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/CreateSnapshot.java6
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestCreateSnapshot.java4
2 files changed, 7 insertions, 3 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/CreateSnapshot.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/CreateSnapshot.java
index 8c9f47c6e..fe08e1856 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/CreateSnapshot.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/CreateSnapshot.java
@@ -7,6 +7,8 @@
* Copyright (C) 2017 Amdocs
* =============================================================================
* Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
+ * Modifications (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -105,11 +107,11 @@ public class CreateSnapshot extends ProviderServerOperation {
throw new RequestFailedException("Stop Server", msg, HttpStatus.BAD_GATEWAY_502, server);
}
rc.reset();
- // Locate snapshot image
+ // Locate snapshot image - image names containing colon must be prefixed by in: and surrounded with quotes
Image snapshot = null;
while (rc.attempt()) {
try {
- snapshot = service.getImageByName(snapshotName);
+ snapshot = service.getImageByName("in:\"" + snapshotName + "\"");
if (snapshot != null) {
break;
}
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestCreateSnapshot.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestCreateSnapshot.java
index 8b31bfd23..03cdb4f22 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestCreateSnapshot.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestCreateSnapshot.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,6 +62,6 @@ public class TestCreateSnapshot {
verify(server).createSnapshot(createSnapshotCaptor.capture());
ArgumentCaptor<String> getImageNameCaptor = ArgumentCaptor.forClass(String.class);
verify(mg.getImageService(), atLeastOnce()).getImageByName(getImageNameCaptor.capture());
- assertEquals(createSnapshotCaptor.getValue(), getImageNameCaptor.getValue());
+ assertEquals("in:\"" + createSnapshotCaptor.getValue() + "\"", getImageNameCaptor.getValue());
}
} \ No newline at end of file