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

« back to all changes in this revision

Viewing changes to nova/compute/utils.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-09-26 12:56:25 UTC
  • mfrom: (1.1.64)
  • Revision ID: package-import@ubuntu.com-20120926125625-27eb9h4hadrjqzjm
Tags: 2012.2~rc3-0ubuntu1
New upstream relase. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import traceback
22
22
 
23
23
from nova import block_device
 
24
from nova.compute import instance_types
24
25
from nova import db
25
26
from nova import exception
26
27
from nova import flags
79
80
        prefix = block_device.match_device(mappings['root'])[0]
80
81
    except (TypeError, AttributeError, ValueError):
81
82
        raise exception.InvalidDevicePath(path=mappings['root'])
 
83
    # NOTE(vish): remove this when xenapi is setting default_root_device
 
84
    if (FLAGS.connection_type == 'xenapi' or
 
85
        FLAGS.compute_driver.endswith('xenapi.XenAPIDriver')):
 
86
        prefix = '/dev/xvd'
82
87
    if req_prefix != prefix:
83
88
        LOG.debug(_("Using %(prefix)s instead of %(req_prefix)s") % locals())
84
89
    letters_list = []
89
94
        letter = re.sub("\d+", "", letter)
90
95
        letters_list.append(letter)
91
96
    used_letters = set(letters_list)
 
97
 
 
98
    # NOTE(vish): remove this when xenapi is properly setting
 
99
    #             default_ephemeral_device and default_swap_device
 
100
    if (FLAGS.connection_type == 'xenapi' or
 
101
        FLAGS.compute_driver.endswith('xenapi.XenAPIDriver')):
 
102
        instance_type_id = instance['instance_type_id']
 
103
        instance_type = instance_types.get_instance_type(instance_type_id)
 
104
        if instance_type['ephemeral_gb']:
 
105
            used_letters.update('b')
 
106
        if instance_type['swap']:
 
107
            used_letters.update('c')
 
108
 
92
109
    if not req_letters:
93
110
        req_letters = _get_unused_letters(used_letters)
94
111
    if req_letters in used_letters: