Skip to content

Commit

Permalink
Merge pull request #361 from MirantisWorkloadMobility/devel
Browse files Browse the repository at this point in the history
Release 2015-08-27
  • Loading branch information
MirantisWorkloadMobility committed Aug 27, 2015
2 parents fa58129 + 3180c53 commit da9c9c9
Show file tree
Hide file tree
Showing 48 changed files with 1,968 additions and 360 deletions.
59 changes: 59 additions & 0 deletions QUICKSTART.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Quick Start Guide

1. Get CloudFerry sources
```
git clone https://github.com/MirantisWorkloadMobility/CloudFerry.git
cd CloudFerry
git fetch
# The latest code is in devel branch
git checkout -b devel origin/devel
```
2. Install vagrant (devlab requires vagrant version >= 1.6)
```
wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2_x86_64.deb
sudo dpkg -i vagrant_1.7.2_x86_64.deb
```
3. Install virtualbox hypervisor
```
sudo apt-get install virtualbox -y
```
4. Setup development environment
```
cd CloudFerry/devlab
vagrant up grizzly icehouse
```
5. Setup virtual environment for cloudferry
```
apt-get install python-dev python-virtualenv libffi-dev -y
cd CloudFerry
virtualenv .venv
source .venv/bin/activate
pip install pip==6.1.1
pip install --allow-all-external -r requirements.txt
pip install -r test-requirements.txt
```
6. Generate cloudferry config for development lab
```
cd CloudFerry
./devlab/provision/generate_config.sh --cloudferry-path $(pwd)
```
7. Generate load on source VM (this will create a number of VMs on grizzly node)
```
cd CloudFerry/devlab/tests
source ./openrc.example
python ./generate_load.py --clean
python ./generate_load.py
```
8. Run migration
```
cd CloudFerry
source .venv/bin/activate
fab migrate:configuration.ini,debug=True
```
39 changes: 2 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,41 +119,6 @@ Run migration as usual:
fab migrate:<configuration file>
```

## Playground

# Versions

## 1.0 - Full devlab environment migration

See `devlab/tests/generate_load.py` for the load migrated.

See `devlab/README.md` for test environment description.

- Successful tenants migration
- Successful users migration
- Successful roles migration
- Successful keypairs migration
* User's
* Admin's
- Successful quotas migration
* Quotas for all tenants
* Tenant's quotas
- Successful flavors migration
- Successful images migration
- Successful volumes migration
* User's
* Admin's
- Successful security groups migration
* User's
* Admin's
- Successful networks migration
* Tenant's
* External
- Successful subnets migration
- Successful routers migration
- Successful floating-ips migration
* Associated with VM's
* Allocated in tenants
- Successful VMs migration
* Admin's
* User's

See QUICKSTART.md for the quickest way of running your first successful migration.
6 changes: 6 additions & 0 deletions cloudferrylib/base/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ class OutOfResources(Exception):

class ImageDownloadError(Exception):
pass


class AbortMigrationError(RuntimeError):
"""Non-recoverable exception which must be used in cases where migration
process MUST be aborted"""
pass
34 changes: 0 additions & 34 deletions cloudferrylib/os/actions/check_compute_backend.py

This file was deleted.

34 changes: 0 additions & 34 deletions cloudferrylib/os/actions/check_image_backend.py

This file was deleted.

64 changes: 64 additions & 0 deletions cloudferrylib/os/actions/check_openstack_apis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright 2015 Mirantis Inc.
#
# 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 cloudferrylib.base.action import action
from cloudferrylib.base import exception
from cloudferrylib.utils import utils as utl

LOG = utl.get_log(__name__)


def check(os_api_call, os_api_type, position):
try:
LOG.info("Checking %s APIs availability on %s.",
os_api_type, position.upper())
os_api_call()
except Exception as e:
message = ('{os_api_type} APIs on {position} check failed with: '
'"{msg}". Check your configuration.').format(
os_api_type=os_api_type, msg=e.message, position=position.upper())
LOG.error(message)
raise exception.AbortMigrationError(message)


class CheckImageBackend(action.Action):
def run(self, **kwargs):
"""Check image backend by getting list of images."""
image_resource = self.cloud.resources[utl.IMAGE_RESOURCE]
check(image_resource.glance_client.images.list, 'Glance',
self.cloud.position)


class CheckComputeBackend(action.Action):
def run(self, **kwargs):
"""Check compute backend by getting instances list."""
compute_resource = self.cloud.resources[utl.COMPUTE_RESOURCE]
check(compute_resource.nova_client.servers.list, 'Nova',
self.cloud.position)


class CheckStorageBackend(action.Action):
def run(self, **kwargs):
"""Check storage backend by getting volumes list."""
storage_resource = self.cloud.resources[utl.STORAGE_RESOURCE]
check(storage_resource.cinder_client.volumes.list, 'Cinder',
self.cloud.position)


class CheckNetworkingAPIs(action.Action):
def run(self, **kwargs):
"""Check networking backend by getting network list."""
neutron = self.cloud.resources[utl.NETWORK_RESOURCE]
check(neutron.neutron_client.list_networks, 'Neutron',
self.cloud.position)
39 changes: 32 additions & 7 deletions cloudferrylib/os/actions/check_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,52 @@
# implied.
# See the License for the specific language governing permissions and#
# limitations under the License.

from operator import itemgetter

from fabric.api import settings

from cloudferrylib.base.action import action
from cloudferrylib.base import exception
from cloudferrylib.utils import remote_runner
from cloudferrylib.utils import utils as utl
from cloudferrylib.utils import utils


LOG = utils.get_log(__name__)


class CheckSSH(action.Action):
def run(self, info=None, **kwargs):
check_results = []
check_failed = False

for node in self.get_compute_nodes():
self.check_access(node)
node_ssh_failed = self.check_access(node)
check_failed = check_failed or node_ssh_failed
check_results.append((node, node_ssh_failed))

if check_failed:
message = "SSH check failed for following nodes: '{nodes}'".format(
nodes=map(itemgetter(0),
filter(lambda (n, status): status, check_results)))
LOG.error(message)
raise exception.AbortMigrationError(message)

def get_compute_nodes(self):
return self.cloud.resources[utl.COMPUTE_RESOURCE].get_compute_hosts()
return self.cloud.resources[utils.COMPUTE_RESOURCE].get_compute_hosts()

def check_access(self, node):
ssh_access_failed = False

cfg = self.cloud.cloud_config.cloud
runner = remote_runner.RemoteRunner(node, cfg.ssh_user,
password=cfg.ssh_sudo_password)
with settings(abort_on_prompts=True,
gateway=self.cloud.getIpSsh()):
runner.run('echo')
gateway = self.cloud.getIpSsh()
try:
with settings(gateway=gateway):
runner.run('echo')
except Exception as error:
LOG.error("SSH connection from '%s' to '%s' failed with error: "
"'%s'", gateway, node, error.message)
ssh_access_failed = True

return ssh_access_failed
34 changes: 0 additions & 34 deletions cloudferrylib/os/actions/check_storage_backend.py

This file was deleted.

Loading

0 comments on commit da9c9c9

Please sign in to comment.