Skip to content

Commit

Permalink
Merge "Fabric provisioning changes for Qos"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Oct 8, 2016
2 parents 22aa9a0 + 5454b24 commit cd99150
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 1 deletion.
19 changes: 19 additions & 0 deletions fabfile/testbeds/testbed_multibox_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
# 'toragent': [host1], Optional, Only to enable Tor Agent. Only compute can
# support Tor Agent
# 'backup':[backup_node], # only if the backup_node is defined
# 'qos': [host4, host5], # optional, to enable Qos.
}

#Hostnames
Expand Down Expand Up @@ -484,6 +485,24 @@
# host5: {'vgw2':{'vn':'default-domain:admin:public1:public1', 'ipam-subnets': ['10.204.220.144/29']}}
# }

#Definition for the Key used
#--------------------------------------
# For Qos hardware queues (nic queues) are mapped to logical queues in agent .
# hardware_q_id: Identifier for the hardwarwe queue.
# logical_queue: Defines the logical queues each hardware queue is mapped to.
# scheduling: Defines the scheduling algorathim used in logical queues.
# bandwidth: Total hardware queue bandwidth used by logical queues.
# default: When set to True defines the default hardware queue for Qos, one of the queue must be defined default.
# scheduling and bandwidth properties for each hardware queue is not implemented for now in agent.

#env.qos = {host4: [ {'hardware_q_id': '3', 'logical_queue':['1', '6-10', '12-15'], 'scheduling': 'strict', 'bandwidth': '70'},
# {'hardware_q_id': '5', 'logical_queue':['2'], 'scheduling': 'rr', 'bandwidth': '75'},
# {'hardware_q_id': '8', 'logical_queue':['3-5'], 'scheduling': 'rr', 'bandwidth': '75'},
# {'hardware_q_id': '1', 'logical_queue':['7'], 'scheduling': 'strict', 'bandwidth': '60', 'default': 'True'}],
# host5: [ {'hardware_q_id': '2', 'logical_queue':['1', '3-8', '10-15'], 'scheduling': 'rr', 'bandwidth': '75'},
# {'hardware_q_id': '6', 'logical_queue':['7'], 'scheduling': 'strict', 'bandwidth': '80', 'default': 'True'}]
# }

#OPTIONAL optional tor agent and tsn CONFIGURATION
#==================================================
#Section tor agent is only relevant when you want to use Tor Agent feature.
Expand Down
17 changes: 17 additions & 0 deletions fabfile/testbeds/testbed_singlebox_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
# 'toragent': [host1], Optional, Only to enable Tor Agent. Only compute can
# support Tor Agent
# 'backup':[backup_node], # only if the backup_node is defined
# 'qos': [host1], # optional, to enable Qos.
}

#Openstack admin password
Expand Down Expand Up @@ -353,6 +354,22 @@
# 'vgw2':{'vn':'default-domain:admin:public1:public1', 'ipam-subnets': ['10.204.220.144/29']}
# }

#Definition for the Key used
#--------------------------------------
# For Qos hardware queues (nic queues) are mapped to logical queues in agent .
# hardware_q_id: Identifier for the hardwarwe queue.
# logical_queue: Defines the logical queues each hardware queue is mapped to.
# scheduling: Defines the scheduling algorathim used in logical queues.
# bandwidth: Total hardware queue bandwidth used by logical queues.
# default: When set to True defines the default hardware queue for Qos, one of the queue must be defined default.
# scheduling and bandwidth properties for each hardware queue is not implemented for now in agent.

#env.qos = {host1: [ {'hardware_q_id': '3', 'logical_queue':['1', '6-10', '12-15'], 'scheduling': 'strict', 'bandwidth': '70'},
# {'hardware_q_id': '5', 'logical_queue':['2'], 'scheduling': 'rr', 'bandwidth': '75'},
# {'hardware_q_id': '8', 'logical_queue':['3-5'], 'scheduling': 'rr', 'bandwidth': '75'},
# {'hardware_q_id': '1', 'logical_queue':['7'], 'scheduling': 'strict', 'bandwidth': '60', 'default': 'True'}]
# }

#OPTIONAL optional tor agent and tsn CONFIGURATION
#==================================================
#Section tor agent is only relevant when you want to use Tor Agent feature.
Expand Down
35 changes: 34 additions & 1 deletion fabfile/utils/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from fabos import detect_ostype, get_release, get_build
from fabfile.config import *
from fabfile.utils.config import get_value

from collections import OrderedDict

def get_all_hostnames():
if isinstance(env.hostnames.get('all', None), list):
Expand Down Expand Up @@ -109,6 +109,39 @@ def get_vgw_details(compute_host_string):
vgw_details = (set_vgw, gateway_routes, public_subnet, public_vn_name, vgw_intf_list)
return vgw_details

def get_qos_details(compute_host_string):
set_qos = False
qos_logical_queue = []
queue_scheduling = []
queue_bandwidth = []
queue_id = []
qos_details = (set_qos, qos_logical_queue, queue_id, queue_scheduling, queue_bandwidth)
if ('qos' not in env.roledefs or
compute_host_string not in env.roledefs['qos']):
return qos_details

set_qos = True
qos_info_compute = env.qos[compute_host_string]
for nic_queue in qos_info_compute:
if 'default' not in nic_queue.keys():
qos_logical_queue.append(str(nic_queue['logical_queue']).strip('[]').replace(" ",""))
queue_id.append(nic_queue['hardware_q_id'])
if 'scheduling' in nic_queue.keys():
queue_scheduling.append(nic_queue['scheduling'])
if 'bandwidth' in nic_queue.keys():
queue_bandwidth.append(nic_queue['bandwidth'])
else:
default_nic_queue = nic_queue
qos_logical_queue.append(str(default_nic_queue['logical_queue']).strip('[]').replace(" ",""))
queue_id.append(default_nic_queue['hardware_q_id'])
if 'scheduling' in default_nic_queue.keys():
queue_scheduling.append(default_nic_queue['scheduling'])
if 'bandwidth' in default_nic_queue.keys():
queue_bandwidth.append(default_nic_queue['bandwidth'])

qos_details = (set_qos, qos_logical_queue, queue_id, queue_scheduling, queue_bandwidth)
return qos_details

def get_compute_as_gateway_list():
gateway_server_ip_list = []
gateway_mode_info = getattr(env, 'compute_as_gateway_mode', None)
Expand Down
10 changes: 10 additions & 0 deletions fabfile/utils/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,16 @@ def frame_vnc_compute_cmd(host_string, cmd='setup-vnc-compute',
if gateway_routes:
cmd += " --vgw_gateway_routes %s" % str([(';'.join(str(e) for e in gateway_routes)).replace(" ","")])

# Qos Arguments
(set_qos, qos_logical_queue, qos_queue_id, qos_queue_scheduling, qos_queue_bandwidth) = get_qos_details(host_string)
if set_qos:
cmd += " --qos_logical_queue %s" % ' '.join(qos_logical_queue)
cmd += " --qos_queue_id %s" % ' '.join(qos_queue_id)
if qos_queue_scheduling:
cmd += " --qos_queue_scheduling %s" % ' '.join(qos_queue_scheduling)
if qos_queue_bandwidth:
cmd += " --qos_queue_bandwidth %s" % ' '.join(qos_queue_bandwidth)

compute_as_gateway_list = get_compute_as_gateway_list()
if compute_as_gateway_list:
cmd += " --gateway_server_list %s" % ' '.join(compute_as_gateway_list)
Expand Down

0 comments on commit cd99150

Please sign in to comment.