Chris,

I had to do something similar in Ruby, here is the code:
https://gist.github.com/pdion891/793b7d4d1380e3f45c9e

This create defined templates from json file in cloudstack which will
download it from the URL.



Pierre-Luc Dion
Architecte de Solution Cloud | Cloud Solutions Architect
855-OK-CLOUD (855-652-5683) x1101
- - -

*CloudOps*420 rue Guy
Montréal QC  H3J 1S6
www.cloudops.com
@CloudOps_


On Fri, Jun 13, 2014 at 12:24 PM, chris <cdca...@gmail.com> wrote:

> Cloudmonkey isn't really an option in my case.
>
> I wasn't aware that extractVolume could be applied to VMs in anyway. I'll
> look into it.
>
>
> On Fri, Jun 13, 2014 at 5:28 AM, Nux! <n...@li.nux.ro> wrote:
>
> > Hi,
> >
> > You can either use the API directly (look at extractVolume) or through
> > Cloudmonkey.
> > This is how I would use Cloudmonkey to retrieve a volume:
> >
> > "extract volume id=fe81e6ff-a08f-4601-b2b3-2e02ce2b6588
> > zoneid=19345de0-b40b-4cfa-83b6-6d821367afa8 mode=HTTP_DOWNLOAD" which
> will
> > return:
> >
> > accountid = 2c4c9cd2-ab73-11e3-b654-9660573836d5
> > cmd = org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd
> > created = 2014-06-13T11:24:24+0100
> > jobid = 69e6bf53-ab95-44ab-8efc-2f436dba9ecc
> > jobprocstatus = 0
> > jobresult:
> > volume:
> > name = ROOT-7
> > id = fe81e6ff-a08f-4601-b2b3-2e02ce2b6588
> > accountid = 2c4c9cd2-ab73-11e3-b654-9660573836d5
> > extractMode = HTTP_DOWNLOAD
> > state = DOWNLOAD_URL_CREATED
> > url =
> >
> https://1-2-3-4.realhostip.com/userdata/32050352-899f-4f56-8e38-018110f8e973.qcow2
> > zoneid = 19345de0-b40b-4cfa-83b6-6d821367afa8
> > zonename = advsg
> > jobresultcode = 0
> > jobresulttype = object
> > jobstatus = 1
> > userid = 2c4cc626-ab73-11e3-b654-9660573836d5
> >
> > It's the URL field that you are interested in, you can retrieve that
> > freely. I do not know if there is an expiry time for it, there might be.
> > You can extract templates, snapshots of the volumes of stopped VMs.
> >
> > HTH
> > Lucian
> >
> >
> > --
> > Sent from the Delta quadrant using Borg technology!
> >
> > Nux!
> > www.nux.ro
> >
> >
> > ----- Original Message -----
> > From: "chris" <cdca...@gmail.com>
> > To: users@cloudstack.apache.org
> > Sent: Friday, 13 June, 2014 12:19:47 AM
> > Subject: Possible to upload/download a VM?
> >
> > I'm trying to figure out a way to programmatically upload and download VM
> > images, and I haven't yet found anything in the docs or playing around in
> > the UI that jumps out at me.
> >
> > To download from OpenStack, the story I would follow is
> > 1) Snapshot a VM. This would create an image (or set of images) that I
> > could easily download from glance (the image storage service)
> > 2) Download the resulting image(s).
> >
> > Uploading is just as straightforward:
> > 1) Upload to glance
> > 2) Create an instance.
> >
> > I can see from what I've looked at so far that CloudStack does things a
> bit
> > differently. Is there a path to what I want to accomplish? Templates &
> > Volumes don't look to have quite what I want, but I could be wrong.
> Looking
> > at the UI, I couldn't even figure out how to upload local files, only
> files
> > being served up via HTTP or FTP.
> >
> > I'm currently using the .NET SDK and CloudStack 4.2.1. I've got to say,
> as
> > SDKs go, this one has been pretty great to work with. I'm just stumped by
> > this task.
> >
> > Thanks,
> > Chris
> >
>

Reply via email to