Merge "Add live_migrate_integration_test"
This commit is contained in:
commit
96f456d1e1
|
@ -0,0 +1,68 @@
|
|||
"""
|
||||
Copyright 2014 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
from cafe.drivers.unittest.decorators import (
|
||||
data_driven_test, DataDrivenFixture)
|
||||
from cloudcafe.compute.composites import ComputeAdminComposite
|
||||
|
||||
from cloudroast.blockstorage.volumes_api.integration.compute.fixtures \
|
||||
import ComputeIntegrationTestFixture
|
||||
# from cloudcafe.blockstorage.datasets import ComputeIntegrationDatasets
|
||||
from cloudroast.blockstorage.volumes_api.integration.compute.datasets \
|
||||
import bfv_datasets
|
||||
|
||||
|
||||
@DataDrivenFixture
|
||||
class BootFromVolumeLiveMigrateIntegration(ComputeIntegrationTestFixture):
|
||||
|
||||
@data_driven_test(bfv_datasets.flavors_by_images_by_volume_type)
|
||||
def ddtest_live_migrate_bfv_server_with_seven_attached_volumes(
|
||||
self, image, flavor, volume_type):
|
||||
|
||||
os_type = self.get_image_os_type(image.id)
|
||||
|
||||
# Create a volume
|
||||
volume = self.create_volume_from_image_test(volume_type, image)
|
||||
|
||||
# Create block device mapping
|
||||
bdm = self.compute.servers.behaviors.create_block_device_mapping_v1(
|
||||
volume.id_, True, 'vda', volume.size, volume_type.id_)
|
||||
|
||||
# Boot a server from the volume
|
||||
server = self.servers.behaviors.create_active_server(
|
||||
name=self.random_server_name(), flavor_ref=flavor.id,
|
||||
block_device_mapping=bdm).entity
|
||||
|
||||
# Connect to server
|
||||
self.server_conn = self.connect_to_instance(server, os_type=os_type)
|
||||
|
||||
# Create and attach seven volumes
|
||||
for x in range(0, 6):
|
||||
extra_volumes = self.new_volume()
|
||||
self.compute.volume_attachments.behaviors.attach_volume_to_server(
|
||||
server.id, extra_volumes.id_)
|
||||
|
||||
# Write data to the root disk
|
||||
resp = self.server_conn.create_large_file(multiplier=0.1)
|
||||
self.assertTrue(resp, "Unable to write data to bootable OS volume")
|
||||
|
||||
# Live migration
|
||||
# Verify live migration
|
||||
self.compute_admin = ComputeAdminComposite()
|
||||
|
||||
self.compute_admin.servers.client.live_migrate_server(
|
||||
self.server.id, block_migration=True, disk_over_commit=False)
|
||||
self.compute_admin.servers.behaviors.wait_for_server_status(
|
||||
self.server.id, "active")
|
Loading…
Reference in New Issue