How to backup to local system using openstack-java-sdk

asked 2014-06-05 04:03:20 -0600

anju gravatar image

updated 2014-06-06 17:02:04 -0600

smaffulli gravatar image

I want to download the vm images that are stored in glance to my local system. This is possible using the openstack glance client command-line tool.

Command is :

 glance --os-username admin --os-password admin --os-tenant-name admin --os-auth-url image-download --file d:/tmp/testfile <filename>

But i want to do the same using openstack sdk .I want to upload from my local system to openstack by specifying the image path from my local system. I am attaching the code snippet .

Image newImage = new Image();
newImage = glance.images().create(newImage).execute();
ImageUpload uploadImage = new ImageUpload(newImage);
uploadImage.setInputStream(new ByteArrayInputStream(IMAGE_CONTENT.getBytes()));
glance.images().upload(newImage.getId(), uploadImage).execute();

Kindly help me as to where to specify the location of the image.

edit retag flag offensive close merge delete