diff options
| author | Rick Harris <rick.harris@rackspace.com> | 2010-12-22 13:01:33 -0600 |
|---|---|---|
| committer | Rick Harris <rick.harris@rackspace.com> | 2010-12-22 13:01:33 -0600 |
| commit | af4d6e84c67b8f59f63ef0275778fa897dac9e95 (patch) | |
| tree | 2ab217b8fb552b8b1e3391a6e82892468b55f718 /plugins | |
| parent | 11d0a21e44dae5340febfc8e8f7f9323ad9fb8b9 (diff) | |
| download | nova-af4d6e84c67b8f59f63ef0275778fa897dac9e95.tar.gz nova-af4d6e84c67b8f59f63ef0275778fa897dac9e95.tar.xz nova-af4d6e84c67b8f59f63ef0275778fa897dac9e95.zip | |
Getting Snapshots to work with cloudservers command-line tool
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/xenapi/etc/xapi.d/plugins/glance | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/plugins/xenapi/etc/xapi.d/plugins/glance b/plugins/xenapi/etc/xapi.d/plugins/glance index 13e79ff9f..5e648b970 100644 --- a/plugins/xenapi/etc/xapi.d/plugins/glance +++ b/plugins/xenapi/etc/xapi.d/plugins/glance @@ -45,41 +45,37 @@ FILE_SR_PATH = '/var/run/sr-mount' def put_vdis(session, args): params = pickle.loads(exists(args, 'params')) vdi_uuids = params["vdi_uuids"] - glance_label = params["glance_label"] + image_name = params["image_name"] glance_host = params["glance_host"] glance_port = params["glance_port"] - glance_storage_location = params["glance_storage_location"] sr_path = get_sr_path(session) #FIXME(sirp): writing to a temp file until Glance supports chunked-PUTs - tmp_file = "%s.tar.gz" % os.path.join('/tmp', glance_label) + tmp_file = "%s.tar.gz" % os.path.join('/tmp', image_name) tar_cmd = ['tar', '-zcf', tmp_file, '--directory=%s' % sr_path] paths = [ "%s.vhd" % vdi_uuid for vdi_uuid in vdi_uuids ] tar_cmd.extend(paths) logging.debug("Bundling image with cmd: %s", tar_cmd) subprocess.call(tar_cmd) logging.debug("Writing to test file %s", tmp_file) - put_bundle_in_glance(tmp_file, glance_label, glance_storage_location, - glance_host, glance_port) + put_bundle_in_glance(tmp_file, image_name, glance_host, glance_port) return "" # FIXME(sirp): return anything useful here? -def put_bundle_in_glance(tmp_file, glance_label, glance_storage_location, - glance_host, glance_port): - +def put_bundle_in_glance(tmp_file, image_name, glance_host, glance_port): size = os.path.getsize(tmp_file) - basename = os.path.basename(tmp_file) - location = os.path.join(glance_storage_location, basename) bundle = open(tmp_file, 'r') try: headers = { + 'x-image-meta-store': 'file', 'x-image-meta-is_public': 'True', - 'x-image-meta-name': glance_label, - 'x-image-meta-location': location, + 'x-image-meta-type': 'raw', + 'x-image-meta-name': image_name, 'x-image-meta-size': size, 'content-length': size, + 'content-type': 'application/octet-stream', } conn = httplib.HTTPConnection(glance_host, glance_port) #NOTE(sirp): httplib under python2.4 won't accept a file-like object |
