Problem attaching and mounting an EBS volume

73 views
Skip to first unread message

Paolo Di Tommaso

unread,
Feb 22, 2012, 8:29:59 AM2/22/12
to jcl...@googlegroups.com
Dear all, 

I'm using JClouds to starting and configure a EC2 cluster. My idea is to start a instance, attach a volume that I've created previously, and mount the attach volume. 

So I'm doing something like this 

:
Attachment attachment = ebsClient.attachVolumeInRegion(regionId, volumeId, nodeId, "/dev/sdh")
RunScriptOptions opt = new RunScriptOptions().runAsRoot(true)
def mountScript = "mkdir -p /data; mount /dev/sdh /data "
compute.runScriptOnNode(nodeId, mountScript, opt)

But when I login in the instance the volume is attached but NOT mounted and I have to do it manually. 


I'm supposing that I need to monitor the Attachment status waiting the volume to be in the ATTACHED status. 

To do that would be enough something like this: 

while( attachment.getStatus() != Status.ATTACHED ) {
  sleep( 30 000 )
}

or it is required to query explicitly for the volume attachment status using the describeVolumesInRegion() api ? 

Any other suggestions is welcome. 

Thank you, 
Paolo

Adrian Cole

unread,
Feb 22, 2012, 8:55:43 AM2/22/12
to jcl...@googlegroups.com
Hi, Paulo.

looks like you know what you need to do.  I recommend this for the retry thingy.

1. switch to jclouds 1.4.0-rc.2 (as it is cool)
2.      

VolumeAttached volumeAttached = context.utils().injector().getInstance(VolumeAttached.class);
      attachTester = new RetryablePredicate<Attachment>(volumeAttached, 60, 1, TimeUnit.SECONDS);

3. attachTester.apply(attachment) // or die, etc.

sound good?

-A


Paolo

--
You received this message because you are subscribed to the Google Groups "jclouds" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jclouds/-/uR_eIIkDBoMJ.
To post to this group, send email to jcl...@googlegroups.com.
To unsubscribe from this group, send email to jclouds+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jclouds?hl=en.

Paolo Di Tommaso

unread,
Feb 22, 2012, 9:23:11 AM2/22/12
to jcl...@googlegroups.com
Hi Adrian, 

Thanks for your quick reply. Well, the latest version seems really cool. 

Is there any document or whatever to know more about it ? 

Cheers,
Paolo

Adrian Cole

unread,
Feb 22, 2012, 9:33:04 AM2/22/12
to jcl...@googlegroups.com, jclou...@googlegroups.com
1.4 coolness is best expressed "minecraft cool"

https://github.com/jclouds/jclouds-examples/tree/master/minecraft-compute

  • We don't have release docs, yet, as 1.4 isn't final, but the above uses a lot of new tricks including event bus.

-A

sk007

unread,
Jan 23, 2013, 2:10:33 PM1/23/13
to jcl...@googlegroups.com, jclou...@googlegroups.com
Hi Adrian,

In jclouds, is there any event driven model for listening events such as volume attached, detached ?

Thanks
Sk

Adrian Cole

unread,
Jan 23, 2013, 2:16:05 PM1/23/13
to jcl...@googlegroups.com, jclou...@googlegroups.com
No, there's only polling at the moment. Amazon doesn't do push notifications.
> https://groups.google.com/d/msg/jclouds/-/mWG0TjmIqWEJ.

sk007

unread,
Jan 23, 2013, 5:47:19 PM1/23/13
to jcl...@googlegroups.com, jclou...@googlegroups.com

Hi Adrian,

Thanks for your prompt response. 

Somewhere in net, I got, 30 seconds is a good polling interval.

I think, optimized polling interval depends on AWS, network, volume/image size. Do you have any suggestion on optimizing or tuning polling interval?

Thanks
Sk    
Reply all
Reply to author
Forward
0 new messages