~1chb1n/charms/trusty/hacluster/next.1601-test-update2

« back to all changes in this revision

Viewing changes to tests/charmhelpers/contrib/openstack/amulet/deployment.py

  • Committer: Liam Young
  • Date: 2015-08-03 14:53:08 UTC
  • Revision ID: liam.young@canonical.com-20150803145308-ehe08om32j2ojvvu
[gnuoy,trivial] Pre-release charmhelper sync

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with charm-helpers.  If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
17
import six
 
18
from collections import OrderedDict
18
19
from charmhelpers.contrib.amulet.deployment import (
19
20
    AmuletDeployment
20
21
)
43
44
           Determine if the local branch being tested is derived from its
44
45
           stable or next (dev) branch, and based on this, use the corresonding
45
46
           stable or next branches for the other_services."""
46
 
        base_charms = ['mysql', 'mongodb', 'rabbitmq-server']
 
47
        base_charms = ['mysql', 'mongodb']
 
48
 
 
49
        if self.series in ['precise', 'trusty']:
 
50
            base_series = self.series
 
51
        else:
 
52
            base_series = self.current_next
47
53
 
48
54
        if self.stable:
49
55
            for svc in other_services:
50
 
                temp = 'lp:charms/{}'
51
 
                svc['location'] = temp.format(svc['name'])
 
56
                temp = 'lp:charms/{}/{}'
 
57
                svc['location'] = temp.format(base_series,
 
58
                                              svc['name'])
52
59
        else:
53
60
            for svc in other_services:
54
61
                if svc['name'] in base_charms:
55
 
                    temp = 'lp:charms/{}'
56
 
                    svc['location'] = temp.format(svc['name'])
 
62
                    temp = 'lp:charms/{}/{}'
 
63
                    svc['location'] = temp.format(base_series,
 
64
                                                  svc['name'])
57
65
                else:
58
66
                    temp = 'lp:~openstack-charmers/charms/{}/{}/next'
59
67
                    svc['location'] = temp.format(self.current_next,
71
79
        services.append(this_service)
72
80
        use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
73
81
                      'ceph-osd', 'ceph-radosgw']
74
 
        # Openstack subordinate charms do not expose an origin option as that
75
 
        # is controlled by the principle
76
 
        ignore = ['neutron-openvswitch']
 
82
        # Most OpenStack subordinate charms do not expose an origin option
 
83
        # as that is controlled by the principle.
 
84
        ignore = ['cinder-ceph', 'hacluster', 'neutron-openvswitch']
77
85
 
78
86
        if self.openstack:
79
87
            for svc in services:
98
106
           Return an integer representing the enum value of the openstack
99
107
           release.
100
108
           """
 
109
        # Must be ordered by OpenStack release (not by Ubuntu release):
101
110
        (self.precise_essex, self.precise_folsom, self.precise_grizzly,
102
111
         self.precise_havana, self.precise_icehouse,
103
 
         self.trusty_icehouse) = range(6)
 
112
         self.trusty_icehouse, self.trusty_juno, self.utopic_juno,
 
113
         self.trusty_kilo, self.vivid_kilo, self.trusty_liberty,
 
114
         self.wily_liberty) = range(12)
 
115
 
104
116
        releases = {
105
117
            ('precise', None): self.precise_essex,
106
118
            ('precise', 'cloud:precise-folsom'): self.precise_folsom,
107
119
            ('precise', 'cloud:precise-grizzly'): self.precise_grizzly,
108
120
            ('precise', 'cloud:precise-havana'): self.precise_havana,
109
121
            ('precise', 'cloud:precise-icehouse'): self.precise_icehouse,
110
 
            ('trusty', None): self.trusty_icehouse}
 
122
            ('trusty', None): self.trusty_icehouse,
 
123
            ('trusty', 'cloud:trusty-juno'): self.trusty_juno,
 
124
            ('trusty', 'cloud:trusty-kilo'): self.trusty_kilo,
 
125
            ('trusty', 'cloud:trusty-liberty'): self.trusty_liberty,
 
126
            ('utopic', None): self.utopic_juno,
 
127
            ('vivid', None): self.vivid_kilo,
 
128
            ('wily', None): self.wily_liberty}
111
129
        return releases[(self.series, self.openstack)]
 
130
 
 
131
    def _get_openstack_release_string(self):
 
132
        """Get openstack release string.
 
133
 
 
134
           Return a string representing the openstack release.
 
135
           """
 
136
        releases = OrderedDict([
 
137
            ('precise', 'essex'),
 
138
            ('quantal', 'folsom'),
 
139
            ('raring', 'grizzly'),
 
140
            ('saucy', 'havana'),
 
141
            ('trusty', 'icehouse'),
 
142
            ('utopic', 'juno'),
 
143
            ('vivid', 'kilo'),
 
144
            ('wily', 'liberty'),
 
145
        ])
 
146
        if self.openstack:
 
147
            os_origin = self.openstack.split(':')[1]
 
148
            return os_origin.split('%s-' % self.series)[1].split('/')[0]
 
149
        else:
 
150
            return releases[self.series]
 
151
 
 
152
    def get_ceph_expected_pools(self, radosgw=False):
 
153
        """Return a list of expected ceph pools in a ceph + cinder + glance
 
154
        test scenario, based on OpenStack release and whether ceph radosgw
 
155
        is flagged as present or not."""
 
156
 
 
157
        if self._get_openstack_release() >= self.trusty_kilo:
 
158
            # Kilo or later
 
159
            pools = [
 
160
                'rbd',
 
161
                'cinder',
 
162
                'glance'
 
163
            ]
 
164
        else:
 
165
            # Juno or earlier
 
166
            pools = [
 
167
                'data',
 
168
                'metadata',
 
169
                'rbd',
 
170
                'cinder',
 
171
                'glance'
 
172
            ]
 
173
 
 
174
        if radosgw:
 
175
            pools.extend([
 
176
                '.rgw.root',
 
177
                '.rgw.control',
 
178
                '.rgw',
 
179
                '.rgw.gc',
 
180
                '.users.uid'
 
181
            ])
 
182
 
 
183
        return pools