~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

Viewing changes to nova/virt/vmwareapi/vmware_images.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-05-24 13:12:53 UTC
  • mfrom: (1.1.55)
  • Revision ID: package-import@ubuntu.com-20120524131253-ommql08fg1en06ut
Tags: 2012.2~f1-0ubuntu1
* New upstream release.
* Prepare for quantal:
  - Dropped debian/patches/upstream/0006-Use-project_id-in-ec2.cloud._format_image.patch
  - Dropped debian/patches/upstream/0005-Populate-image-properties-with-project_id-again.patch
  - Dropped debian/patches/upstream/0004-Fixed-bug-962840-added-a-test-case.patch
  - Dropped debian/patches/upstream/0003-Allow-unprivileged-RADOS-users-to-access-rbd-volumes.patch
  - Dropped debian/patches/upstream/0002-Stop-libvirt-test-from-deleting-instances-dir.patch
  - Dropped debian/patches/upstream/0001-fix-bug-where-nova-ignores-glance-host-in-imageref.patch 
  - Dropped debian/patches/0001-fix-useexisting-deprecation-warnings.patch
* debian/control: Add python-keystone as a dependency. (LP: #907197)
* debian/patches/kombu_tests_timeout.patch: Refreshed.
* debian/nova.conf, debian/nova-common.postinst: Convert to new ini
  file configuration
* debian/patches/nova-manage_flagfile_location.patch: Refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
 
76
76
        # Log and raise the exception.
77
77
        LOG.exception(exc)
78
 
        raise exception.Error(exc)
 
78
        raise exception.NovaException(exc)
79
79
    finally:
80
80
        # No matter what, try closing the read and write handles, if it so
81
81
        # applies.
86
86
 
87
87
def fetch_image(context, image, instance, **kwargs):
88
88
    """Download image from the glance image server."""
89
 
    LOG.debug(_("Downloading image %s from glance image server") % image)
 
89
    LOG.debug(_("Downloading image %s from glance image server") % image,
 
90
              instance=instance)
90
91
    (glance_client, image_id) = glance.get_glance_client(context, image)
91
92
    metadata, read_iter = glance_client.get_image(image_id)
92
93
    read_file_handle = read_write_util.GlanceFileRead(read_iter)
100
101
                                file_size)
101
102
    start_transfer(read_file_handle, file_size,
102
103
                   write_file_handle=write_file_handle)
103
 
    LOG.debug(_("Downloaded image %s from glance image server") % image)
 
104
    LOG.debug(_("Downloaded image %s from glance image server") % image,
 
105
              instance=instance)
104
106
 
105
107
 
106
108
def upload_image(context, image, instance, **kwargs):
107
109
    """Upload the snapshotted vm disk file to Glance image server."""
108
 
    LOG.debug(_("Uploading image %s to the Glance image server") % image)
 
110
    LOG.debug(_("Uploading image %s to the Glance image server") % image,
 
111
              instance=instance)
109
112
    read_file_handle = read_write_util.VmWareHTTPReadFile(
110
113
                                kwargs.get("host"),
111
114
                                kwargs.get("data_center_name"),
126
129
                                            kwargs.get("image_version")}}
127
130
    start_transfer(read_file_handle, file_size, glance_client=glance_client,
128
131
                        image_id=image_id, image_meta=image_metadata)
129
 
    LOG.debug(_("Uploaded image %s to the Glance image server") % image)
 
132
    LOG.debug(_("Uploaded image %s to the Glance image server") % image,
 
133
              instance=instance)
130
134
 
131
135
 
132
136
def get_vmdk_size_and_properties(context, image, instance):
136
140
    geometry of the disk created depends on the size.
137
141
    """
138
142
 
139
 
    LOG.debug(_("Getting image size for the image %s") % image)
 
143
    LOG.debug(_("Getting image size for the image %s") % image,
 
144
              instance=instance)
140
145
    (glance_client, image_id) = glance.get_glance_client(context, image)
141
146
    meta_data = glance_client.get_image_meta(image_id)
142
147
    size, properties = meta_data["size"], meta_data["properties"]
143
148
    LOG.debug(_("Got image size of %(size)s for the image %(image)s") %
144
 
              locals())
 
149
              locals(), instance=instance)
145
150
    return size, properties