Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-569

Cloudsigma listDrivesInfo() and getDriveInfo () parse error when jobs are present

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.2
    • Fix Version/s: 1.8.0
    • Component/s: jclouds-labs
    • Labels:
    • Environment:
      OSX 10.9
      Oracle Java 1.8 JDK

      Description

      If a job is present in the DriveInfo response then the parser barfs with an exception. This is most likely due to the fact that the "jobs" field in the DriveInfo POJO is declared as List<String> and while the the response seems to ask for List<Map<String,String>>

      In clouds-labs/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveInfo.java, line 37 reads :

      protected List<String> jobs;
      

      The jobs field defined in the cloudsigma api: https://cloudsigma-docs.readthedocs.org/en/2.10/jobs.html?highlight=jobs

      Response which triggers the exception:

          "{"affinities": [], "allow_multimount": false, "jobs": [{"resource_uri": "/api/2.0/jobs/933133a2-4ee2-4310-9a63-c8d5e7052335/", "uuid": "933133a2-4ee2-4310-9a63-c8d5e7052335"}], "licenses": [], "media": "cdrom", "meta": {"arch": "64", "category": "general", "description": "OpenBSD 5.3 - 64bit - CD\r\n\r\n", "favourite": "False", "image_type": "install", "install_notes": "1. Attach the CD. \\n\r\nNB: Please be aware that the CD needs to be attached to the server using IDE interface.  \\n\r\n \\n\r\n2. Attach a Drive. \\n\r\nPlease be aware that the drive size required for installation of the OS will vary between 1 and 8 GB, depending on your configuration preferences For detailed information please open the URL below:\r\nhttp://www.openbsd.org/faq/faq3.html#SelectHW\r\n \\n\r\n \\n\r\n3. Connecting to your server via VNC. \\n\r\na) Go to the \u201cProperties\u201d tab of the server and Turn on the VNC Tunnel by clicking the button right next to it \\n\r\nb) In order to use the inbuilt client click on the icon right next to the VNC link and choose \u201cOpen in Dialog Window\u201d or \u201cOpen in new browser window/tab\u201d \\n\r\nOR \\n\r\nc) Having installed a compatible VNC client, open a VNC connection to your server through the UI.  \\n\r\nd) Enter your VNC url and VNC password as displayed on your Server Properties Window.  \\n\r\n \\n\r\n4. Minimum Hardware Requirements. \\n\r\nThe recommended minimum hardware requirements as published by Netbsd.org are 64MB RAM and 200 Hz CPU. We also recommend specifying higher values of RAM and CPU for better user experience. \r\n \\n", "os": "other", "paid": "False", "url": "http://www.openbsd.org/"}, "mounted_on": [], "name": "OpenBSD 5.3", "owner": {"resource_uri": "/api/2.0/user/cff81a3f-6ddf-438d-b3a5-c094492ac147/", "uuid": "cff81a3f-6ddf-438d-b3a5-c094492ac147"}, "resource_uri": "/api/2.0/drives/fc9f48d9-200b-4de3-a161-5b1d32ec86c4/", "runtime": {"is_snapshotable": true, "snapshots_allocated_size": 0, "storage_type": "dssd"}, "size": 1000013824, "snapshots": [], "status": "unmounted", "storage_type": "dssd", "tags": [], "uuid": "fc9f48d9-200b-4de3-a161-5b1d32ec86c4"}"
      

      And the exception:

      [ERROR] 2014:05:15@10:29:11,539:org.jclouds.cloudsigma2.functions.internal.ParseDriveInfos - Error parsing input
      com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 57

      To reproduce the exception get a LibraryDrive, clone it and then get the DriveInfo for the cloned disk.

       CloudSigma2Api api = ContextBuilder.newBuilder("cloudsigma2-zrh") ...// initialization stuff for the api 
      
      // gets the first disk from the library - It's a CD of openbsd 
      FluentIterable<LibraryDrive> libraryDrives = api.listLibraryDrives().concat();
      //clone it
      api.cloneLibraryDrive(libraryDrives.first().get().getUuid(), null);
      
      //list all existing drives
      FluentIterable<Drive> drives  = api.listDrives().concat();
      //print the drive infos for all the drives
      for (Drive drive : drives) {
      //this throws an exception when we get to the newly cloned disk
          System.out.println(api.getDriveInfo(drive.getUuid()));
      }
      
      
      //altenatvely we can just get all the driveInfos which similarly barfs when we get to the newly cloned disk
      FluentIterable<DriveInfo> driveInfos = api.listDrivesInfo().concat();
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              cdumitru Cosmin Dumitru
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: