Merge "vgpu: add enabled white list"

This commit is contained in:
Zuul
2017-11-21 18:05:33 +00:00
committed by Gerrit Code Review
2 changed files with 42 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ from nova.conf import console
from nova.conf import consoleauth
from nova.conf import crypto
from nova.conf import database
from nova.conf import devices
from nova.conf import ephemeral_storage
from nova.conf import flavors
from nova.conf import glance
@@ -84,6 +85,7 @@ console.register_opts(CONF)
consoleauth.register_opts(CONF)
crypto.register_opts(CONF)
database.register_opts(CONF)
devices.register_opts(CONF)
ephemeral_storage.register_opts(CONF)
flavors.register_opts(CONF)
glance.register_opts(CONF)

40
nova/conf/devices.py Normal file
View File

@@ -0,0 +1,40 @@
# 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 oslo_config import cfg
devices_group = cfg.OptGroup(
name='devices',
title='physical or virtual device options')
vgpu_opts = [
cfg.ListOpt('enabled_vgpu_types',
default=[],
help="""
A list of the vGPU types enabled in the compute node.
Some pGPUs (e.g. NVIDIA GRID K1) support different vGPU types. User can use
this option to specify a list of enabled vGPU types that may be assigned to a
guest instance. An example is as the following:
[devices]
enabled_vgpu_types = ['GRID K100', 'Intel GVT-g', 'MxGPU.2', 'nvidia-11']
""")
]
def register_opts(conf):
conf.register_group(devices_group)
conf.register_opts(vgpu_opts, group=devices_group)
def list_opts():
return {devices_group: vgpu_opts}