[ 
https://issues.apache.org/jira/browse/JCLOUDS-678?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ignasi Barrera resolved JCLOUDS-678.
------------------------------------
       Resolution: Fixed
    Fix Version/s: 2.0.0

> NPE on GCE attachDisk when VM not found (because user-error wrong region 
> specified)
> -----------------------------------------------------------------------------------
>
>                 Key: JCLOUDS-678
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-678
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-labs-google
>    Affects Versions: 1.8.0
>            Reporter: Aled Sage
>            Assignee: Ignasi Barrera
>            Priority: Minor
>             Fix For: 2.0.0
>
>
> When attaching a disk to a VM, I got an NPE (because I specified the wrong 
> zone - user error!)
>     2014-08-19 17:27:39,455 ERROR b.l.b.AbstractVolumeManagerLiveTest [main]: 
> Error creating and attaching volume
>     java.lang.NullPointerException: operation should not be null
>         at 
> com.google.common.base.Preconditions.checkNotNull(Preconditions.java:229) 
> ~[guava-17.0.jar:na]
>         at 
> brooklyn.location.blockstore.gce.GoogleComputeEngineVolumeManager.waitForOperationToBeDone(GoogleComputeEngineVolumeManager.java:183)
>  ~[classes/:na]
>         at 
> brooklyn.location.blockstore.gce.GoogleComputeEngineVolumeManager.attachBlockDevice(GoogleComputeEngineVolumeManager.java:111)
>  ~[classes/:na]
>         at 
> brooklyn.location.blockstore.AbstractVolumeManager.createAttachAndMountVolume(AbstractVolumeManager.java:38)
>  ~[classes/:na]
>         at 
> brooklyn.location.blockstore.AbstractVolumeManagerLiveTest.testCreateAndAttachVolume(AbstractVolumeManagerLiveTest.java:158)
>  ~[test-classes/:na]
> The sequence of events were:
> 1. create VM without specifying region (it was created in asia-east1-c)
> 2. attach disk to the VM (but specifying europe-west1-a)
> 2.1 jclouds calls POST 
> https://www.googleapis.com/compute/v1/projects/jclouds-gce/zones/europe-west1-a/instances/brooklyn-ryqx-aled-1d9/attachDisk
> 2.2 jclouds gets back a 404, so returns null from InstanceApi.attachDiskInZone
>     2014-08-19 17:27:39,451 DEBUG jclouds.wire [main]: << "  "code": 404,[\n]"
>     2014-08-19 17:27:39,451 DEBUG jclouds.wire [main]: << "  "message": "The 
> resource 
> 'projects/jclouds-gce/zones/europe-west1-a/instances/brooklyn-ryqx-aled-1d9' 
> was not found"[\n]"
> 2.3 tries to look up operation with id null; throws NPE
> I'd have preferred a more graceful error earlier, to say that the VM could 
> not be found.
> Unfortunately the nice message is not available to the caller of 
> instanceApi.attachDiskInZone; it just returns null.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to