Merge "Use IRONIC_USE_RESOURCE_CLASSES in devstack plugin"
This commit is contained in:
commit
4dccc168c1
@ -184,19 +184,27 @@ function cleanup_mogan {
|
|||||||
|
|
||||||
|
|
||||||
function create_flavor {
|
function create_flavor {
|
||||||
openstack baremetal flavor create ${MOGAN_DEFAULT_FLAVOR} --description 'Mogan default flavor' --resources ${MOGAN_DEFAULT_FLAVOR}=1
|
# this makes consistency with ironic resource class, will move the mogan flavor
|
||||||
}
|
# creation to ironic devstack plugin when we are offical.
|
||||||
|
if [[ "$IRONIC_IS_HARDWARE" == "False" ]]; then
|
||||||
|
local ironic_node_cpu=$IRONIC_VM_SPECS_CPU
|
||||||
function update_ironic_node_resource_class {
|
local ironic_node_ram=$IRONIC_VM_SPECS_RAM
|
||||||
ironic_nodes=$(openstack baremetal node list -c UUID -f value)
|
local ironic_node_disk=$IRONIC_VM_SPECS_DISK
|
||||||
for node in ${ironic_nodes};do
|
else
|
||||||
openstack --os-baremetal-api-version latest baremetal node set --resource-class ${MOGAN_DEFAULT_FLAVOR} ${node}
|
local ironic_node_cpu=$IRONIC_HW_NODE_CPU
|
||||||
done
|
local ironic_node_ram=$IRONIC_HW_NODE_RAM
|
||||||
|
local ironic_node_disk=$IRONIC_HW_NODE_DISK
|
||||||
|
fi
|
||||||
|
# this will look like baremetal_1cpu_256mbram_10gbdisk
|
||||||
|
resource_class="baremetal_${ironic_node_cpu}cpu_${ironic_node_ram}mbram_${ironic_node_disk}gbdisk"
|
||||||
|
openstack baremetal flavor create ${resource_class} --description 'Mogan default flavor' --resources ${resource_class}=1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if is_service_enabled mogan; then
|
if is_service_enabled mogan; then
|
||||||
|
if [[ "$IRONIC_USE_RESOURCE_CLASSES" == "False" ]]; then
|
||||||
|
die "Ironic node resource class is required for Mogan"
|
||||||
|
fi
|
||||||
if ! is_service_enabled placement; then
|
if ! is_service_enabled placement; then
|
||||||
die "placement service is required for Mogan"
|
die "placement service is required for Mogan"
|
||||||
fi
|
fi
|
||||||
@ -218,8 +226,6 @@ if is_service_enabled mogan; then
|
|||||||
start_mogan
|
start_mogan
|
||||||
echo_summary "Creating flavor"
|
echo_summary "Creating flavor"
|
||||||
create_flavor
|
create_flavor
|
||||||
echo_summary "Updating ironic node resource class"
|
|
||||||
update_ironic_node_resource_class
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$1" == "unstack" ]]; then
|
if [[ "$1" == "unstack" ]]; then
|
||||||
|
@ -27,4 +27,3 @@ MOGAN_SERVICE_PORT=${MOGAN_SERVICE_PORT:-6688}
|
|||||||
MOGAN_SERVICE_PROTOCOL=${MOGAN_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
|
MOGAN_SERVICE_PROTOCOL=${MOGAN_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
|
||||||
|
|
||||||
MOGAN_ADMIN_USER=${MOGAN_ADMIN_USER:-mogan}
|
MOGAN_ADMIN_USER=${MOGAN_ADMIN_USER:-mogan}
|
||||||
MOGAN_DEFAULT_FLAVOR=${MOGAN_DEFAULT_FLAVOR:-small}
|
|
||||||
|
@ -298,6 +298,9 @@ Create devstack/local.conf with minimal settings required to enable Mogan
|
|||||||
# Swift temp URL's are required for agent_* drivers.
|
# Swift temp URL's are required for agent_* drivers.
|
||||||
SWIFT_ENABLE_TEMPURLS=True
|
SWIFT_ENABLE_TEMPURLS=True
|
||||||
|
|
||||||
|
# Set resource_classes for nodes to use placement service
|
||||||
|
IRONIC_USE_RESOURCE_CLASSES=True
|
||||||
|
|
||||||
# Create 3 virtual machines to pose as Ironic's baremetal nodes.
|
# Create 3 virtual machines to pose as Ironic's baremetal nodes.
|
||||||
IRONIC_VM_COUNT=3
|
IRONIC_VM_COUNT=3
|
||||||
IRONIC_VM_SSH_PORT=22
|
IRONIC_VM_SSH_PORT=22
|
||||||
|
@ -52,15 +52,14 @@ class BaseBaremetalComputeTest(tempest.test.BaseTestCase):
|
|||||||
cls.os_admin.network_floatingip_client
|
cls.os_admin.network_floatingip_client
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_small_flavor(cls):
|
def _get_flavor(cls):
|
||||||
|
# TODO(liusheng) we shouldn't depend on the default flavor
|
||||||
|
# created by devstack.
|
||||||
flavors = cls.baremetal_compute_client.list_flavors()
|
flavors = cls.baremetal_compute_client.list_flavors()
|
||||||
for f in flavors:
|
if flavors:
|
||||||
if f['name'] == 'small':
|
return flavors[0]['uuid']
|
||||||
return f['uuid']
|
|
||||||
else:
|
else:
|
||||||
# TODO(liusheng) we shouldn't depend on the default
|
raise exception.FlavorNotFound("No flavor found!")
|
||||||
# type created by devstack
|
|
||||||
raise exception.FlavorNotFound("'small' flavor not found.")
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_net_id(cls):
|
def _get_net_id(cls):
|
||||||
@ -75,7 +74,7 @@ class BaseBaremetalComputeTest(tempest.test.BaseTestCase):
|
|||||||
super(BaseBaremetalComputeTest, cls).resource_setup()
|
super(BaseBaremetalComputeTest, cls).resource_setup()
|
||||||
cls.flavor_ids = []
|
cls.flavor_ids = []
|
||||||
cls.server_ids = []
|
cls.server_ids = []
|
||||||
cls.small_flavor = cls._get_small_flavor()
|
cls.flavor = cls._get_flavor()
|
||||||
cls.image_id = CONF.compute.image_ref
|
cls.image_id = CONF.compute.image_ref
|
||||||
cls.net_id = cls._get_net_id()
|
cls.net_id = cls._get_net_id()
|
||||||
cls.ext_net_id = CONF.network.public_network_id
|
cls.ext_net_id = CONF.network.public_network_id
|
||||||
@ -84,7 +83,7 @@ class BaseBaremetalComputeTest(tempest.test.BaseTestCase):
|
|||||||
def create_server(cls, wait_until_active=True):
|
def create_server(cls, wait_until_active=True):
|
||||||
body = {'name': data_utils.rand_name('mogan_server'),
|
body = {'name': data_utils.rand_name('mogan_server'),
|
||||||
'description': "mogan tempest server",
|
'description': "mogan tempest server",
|
||||||
'flavor_uuid': cls.small_flavor,
|
'flavor_uuid': cls.flavor,
|
||||||
'image_uuid': cls.image_id,
|
'image_uuid': cls.image_id,
|
||||||
"networks": [{"net_id": cls.net_id}]
|
"networks": [{"net_id": cls.net_id}]
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ class BaremetalComputeAPIServersTest(base.BaseBaremetalComputeTest):
|
|||||||
resp = self.creation_resp
|
resp = self.creation_resp
|
||||||
self.assertEqual(self.server_ids[0], resp['uuid'])
|
self.assertEqual(self.server_ids[0], resp['uuid'])
|
||||||
self.assertEqual('building', resp['status'])
|
self.assertEqual('building', resp['status'])
|
||||||
self.assertEqual(self.small_flavor, resp['flavor_uuid'])
|
self.assertEqual(self.flavor, resp['flavor_uuid'])
|
||||||
self.assertEqual('mogan tempest server', resp['description'])
|
self.assertEqual('mogan tempest server', resp['description'])
|
||||||
self.assertEqual(self.image_id, resp['image_uuid'])
|
self.assertEqual(self.image_id, resp['image_uuid'])
|
||||||
self.assertIn('launched_at', resp)
|
self.assertIn('launched_at', resp)
|
||||||
@ -53,7 +53,7 @@ class BaremetalComputeAPIServersTest(base.BaseBaremetalComputeTest):
|
|||||||
resp = self.baremetal_compute_client.show_server(
|
resp = self.baremetal_compute_client.show_server(
|
||||||
self.server_ids[0])
|
self.server_ids[0])
|
||||||
self.assertEqual('active', resp['status'])
|
self.assertEqual('active', resp['status'])
|
||||||
self.assertEqual(self.small_flavor, resp['flavor_uuid'])
|
self.assertEqual(self.flavor, resp['flavor_uuid'])
|
||||||
self.assertEqual('mogan tempest server', resp['description'])
|
self.assertEqual('mogan tempest server', resp['description'])
|
||||||
self.assertEqual(self.image_id, resp['image_uuid'])
|
self.assertEqual(self.image_id, resp['image_uuid'])
|
||||||
self.assertEqual('power on', resp['power_state'])
|
self.assertEqual('power on', resp['power_state'])
|
||||||
|
Loading…
Reference in New Issue
Block a user