From 0dd34df455637ee29176525974d6dab93f530e66 Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Fri, 28 Dec 2012 13:15:31 +0900 Subject: [PATCH] lib/quantum: refactor quantum plugins and third party As quantum plugin support is coming like floodlight, nvp and nec, it's worth while to refactor quantum plugin logic so that each plugin can be modified/enhanced intervening with other quantum plugin. And new plugin support can be added easily (hopefully) without modifying core logic. Change-Id: Ic5ab5b993272fdd3b4e779823323777a845ee681 --- AUTHORS | 1 + lib/nova | 2 +- lib/quantum | 328 +++--------------- lib/quantum_plugins/README.md | 34 ++ lib/quantum_plugins/bigswitch_floodlight | 55 +++ lib/quantum_plugins/linuxbridge | 79 +++++ lib/quantum_plugins/openvswitch | 144 ++++++++ lib/quantum_plugins/ovs_base | 49 +++ lib/quantum_plugins/ryu | 63 ++++ lib/quantum_thirdparty/README.md | 36 ++ .../bigswitch_floodlight | 0 lib/{ => quantum_thirdparty}/ryu | 30 +- 12 files changed, 517 insertions(+), 304 deletions(-) create mode 100644 lib/quantum_plugins/README.md create mode 100644 lib/quantum_plugins/bigswitch_floodlight create mode 100644 lib/quantum_plugins/linuxbridge create mode 100644 lib/quantum_plugins/openvswitch create mode 100644 lib/quantum_plugins/ovs_base create mode 100644 lib/quantum_plugins/ryu create mode 100644 lib/quantum_thirdparty/README.md rename lib/{ => quantum_thirdparty}/bigswitch_floodlight (100%) rename lib/{ => quantum_thirdparty}/ryu (69%) diff --git a/AUTHORS b/AUTHORS index 7ec1f663c2..35c0a522ce 100644 --- a/AUTHORS +++ b/AUTHORS @@ -19,6 +19,7 @@ Gabriel Hurley Gary Kotton Hengqing Hu Hua ZHANG +Isaku Yamahata Jake Dahn James E. Blair Jason Cannavale diff --git a/lib/nova b/lib/nova index f0456d61c1..7165ae228f 100644 --- a/lib/nova +++ b/lib/nova @@ -229,7 +229,7 @@ function configure_nova() { configure_baremetal_nova_dirs fi - if is_service_enabled quantum && is_quantum_ovs_base_plugin "$Q_PLUGIN" && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF ; then + if is_service_enabled quantum && is_quantum_ovs_base_plugin && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF ; then # Add /dev/net/tun to cgroup_device_acls, needed for type=ethernet interfaces cat <`` + * The corresponding file name should be same to service name, ````. + +functions +--------- +``lib/quantum`` calls the following functions when the ```` is enabled + +functions to be implemented +* ``configure_``: + set config files, create data dirs, etc + e.g. + sudo python setup.py deploy + iniset $XXXX_CONF... + +* ``init_``: + initialize databases, etc + +* ``install_``: + collect source and prepare + e.g. + git clone xxx + +* ``start_``: + start running processes, including screen + e.g. + screen_it XXXX "cd $XXXXY_DIR && $XXXX_DIR/bin/XXXX-bin" + +* ``stop_``: + stop running processes (non-screen) diff --git a/lib/bigswitch_floodlight b/lib/quantum_thirdparty/bigswitch_floodlight similarity index 100% rename from lib/bigswitch_floodlight rename to lib/quantum_thirdparty/bigswitch_floodlight diff --git a/lib/ryu b/lib/quantum_thirdparty/ryu similarity index 69% rename from lib/ryu rename to lib/quantum_thirdparty/ryu index 1292313ed8..f11951a3fa 100644 --- a/lib/ryu +++ b/lib/quantum_thirdparty/ryu @@ -17,6 +17,21 @@ RYU_OFP_HOST=${RYU_OFP_HOST:-127.0.0.1} RYU_OFP_PORT=${RYU_OFP_PORT:-6633} # Ryu Applications RYU_APPS=${RYU_APPS:-ryu.app.simple_isolation,ryu.app.rest} +# Ryu configuration +RYU_CONF_CONTENTS=${RYU_CONF_CONTENTS:-" +--app_lists=$RYU_APPS +--wsapi_host=$RYU_API_HOST +--wsapi_port=$RYU_API_PORT +--ofp_listen_host=$RYU_OFP_HOST +--ofp_tcp_listen_port=$RYU_OFP_PORT +--quantum_url=http://$Q_HOST:$Q_PORT +--quantum_admin_username=$Q_ADMIN_USERNAME +--quantum_admin_password=$SERVICE_PASSWORD +--quantum_admin_tenant_name=$SERVICE_TENANT_NAME +--quantum_admin_auth_url=$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0 +--quantum_auth_strategy=$Q_AUTH_STRATEGY +--quantum_controller_addr=tcp:$RYU_OFP_HOST:$RYU_OFP_PORT +"} function configure_ryu() { setup_develop $RYU_DIR @@ -31,26 +46,13 @@ function init_ryu() { RYU_CONF=$RYU_CONF_DIR/ryu.conf sudo rm -rf $RYU_CONF - cat < $RYU_CONF ---app_lists=$RYU_APPS ---wsapi_host=$RYU_API_HOST ---wsapi_port=$RYU_API_PORT ---ofp_listen_host=$RYU_OFP_HOST ---ofp_tcp_listen_port=$RYU_OFP_PORT -EOF + echo "${RYU_CONF_CONTENTS}" > $RYU_CONF } function install_ryu() { git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH } -function is_ryu_required() { - if is_service_enabled ryu || (is_service_enabled quantum && [[ "$Q_PLUGIN" = "ryu" ]]); then - return 0 - fi - return 1 -} - function start_ryu() { screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --flagfile $RYU_CONF" }