components/openstack/neutron/files/neutron-server
changeset 5840 ed8b04bef26e
parent 4049 150852e281c4
child 6031 1aaf20a19738
equal deleted inserted replaced
5839:8f8f9a2b0d84 5840:ed8b04bef26e
     1 #!/usr/bin/python2.7
     1 #!/usr/bin/python2.7
     2 
     2 
     3 # Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
     3 # Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
     4 #
     4 #
     5 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
     5 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
     6 #    not use this file except in compliance with the License. You may obtain
     6 #    not use this file except in compliance with the License. You may obtain
     7 #    a copy of the License at
     7 #    a copy of the License at
     8 #
     8 #
    16 
    16 
    17 import os
    17 import os
    18 import sys
    18 import sys
    19 
    19 
    20 import smf_include
    20 import smf_include
       
    21 from subprocess import CalledProcessError, check_call
    21 
    22 
    22 
    23 
    23 def start():
    24 def start():
       
    25     # sync the database to have the Kilo schema
       
    26     cmd = ["/usr/bin/neutron-db-manage", "--config-file",
       
    27            "/etc/neutron/neutron.conf", "--config-file",
       
    28            "/etc/neutron/plugins/evs/evs_plugin.ini", "upgrade", "head"]
       
    29     try:
       
    30         check_call(cmd)
       
    31     except CalledProcessError as err:
       
    32         print "Unable to create database for Neutron: %s" % err
       
    33         sys.exit(smf_include.SMF_EXIT_ERR_CONFIG)
       
    34 
    24     # verify paths are valid
    35     # verify paths are valid
    25     for f in sys.argv[2:4]:
    36     for f in sys.argv[2:4]:
    26         if not os.path.exists(f) or not os.access(f, os.R_OK):
    37         if not os.path.exists(f) or not os.access(f, os.R_OK):
    27             print '%s does not exist or is not readable' % f
    38             print '%s does not exist or is not readable' % f
    28             return smf_include.SMF_EXIT_ERR_CONFIG
    39             return smf_include.SMF_EXIT_ERR_CONFIG