~zulcss/nova/nova-precise-g3

« back to all changes in this revision

Viewing changes to nova/tests/test_powervm.py

  • Committer: Chuck Short
  • Date: 2013-02-25 12:48:57 UTC
  • mfrom: (94.1.5 raring-proposed)
  • Revision ID: zulcss@ubuntu.com-20130225124857-iiz7w0zqhjo1sbs3
* New upstream release for the Ubuntu Cloud Archive. 
* 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.
* debian/control: Fix typo (websocikfy -> websockify).
* SECURITY UPDATE: fix lack of authentication on block device used for
  os-volume_boot
  - debian/patches/CVE-2013-0208.patch: adjust nova/compute/api.py to
    validate we can access the volumes
  - CVE-2013-0208

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from nova import test
24
24
 
25
25
from nova.compute import power_state
 
26
from nova.network import model as network_model
26
27
from nova.openstack.common import log as logging
 
28
from nova.tests import fake_network_cache_model
27
29
from nova.virt import images
28
30
from nova.virt.powervm import blockdev as powervm_blockdev
29
31
from nova.virt.powervm import common
156
158
        self.stubs.Set(images, 'fetch_to_raw', fake_image_fetch_to_raw)
157
159
        image_meta = {}
158
160
        image_meta['id'] = '666'
 
161
        fake_net_info = network_model.NetworkInfo([
 
162
                                     fake_network_cache_model.new_vif()])
159
163
        self.powervm_connection.spawn(context.get_admin_context(),
160
 
                                      self.instance, image_meta, 's3cr3t', [])
 
164
                                      self.instance, image_meta, [], 's3cr3t',
 
165
                                      fake_net_info)
161
166
        state = self.powervm_connection.get_info(self.instance)['state']
162
167
        self.assertEqual(state, power_state.RUNNING)
163
168
 
164
169
    def test_spawn_cleanup_on_fail(self):
165
 
        """Verify on a failed spawn, we get the original exception raised"""
 
170
        # Verify on a failed spawn, we get the original exception raised.
166
171
        # helper function
167
172
        def raise_(ex):
168
173
            raise ex
176
181
        self.stubs.Set(
177
182
            self.powervm_connection._powervm, '_cleanup',
178
183
            lambda *x, **y: raise_(Exception('This should be logged.')))
179
 
 
 
184
        fake_net_info = network_model.NetworkInfo([
 
185
                                     fake_network_cache_model.new_vif()])
180
186
        self.assertRaises(exception.PowerVMImageCreationFailed,
181
187
                          self.powervm_connection.spawn,
182
188
                          context.get_admin_context(),
183
189
                          self.instance,
184
 
                          {'id': 'ANY_ID'}, 's3cr3t', [])
 
190
                          {'id': 'ANY_ID'}, [], 's3cr3t', fake_net_info)
185
191
 
186
192
    def test_destroy(self):
187
193
        self.powervm_connection.destroy(self.instance, None)