API: Change the API cpu_info to be meaning ful.
Currently the API sample get '?' for the cpu_info, this is really confusing, it even does not tell the type of the return. Change it to be more meaningful. Change-Id: I791beb7502f47dff646a46c08e818c29f9e6cd79
This commit is contained in:
parent
0a3201dc7e
commit
ab437c0e90
@ -1,6 +1,6 @@
|
||||
{
|
||||
"hypervisor": {
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"host_ip": "1.1.1.1",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"hypervisor": {
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"free_disk_gb": 1028,
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"hypervisors": [
|
||||
{
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": null,
|
||||
"free_disk_gb": 1028,
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"hypervisor": {
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"free_disk_gb": 1028,
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"hypervisors": [
|
||||
{
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"current_workload": 0,
|
||||
"status": "enabled",
|
||||
"state": "up",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"hypervisor": {
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"state": "up",
|
||||
"status": "enabled",
|
||||
"current_workload": 0,
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"hypervisors": [
|
||||
{
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"state": "up",
|
||||
"status": "enabled",
|
||||
"current_workload": 0,
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"hypervisor": {
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"host_ip": "1.1.1.1",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"hypervisor": {
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"host_ip": "%(ip)s",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"hypervisor": {
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"free_disk_gb": 1028,
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"hypervisors": [
|
||||
{
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": null,
|
||||
"host_ip": "%(ip)s",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"hypervisor": {
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"free_disk_gb": 1028,
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"hypervisors": [
|
||||
{
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"current_workload": 0,
|
||||
"state": "up",
|
||||
"status": "enabled",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"hypervisor": {
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"state": "up",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"hypervisors": [
|
||||
{
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"state": "up",
|
||||
"status": "enabled",
|
||||
"current_workload": 0,
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"hypervisor": {
|
||||
"cpu_info": "?",
|
||||
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
|
||||
"current_workload": 0,
|
||||
"state": "up",
|
||||
"status": "enabled",
|
||||
|
@ -12,7 +12,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import collections
|
||||
|
||||
import mock
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from nova import db
|
||||
from nova import objects
|
||||
@ -86,8 +89,19 @@ class ExtendedHyervisorPciSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
|
||||
|
||||
def setUp(self):
|
||||
super(ExtendedHyervisorPciSampleJsonTest, self).setUp()
|
||||
cpu_info = collections.OrderedDict([
|
||||
('arch', 'x86_64'),
|
||||
('model', 'Nehalem'),
|
||||
('vendor', 'Intel'),
|
||||
('features', ['pge', 'clflush']),
|
||||
('topology', {
|
||||
'cores': 1,
|
||||
'threads': 1,
|
||||
'sockets': 4,
|
||||
}),
|
||||
])
|
||||
self.fake_compute_node = objects.ComputeNode(
|
||||
cpu_info="?",
|
||||
cpu_info=jsonutils.dumps(cpu_info),
|
||||
current_workload=0,
|
||||
disk_available_least=0,
|
||||
host_ip="1.1.1.1",
|
||||
|
@ -23,6 +23,7 @@ semantics of real hypervisor connections.
|
||||
|
||||
"""
|
||||
|
||||
import collections
|
||||
import contextlib
|
||||
|
||||
from oslo_config import cfg
|
||||
@ -392,6 +393,18 @@ class FakeDriver(driver.ComputeDriver):
|
||||
Since we don't have a real hypervisor, pretend we have lots of
|
||||
disk and ram.
|
||||
"""
|
||||
|
||||
cpu_info = collections.OrderedDict([
|
||||
('arch', 'x86_64'),
|
||||
('model', 'Nehalem'),
|
||||
('vendor', 'Intel'),
|
||||
('features', ['pge', 'clflush']),
|
||||
('topology', {
|
||||
'cores': 1,
|
||||
'threads': 1,
|
||||
'sockets': 4,
|
||||
}),
|
||||
])
|
||||
if nodename not in _FAKE_NODES:
|
||||
return {}
|
||||
|
||||
@ -399,7 +412,7 @@ class FakeDriver(driver.ComputeDriver):
|
||||
host_status['hypervisor_hostname'] = nodename
|
||||
host_status['host_hostname'] = nodename
|
||||
host_status['host_name_label'] = nodename
|
||||
host_status['cpu_info'] = '?'
|
||||
host_status['cpu_info'] = jsonutils.dumps(cpu_info)
|
||||
return host_status
|
||||
|
||||
def ensure_filtering_rules_for_instance(self, instance, network_info):
|
||||
|
Loading…
x
Reference in New Issue
Block a user