~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, Chuck Short, Adam Gandelman
  • Date: 2013-02-22 09:27:29 UTC
  • mfrom: (1.1.68)
  • Revision ID: package-import@ubuntu.com-20130222092729-nn3gt8rf97uvts77
Tags: 2013.1.g3-0ubuntu1
[ Chuck Short ]
* New usptream release. 
* debian/patches/debian/patches/fix-ubuntu-tests.patch: Refreshed.
* debian/nova-baremetal.logrotate: Fix logfile path.
* debian/control, debian/nova-spiceproxy.{install, logrotate, upstart}:
  Add spice html5 proxy support.
* debian/nova-novncproxy.upstart: Start on runlevel [2345]
* debian/rules: Call testr directly since run_tests.sh -N gives weird return
  value when tests pass.
* debian/pyddist-overrides: Add websockify.
* debian/nova-common.postinst: Removed config file conversion, since
  the option is no longer available. (LP: #1110567)
* debian/control: Add python-pyasn1 as a dependency.
* debian/control: Add python-oslo-config as a dependency.
* debian/control: Suggest sysfsutils, sg3-utils, multipath-tools for fibre
  channel support.

[ Adam Gandelman ]
* debian/control: Fix typo (websocikfy -> websockify).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
2
 
 
3
# Copyright (c) 2012 VMware, Inc.
3
4
# Copyright (c) 2011 Citrix Systems, Inc.
4
5
# Copyright 2011 OpenStack LLC.
5
6
#
17
18
"""
18
19
Utility functions for Image transfer.
19
20
"""
20
 
import StringIO
21
21
 
22
22
from nova import exception
23
23
from nova.image import glance
50
50
    # to read.
51
51
    read_thread = io_util.IOThread(read_file_handle, thread_safe_pipe)
52
52
 
53
 
    # In case of Glance - VMWare transfer, we just need a handle to the
54
 
    # HTTP Connection that is to send transfer data to the VMWare datastore.
 
53
    # In case of Glance - VMware transfer, we just need a handle to the
 
54
    # HTTP Connection that is to send transfer data to the VMware datastore.
55
55
    if write_file_handle:
56
56
        write_thread = io_util.IOThread(thread_safe_pipe, write_file_handle)
57
 
    # In case of VMWare - Glance transfer, we relinquish VMWare HTTP file read
 
57
    # In case of VMware - Glance transfer, we relinquish VMware HTTP file read
58
58
    # handle to Glance Client instance, but to be sure of the transfer we need
59
 
    # to be sure of the status of the image on glnace changing to active.
 
59
    # to be sure of the status of the image on glance changing to active.
60
60
    # The GlanceWriteThread handles the same for us.
61
61
    elif image_service and image_id:
62
62
        write_thread = io_util.GlanceWriteThread(context, thread_safe_pipe,
93
93
    (image_service, image_id) = glance.get_remote_image_service(context, image)
94
94
    metadata = image_service.show(context, image_id)
95
95
    file_size = int(metadata['size'])
96
 
    f = StringIO.StringIO()
97
 
    image_service.download(context, image_id, f)
98
 
    read_file_handle = read_write_util.GlanceFileRead(f)
99
 
    write_file_handle = read_write_util.VMWareHTTPWriteFile(
 
96
    read_iter = image_service.download(context, image_id)
 
97
    read_file_handle = read_write_util.GlanceFileRead(read_iter)
 
98
    write_file_handle = read_write_util.VMwareHTTPWriteFile(
100
99
                                kwargs.get("host"),
101
100
                                kwargs.get("data_center_name"),
102
101
                                kwargs.get("datastore_name"),
113
112
    """Upload the snapshotted vm disk file to Glance image server."""
114
113
    LOG.debug(_("Uploading image %s to the Glance image server") % image,
115
114
              instance=instance)
116
 
    read_file_handle = read_write_util.VmWareHTTPReadFile(
 
115
    read_file_handle = read_write_util.VMwareHTTPReadFile(
117
116
                                kwargs.get("host"),
118
117
                                kwargs.get("data_center_name"),
119
118
                                kwargs.get("datastore_name"),
122
121
    file_size = read_file_handle.get_size()
123
122
    (image_service, image_id) = glance.get_remote_image_service(context, image)
124
123
    # The properties and other fields that we need to set for the image.
125
 
    image_metadata = {"is_public": True,
126
 
                      "disk_format": "vmdk",
 
124
    image_metadata = {"disk_format": "vmdk",
127
125
                      "container_format": "bare",
128
 
                      "type": "vmdk",
 
126
                      "size": file_size,
129
127
                      "properties": {"vmware_adaptertype":
130
128
                                            kwargs.get("adapter_type"),
131
129
                                     "vmware_ostype": kwargs.get("os_type"),