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

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 http://186.17.8.14:5000/v2.0 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.setDiskFormat("qcow2");
newImage.setContainerFormat("bare");
newImage.setName("os-java-glance");
newImage = glance.images().create(newImage).execute();