Openstack Nova secondary development-Nova-extended service
This article mainly describes how to start openstack Nova-extend services. This service is used for secondary extension and development of some requirements of openstack, such as node inspection and dynamic migration (based on Fuse file system implementation, distributed system, such as moosefs), file injection, Nova Service's own repair, instances Io control, instances CPU isolation technology implementation, and other demand development
Chapter 1: How to Create openstack Nova-extend service
A) create a python-extend File
CP-fr/usr/bin/Python-extend
This interface is used to start the openstack Nova-extend service. The Python service starts the NOVA-extend service. The socket module cannot work properly. The specific reason is that it cannot use socket, threading, and other module attributes.
B) Create the Startup Program Python-extend file and keep it in/usr/bin/
#!/usr/bin/python-extend# PBR Generated from ‘console_scripts‘import sysfrom nova.cmd.extend import mainif __name__ == "__main__": sys.exit(main())
C) Create the from Nova. cmd. Extend import main program and call Nova. Services. py.
# vim: tabstop=4 shiftwidth=4 softtabstop=4# Copyright 2012 IBM Corp.## 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."""Starter script for Nova Extend."""import sysfrom oslo.config import cfgfrom nova import configfrom nova import objectsfrom nova.openstack.common import log as loggingfrom nova import servicefrom nova import utilsCONF = cfg.CONFCONF.import_opt(‘topic‘, ‘nova.extend.api‘, group=‘extend‘)def main(): objects.register_all() config.parse_args(sys.argv) logging.setup("nova") utils.monkey_patch() server = service.Service.create(binary=‘nova-extend‘, topic=CONF.extend.topic, manager=CONF.extend.manager) service.serve(server, workers=CONF.extend.workers) service.wait()
D)/etc/NOVA. conf configuration
extend_manager=nova.extend.manager.ExtendManager
E) Create an openstack-Nova-extend to start the service.
#!/bin/sh## openstack-nova-extend OpenStack Nova Compute DB Access service## chkconfig: - 98 02# description: Implementation of an S3-like storage server based on local files.### BEGIN INIT INFO# Provides:# Required-Start: $remote_fs $network $syslog# Required-Stop: $remote_fs $syslog# Default-Stop: 0 1 6# Short-Description: OpenStack Nova Compute DB Access service# Description: Service to handle database access for compute nodes### END INIT INFO. /etc/rc.d/init.d/functionssuffix=extendprog=openstack-nova-$suffixexec="/usr/bin/nova-$suffix"config="/etc/nova/nova.conf"pidfile="/var/run/nova/nova-$suffix.pid"logfile="/var/log/nova/$suffix.log"[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$proglockfile=/var/lock/subsys/$progstart() { [ -x $exec ] || exit 5 [ -f $config ] || exit 6 echo -n $"Starting $prog: " daemon --user nova --pidfile $pidfile "$exec --logfile $logfile &>/dev/null & echo \$! > $pidfile" retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval}stop() { echo -n $"Stopping $prog: " killproc -p $pidfile $prog retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval}restart() { stop start}reload() { restart}force_reload() { restart}rh_status() { status -p $pidfile $prog}rh_status_q() { rh_status >/dev/null 2>&1}case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 restart ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" exit 2esacexit $?
F) Start the openstack-Nova-extend service.
[[email protected] cmd]# service openstack-nova-extend restart[[email protected] cmd]# tar -xzf /var/log/nova/extend.log2014-08-04 23:18:58.325 47419 INFO nova.openstack.common.service [-] Caught SIGTERM, exiting2014-08-04 23:19:00.151 45666 INFO nova.openstack.common.periodic_task [-] Skipping periodic task _periodic_update_dns because its interval is negative2014-08-04 23:19:00.183 45666 AUDIT nova.service [-] Starting extend node (version 2013.2.1-1.el6)2014-08-04 23:19:00.513 45666 INFO nova.openstack.common.rpc.common [req-d6b00731-baaa-47fa-bfa2-75f9ec4ef568 None None] Connected to AMQP server on 192.168.8.180:5672
G) openstack-Nova-extend Message Queue Information
[[email protected] cmd]# rabbitmqctl list_queues|grep extendextend 0extend.athCloud.8.180.abs.com.cn 0extend_fanout_6dbb351ab48445cfaadc9de37e87d68f 0extend_fanout_e870b14296354eddba09389319a9c590 0
H) view the status of the Nova-extend service in the Nova-Manager Service list
[[email protected] cmd]# nova-manage service listBinary Host Zone Status State Updated_Atnova-conductor athController.8.180.abs.com.cn internal enabled :-) 2014-08-04 15:22:20nova-consoleauth athController.8.180.abs.com.cn internal enabled :-) 2014-08-04 15:22:19nova-cert athController.8.180.abs.com.cn internal enabled :-) 2014-08-04 15:22:20nova-scheduler athController.8.180.abs.com.cn internal enabled :-) 2014-08-04 15:22:18nova-network athController.8.180.abs.com.cn internal enabled :-) 2014-08-04 15:22:11nova-compute athController.8.180.abs.com.cn nova enabled :-) 2014-08-04 15:22:10nova-console athController.8.180.abs.com.cn internal enabled :-) 2014-08-04 15:22:17nova-extend athController.8.180.abs.com.cn internal enabled :-) 2014-08-04 15:22:10
I) Summary
Openstack development is not very difficult, as long as you understand the START process of Nova-compute and Nova-API, you can refer to the documentation to achieve
By now, the openstack Nova extend service has been started. The next chapter will write openstack Nova-extend Nova next Monday. extend. thanks for implementing the manager function. If you have any questions, please leave a message. I will help you answer them one by one at noon. Thank you for your comments.
I hope you can learn from me if you are not writing well.
This article is from the "welcome comments, welcome likes" blog. For more information, contact the author!