Michael Basnight 4eb7e34ca9 More changes to facilitate oslo.
* Cleaning up the CONF defaults in paste created classes
* Updated mgmt-taskmanager
* Small updates to files for oslo
* Removed executils, local
* Fixing constants (removing them from inside method defs)

implements blueprint reddwarf/upgrade-oslo

Change-Id: Ib1a9fe4a829ce2541323693650db412209298a9f
2013-01-14 16:01:35 -06:00

78 lines
3.1 KiB
Python

# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# 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.
import traceback
from eventlet import greenthread
from reddwarf.common import exception
from reddwarf.openstack.common import log as logging
from reddwarf.openstack.common import periodic_task
from reddwarf.openstack.common.rpc.common import UnsupportedRpcVersion
from reddwarf.openstack.common.gettextutils import _
from reddwarf.taskmanager import models
from reddwarf.taskmanager.models import BuiltInstanceTasks
from reddwarf.taskmanager.models import FreshInstanceTasks
LOG = logging.getLogger(__name__)
RPC_API_VERSION = "1.0"
class Manager(periodic_task.PeriodicTasks):
def resize_volume(self, context, instance_id, new_size):
instance_tasks = models.BuiltInstanceTasks.load(context, instance_id)
instance_tasks.resize_volume(new_size)
def resize_flavor(self, context, instance_id, new_flavor_id,
old_memory_size, new_memory_size):
instance_tasks = models.BuiltInstanceTasks.load(context, instance_id)
instance_tasks.resize_flavor(new_flavor_id, old_memory_size,
new_memory_size)
def reboot(self, context, instance_id):
instance_tasks = models.BuiltInstanceTasks.load(context, instance_id)
instance_tasks.reboot()
def restart(self, context, instance_id):
instance_tasks = models.BuiltInstanceTasks.load(context, instance_id)
instance_tasks.restart()
def migrate(self, context, instance_id):
instance_tasks = models.BuiltInstanceTasks.load(context, instance_id)
instance_tasks.migrate()
def delete_instance(self, context, instance_id):
try:
instance_tasks = models.BuiltInstanceTasks.load(context,
instance_id)
instance_tasks.delete_async()
except exception.UnprocessableEntity as upe:
instance_tasks = models.FreshInstanceTasks.load(context,
instance_id)
instance_tasks.delete_async()
def create_instance(self, context, instance_id, name, flavor_id,
flavor_ram, image_id, databases, users, service_type,
volume_size):
instance_tasks = FreshInstanceTasks.load(context, instance_id)
instance_tasks.create_instance(flavor_id, flavor_ram, image_id,
databases, users, service_type,
volume_size)