openbaton / openstack4j-plugin

Apache License 2.0
3 stars 12 forks source link

Openbaton doesn't list the images of OpenStack Instance #26

Closed nfss83 closed 7 years ago

nfss83 commented 7 years ago

I registered the PoP of type OpenStack in the OpenBaton. I get to list the networks and flavours, but the images not. Cloud you help me?

OpenStack logs:

Jun 30 21:59:56 localhost glance-api[26869]: DEBUG glance.api.middleware.version_negotiation [-] #033[00;32mUnknown version. Returning version choices. {{(pid=27066) process_request /opt/stack/glance/glance/api/middleware/version_negotiation.py:64}}

nfss83 commented 7 years ago

Plugin Logs: [pool-1-thread-8] DEBUG org.openbaton.drivers.openstack4j.OpenStack4JDriver - Looking for method: listImages [pool-1-thread-8] INFO org.openbaton.drivers.openstack4j.OpenStack4JDriver - Listed images for VimInstance with name: vim-instance -> Images: [] [pool-1-thread-8] DEBUG org.openbaton.drivers.openstack4j.OpenStack4JDriver - Answer is: { "answer": [] }

szengerle commented 7 years ago

Same for me:

[pool-1-thread-3] INFO org.openbaton.drivers.openstack4j.OpenStack4JDriver - Listed images for VimInstance with name: vim-instance-name -> Images: [] [pool-1-thread-3] DEBUG org.openbaton.drivers.openstack4j.OpenStack4JDriver - Answer is: { "answer": [] }

GET /image/v1/images/detail?limit=100 HTTP/1.1

HTTP/1.1 300 Multiple Choices {"versions": [{"status": "EXPERIMENTAL", "id": "v2.6", "links": [{"href": "http://100.64.0.161/image/v2/", "rel": "self"}]}, {"status": "CURRENT", "id": "v2.5", "links": [{"href": "http://100.64.0.161/image/v2/", "rel": "self"}]}, {"status": "SUPPORTED", "id": "v2.4", "links": [{"href": "http://100.64.0.161/image/v2/", "rel": "self"}]}, {"status": "SUPPORTED", "id": "v2.3", "links": [{"href": "http://100.64.0.161/image/v2/", "rel": "self"}]}, {"status": "SUPPORTED", "id": "v2.2", "links": [{"href": "http://100.64.0.161/image/v2/", "rel": "self"}]}, {"status": "SUPPORTED", "id": "v2.1", "links": [{"href": "http://100.64.0.161/image/v2/", "rel": "self"}]}, {"status": "SUPPORTED", "id": "v2.0", "links": [{"href": "http://100.64.0.161/image/v2/", "rel": "self"}]}]}

Requestes Glance-API version is not supported, as it seems. Is Glance-API v2.0 supported by the Openstack4j-Plugin?

gc4rella commented 7 years ago

weird, in theory should be supported without any issues. I can only suggest to debug a little bit more. You can temporary increase log levels of the vim drivers in this way:

please stop the plugin once you finish (ctrl-c) and restart the NFVO so that it will reload the plugin in normal mode.

lorenzotomasini commented 7 years ago

@szengerle The glace v2 api are not supported by the library that we are relying on, openstack4j, on the release version. I just tried to use the snasphot version of the library and the request worked with glance V2. But i don't know about the rest of the APIs... If you want to try it out i can tell you how to do that change for supporting glance v2 api.

szengerle commented 7 years ago

Glance-Log:

Aug 9 11:56:58 ubuntu devstack@g-api.service[14750]: #033[00;32mDEBUG glance.api.middleware.version_negotiation [#033[01;36mNone req-68fad422-1309-439d-a66c-f93b6bc2d56d #033[00;36malt_demo admin#033[00;32m] #033[01;35m#033[00;32mDetermining version of request: GET /v1/images/detail Accept: #033[00m #033[00;33m{{(pid=14752) process_request /opt/stack/glance/glance/api/middleware/version_negotiation.py:45}}#033[00m Aug 9 11:56:58 ubuntu devstack@g-api.service[14750]: #033[00;32mDEBUG glance.api.middleware.version_negotiation [#033[01;36mNone req-68fad422-1309-439d-a66c-f93b6bc2d56d #033[00;36malt_demo admin#033[00;32m] #033[01;35m#033[00;32mUsing url versioning#033[00m #033[00;33m{{(pid=14752) process_request /opt/stack/glance/glance/api/middleware/version_negotiation.py:57}}#033[00m Aug 9 11:56:58 ubuntu devstack@g-api.service[14750]: #033[00;32mDEBUG glance.api.middleware.version_negotiation [#033[01;36mNone req-68fad422-1309-439d-a66c-f93b6bc2d56d #033[00;36malt_demo admin#033[00;32m] #033[01;35m#033[00;32mUnknown version. Returning version choices.#033[00m #033[00;33m{{(pid=14752) process_request /opt/stack/glance/glance/api/middleware/version_negotiation.py:64}}#033[00m

