~ubuntu-branches/ubuntu/quantal/nova/quantal-proposed

« back to all changes in this revision

Viewing changes to nova/tests/api/ec2/test_cinder_cloud.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-08-16 14:04:11 UTC
  • mto: This revision was merged to the branch mainline in revision 84.
  • Revision ID: package-import@ubuntu.com-20120816140411-0mr4n241wmk30t9l
Tags: upstream-2012.2~f3
ImportĀ upstreamĀ versionĀ 2012.2~f3

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#    under the License.
19
19
 
20
20
import copy
 
21
import shutil
 
22
import tempfile
21
23
 
22
24
from nova.api.ec2 import cloud
23
25
from nova.api.ec2 import ec2utils
80
82
class CinderCloudTestCase(test.TestCase):
81
83
    def setUp(self):
82
84
        super(CinderCloudTestCase, self).setUp()
 
85
        vol_tmpdir = tempfile.mkdtemp()
83
86
        self.flags(compute_driver='nova.virt.fake.FakeDriver',
84
87
                   volume_api_class='nova.tests.fake_volume.API',
 
88
                   volumes_dir=vol_tmpdir,
85
89
                   stub_network=True)
86
90
 
87
91
        def fake_show(meh, context, id):
88
92
            return {'id': id,
 
93
                    'name': 'fake_name',
89
94
                    'container_format': 'ami',
90
95
                    'properties': {
91
96
                        'kernel_id': 'cedef40a-ed67-4d10-800e-17455edce175',
135
140
                               '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6')
136
141
 
137
142
    def tearDown(self):
 
143
        try:
 
144
            shutil.rmtree(FLAGS.volumes_dir)
 
145
        except OSError, e:
 
146
            pass
138
147
        self.volume_api.reset_fake_api(self.context)
139
148
        super(CinderCloudTestCase, self).tearDown()
140
149
        fake.FakeImageService_reset()
518
527
            {'device_name': '/dev/sdc4', 'no_device': True}]
519
528
        image1 = {
520
529
            'id': 'cedef40a-ed67-4d10-800e-17455edce175',
 
530
            'name': 'fake_name',
521
531
            'properties': {
522
532
                'kernel_id': 'cedef40a-ed67-4d10-800e-17455edce175',
523
533
                'type': 'machine',
532
542
                                  'snapshot_id': 01234567}]
533
543
        image2 = {
534
544
            'id': '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6',
 
545
            'name': 'fake_name',
535
546
            'properties': {
536
547
                'kernel_id': '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6',
537
548
                'type': 'machine',