
messages can be found on GitHub: https://github.com/imcleod/novaimagebuilder/commits/new This work represents the switch from a REST service to a CLI and module library for building Glance images using Nova, Glance, Cinder, and native operating system installers. Change-Id: I1edd1ca5a66f18403c75acd8376ef859c6710907
47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
# encoding: utf-8
|
|
|
|
# Copyright 2013 Red Hat, 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.
|
|
|
|
import logging
|
|
import uuid
|
|
|
|
|
|
class MockNovaInstance(object):
|
|
|
|
INSTANCE_STATUS_LIST = ('status placeholder')
|
|
|
|
def __init__(self, instance, stack_env):
|
|
self.log = logging.getLogger('%s.%s' % (__name__, self.__class__.__name__))
|
|
self.last_disk_activity = 0
|
|
self.last_net_activity = 0
|
|
self.instance = instance
|
|
self.instance_id = str(uuid.uuid4())
|
|
self.instance_status_index = 0
|
|
self.stack_env = stack_env
|
|
self.active = True
|
|
|
|
@property
|
|
def id(self):
|
|
return self.instance_id
|
|
|
|
@property
|
|
def status(self):
|
|
return self.INSTANCE_STATUS_LIST[self.instance_status_index]
|
|
|
|
def get_disk_and_net_activity(self):
|
|
return self.last_disk_activity, self.last_net_activity
|
|
|
|
def is_active(self):
|
|
return self.active |