~ubuntu-branches/ubuntu/raring/nova/raring-proposed

« back to all changes in this revision

Viewing changes to plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Adam Gandelman, Chuck Short
  • Date: 2012-11-23 09:04:58 UTC
  • mfrom: (1.1.66)
  • Revision ID: package-import@ubuntu.com-20121123090458-91565o7aev1i1h71
Tags: 2013.1~g1-0ubuntu1
[ Adam Gandelman ]
* debian/control: Ensure novaclient is upgraded with nova,
  require python-keystoneclient >= 1:2.9.0. (LP: #1073289)
* debian/patches/{ubuntu/*, rbd-security.patch}: Dropped, applied
  upstream.
* debian/control: Add python-testtools to Build-Depends.

[ Chuck Short ]
* New upstream version.
* Refreshed debian/patches/avoid_setuptools_git_dependency.patch.
* debian/rules: FTBFS if missing binaries.
* debian/nova-scheudler.install: Add missing rabbit-queues and
  nova-rpc-zmq-receiver.
* Remove nova-volume since it doesnt exist anymore, transition to cinder-*.
* debian/rules: install apport hook in the right place.
* debian/patches/ubuntu-show-tests.patch: Display test failures.
* debian/control: Add depends on genisoimage
* debian/control: Suggest guestmount.
* debian/control: Suggest websockify. (LP: #1076442)
* debian/nova.conf: Disable nova-volume service.
* debian/control: Depend on xen-system-* rather than the hypervisor.
* debian/control, debian/mans/nova-conductor.8, debian/nova-conductor.init,
  debian/nova-conductor.install, debian/nova-conductor.logrotate
  debian/nova-conductor.manpages, debian/nova-conductor.postrm
  debian/nova-conductor.upstart.in: Add nova-conductor service.
* debian/control: Add python-fixtures as a build deps.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
CHUNK_SIZE = 8192
28
28
 
29
29
 
 
30
def delete_if_exists(path):
 
31
    try:
 
32
        os.unlink(path)
 
33
    except OSError, e:
 
34
        if e.errno == errno.ENOENT:
 
35
            logging.warning("'%s' was already deleted, skipping delete" % path)
 
36
        else:
 
37
            raise
 
38
 
 
39
 
30
40
def _link(src, dst):
31
41
    logging.info("Hard-linking file '%s' -> '%s'" % (src, dst))
32
42
    os.link(src, dst)
221
231
        if not filename.endswith('.vhd'):
222
232
            continue
223
233
 
 
234
        # Ignore legacy swap embedded in the image, generated on-the-fly now
224
235
        if filename == "swap.vhd":
225
236
            continue
226
237
 
242
253
 
243
254
    Returns: A dict of imported VHDs:
244
255
 
245
 
        {'root': {'uuid': 'ffff-aaaa'},
246
 
         'swap': {'uuid': 'ffff-bbbb'}}
 
256
        {'root': {'uuid': 'ffff-aaaa'}}
247
257
    """
248
258
    _handle_old_style_images(staging_path)
249
259
    _validate_sequenced_vhds(staging_path)
250
260
 
251
 
    imported_vhds = {}
252
261
    files_to_move = []
253
262
 
254
263
    # Collect sequenced VHDs and assign UUIDs to them
286
295
    _assert_vhd_not_hidden(leaf_vhd_path)
287
296
    _validate_vdi_chain(leaf_vhd_path)
288
297
 
289
 
    imported_vhds["root"] = {"uuid": leaf_vhd_uuid}
290
 
 
291
 
    # Handle swap file if present
292
 
    orig_swap_path = os.path.join(staging_path, "swap.vhd")
293
 
    if os.path.exists(orig_swap_path):
294
 
        # Rename swap.vhd -> aaaa-bbbb-cccc-dddd.vhd
295
 
        vhd_uuid = uuid_stack.pop()
296
 
        swap_path = os.path.join(staging_path, "%s.vhd" % vhd_uuid)
297
 
        _rename(orig_swap_path, swap_path)
298
 
 
299
 
        _assert_vhd_not_hidden(swap_path)
300
 
 
301
 
        imported_vhds["swap"] = {"uuid": vhd_uuid}
302
 
        files_to_move.append(swap_path)
303
 
 
304
298
    # Move files into SR
305
299
    for orig_path in files_to_move:
306
300
        new_path = os.path.join(sr_path, os.path.basename(orig_path))
307
301
        _rename(orig_path, new_path)
308
302
 
 
303
    imported_vhds = dict(root=dict(uuid=leaf_vhd_uuid))
309
304
    return imported_vhds
310
305
 
311
306