Drivers Log with Trace Log-Level:

[pool-1-thread-1] DEBUG org.openbaton.drivers.openstack4j.OpenStack4JDriver - Looking for method: listImages [pool-1-thread-2] WARN org.openbaton.drivers.openstack4j.OpenStack4JDriver - Not found region 'Berlin'. Use default one... [pool-1-thread-4] WARN org.openbaton.drivers.openstack4j.OpenStack4JDriver - Not found region 'Berlin'. Use default one... [pool-1-thread-1] WARN org.openbaton.drivers.openstack4j.OpenStack4JDriver - Not found region 'Berlin'. Use default one... [pool-1-thread-1] INFO org.openbaton.drivers.openstack4j.OpenStack4JDriver - Listed images for VimInstance with name: vim1pop1 -> Images: [] [pool-1-thread-1] DEBUG org.openbaton.drivers.openstack4j.OpenStack4JDriver - Answer is: { "answer": [] }

@lorenzotomasini Could you please tell me what necessary is for the glance-api v2 support? I want to try it out.

lorenzotomasini commented 7 years ago

in the build.gradle file:

-    compile group: 'org.pacesys', name: 'openstack4j', version: '3.0.3'
+    compile group: 'org.pacesys', name: 'openstack4j', version: '3.0.4-SNAPSHOT'

and in the Openstack4jDriver class:

@@ -379,10 +380,10 @@ public class OpenStack4JDriver extends VimDriver {
       OSClient os = this.authenticate(vimInstance);
       Map<String, String> map = new HashMap<>();
       map.put("limit", "100");
-      List<? extends Image> images = os.images().list(map);
+      List<? extends org.openstack4j.model.image.v2.Image> images = os.imagesV2().list(map);
       List<NFVImage> nfvImages = new ArrayList<>();
-      for (Image image : images) {
-        nfvImages.add(Utils.getImage(image));
+      for (org.openstack4j.model.image.v2.Image image : images) {
+        nfvImages.add(Utils.getImageV2(image));
       }
       log.info(
           "Listed images for VimInstance with name: "
@@ -877,8 +878,8 @@ public class OpenStack4JDriver extends VimDriver {
                     .diskFormat(
                         org.openstack4j.model.image.v2.DiskFormat.value(
                             image.getDiskFormat().toUpperCase()))
-                    .minDisk((int) image.getMinDiskSpace())
-                    .minRam((int) image.getMinRam())
+                    .minDisk(image.getMinDiskSpace())
+                    .minRam(image.getMinRam())
                     .build());

don't rely on the lines number, i am using the develop branch, for that reason the line number could not be consistent. In your case you should start doing the changes on the respective version (if NFVO v4.0.0, start from openstack4j 4.0.0)

then recompile being sure gradle downloads the right version (./gradlew clean build -x test --refresh-dependencies) and try the command explained by @gc4rella

szengerle commented 7 years ago

Glance API works now fine. My next issue is on the Nova API regarding receiving Quotas... Would it be better to change complete to the dev branches if I would use Ocata as VIM? Against what Openstack version is the Openstack4j-plugin tested in the 4.0 tag and the dev branch?

lorenzotomasini commented 7 years ago

the upgrade procedure from 4.0.0 to 4.0.1-SNAPSHOT (develop) of the plugin needs also to upgrade the nfvo. the upgrade procedure is not yet implemented for this next release. Anyway we are still using 3.0.3 of openstack4j for stability reasons (we never tested the snapshot version)

which is the quota problem? can we close this issue and open a new one for the quotas? usually on the last openstack versions the user is not allowed to request the quota from remote. so either openstack configuration has to be changed or the nfvo property checkQuota has to be put to false in order to skip this step

We tested the openstack plugin against Ocata without major problems, being able to deploy any scenario

nfss83 commented 7 years ago

@szengerle did you get to list the images? If yes, How? (Step-by-step, please).

szengerle commented 7 years ago

Yes, everything work now. After I had the quoata problem with the nfvo in version 4.0.0 and the vim plugin in the developer (4.0.1) version I started to work on the dev branch for the NFVO, GVNFM and the openstack4j-plugin. I cloned the repos and checked them out on the commit with the comment "4.0.1". I built the NFVO, GVNFM and the plugin with openjdk8 (openjdk had strange problems to load the gradle binary due to TLS erros; known issue). Then I copied the *.jar file to the plugin directory and started all the services from the respective scripts. No problem until here.... BUT I wasted the hole day due to another problem. I had a space in the tenand-id field of my vim-config.json. Everything worked but no networks could be found if they are not shared. After a quiet hard troubleshooting session i found out that the equals() method gives back false and the network is not considered anymore, because of the addional space.

I'm not sure if you consider the option to use glance-v1 api. But that option worked also for me (I had to enable glance-v1 in the glance config).

nfss83 commented 7 years ago

Thanks, @szengerle. I solved using glance-v1 API.