diff --git a/nova/auth/manager.py b/nova/auth/manager.py index 438066e3b3e7..ca2a3add5022 100644 --- a/nova/auth/manager.py +++ b/nova/auth/manager.py @@ -63,10 +63,10 @@ auth_opts = [ help='Roles that apply to all projects'), cfg.StrOpt('credentials_template', - default=utils.abspath('auth/novarc.template'), + default='$pybasedir/nova/auth/novarc.template', help='Template for creating users rc file'), cfg.StrOpt('vpn_client_template', - default=utils.abspath('cloudpipe/client.ovpn.template'), + default='$pybasedir/nova/cloudpipe/client.ovpn.template', help='Template for creating users vpn file'), cfg.StrOpt('credential_vpn_file', default='nova-vpn.conf', diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py index dccfc80718b3..497ee6ffcc1e 100644 --- a/nova/cloudpipe/pipelib.py +++ b/nova/cloudpipe/pipelib.py @@ -45,7 +45,7 @@ cloudpipe_opts = [ default='m1.tiny', help=_('Instance type for vpn instances')), cfg.StrOpt('boot_script_template', - default=utils.abspath('cloudpipe/bootscript.template'), + default='$pybasedir/nova/cloudpipe/bootscript.template', help=_('Template for cloudpipe instance boot script')), cfg.StrOpt('dmz_net', default='10.0.0.0', diff --git a/nova/console/xvp.py b/nova/console/xvp.py index 14e9cc0e749c..341af1c5752f 100644 --- a/nova/console/xvp.py +++ b/nova/console/xvp.py @@ -33,7 +33,7 @@ from nova import utils xvp_opts = [ cfg.StrOpt('console_xvp_conf_template', - default=utils.abspath('console/xvp.conf.template'), + default='$pybasedir/nova/console/xvp.conf.template', help='XVP conf template'), cfg.StrOpt('console_xvp_conf', default='/etc/xvp.conf', diff --git a/nova/flags.py b/nova/flags.py index ece5361c6075..38c2258c2db4 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -102,11 +102,18 @@ core_opts = [ cfg.StrOpt('api_paste_config', default="api-paste.ini", help='File name for the paste.deploy config for nova-api'), + cfg.StrOpt('pybasedir', + default=os.path.abspath(os.path.join(os.path.dirname(__file__), + '../')), + help='Directory where the nova python module is installed'), + cfg.StrOpt('bindir', + default='$pybasedir/bin', + help='Directory where nova binaries are installed'), cfg.StrOpt('state_path', - default=os.path.join(os.path.dirname(__file__), '../'), + default='$pybasedir', help="Top-level directory for maintaining nova's state"), cfg.StrOpt('lock_path', - default=os.path.join(os.path.dirname(__file__), '../'), + default='$pybasedir', help='Directory to use for lock files'), ] diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index 58fec83e20de..c0dbe88af52b 100755 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -35,11 +35,6 @@ from nova import utils LOG = logging.getLogger(__name__) -def _bin_file(script): - """Return the absolute path to scipt in the bin directory.""" - return os.path.abspath(os.path.join(__file__, '../../../bin', script)) - - linux_net_opts = [ cfg.StrOpt('dhcpbridge_flagfile', default='/etc/nova/nova-dhcpbridge.conf', @@ -54,7 +49,7 @@ linux_net_opts = [ default=None, help='MTU setting for vlan'), cfg.StrOpt('dhcpbridge', - default=_bin_file('nova-dhcpbridge'), + default='$bindir/nova-dhcpbridge', help='location of nova-dhcpbridge'), cfg.StrOpt('routing_source_ip', default='$my_ip', diff --git a/nova/utils.py b/nova/utils.py index 5b8eda012ccd..c95382a0ec4c 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -319,10 +319,6 @@ def ssh_execute(ssh, cmd, process_input=None, return (stdout, stderr) -def abspath(s): - return os.path.join(os.path.dirname(__file__), s) - - def novadir(): import nova return os.path.abspath(nova.__file__).split('nova/__init__.py')[0] diff --git a/nova/virt/baremetal/proxy.py b/nova/virt/baremetal/proxy.py index 788386edd5e7..50c72dd872ce 100644 --- a/nova/virt/baremetal/proxy.py +++ b/nova/virt/baremetal/proxy.py @@ -60,7 +60,7 @@ FLAGS = flags.FLAGS baremetal_opts = [ cfg.StrOpt('baremetal_injected_network_template', - default=utils.abspath('virt/interfaces.template'), + default='$pybasedir/nova/virt/interfaces.template', help='Template file for injected network'), cfg.StrOpt('baremetal_type', default='baremetal', diff --git a/nova/virt/disk/api.py b/nova/virt/disk/api.py index a9b1067c29d5..f8b51fb3132e 100644 --- a/nova/virt/disk/api.py +++ b/nova/virt/disk/api.py @@ -45,7 +45,7 @@ LOG = logging.getLogger(__name__) disk_opts = [ cfg.StrOpt('injected_network_template', - default=utils.abspath('virt/interfaces.template'), + default='$pybasedir/nova/virt/interfaces.template', help='Template file for injected network'), cfg.ListOpt('img_handlers', default=['loop', 'nbd', 'guestfs'], diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index ae2a2b665ac2..f526f15ca8d2 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -87,7 +87,7 @@ libvirt_opts = [ default=None, help='Rescue ari image'), cfg.StrOpt('libvirt_xml_template', - default=utils.abspath('virt/libvirt.xml.template'), + default='$pybasedir/nova/virt/libvirt.xml.template', help='Libvirt XML Template'), cfg.StrOpt('libvirt_type', default='kvm', @@ -105,7 +105,7 @@ libvirt_opts = [ default=True, help='Sync virtual and real mouse cursors in Windows VMs'), cfg.StrOpt('cpuinfo_xml_template', - default=utils.abspath('virt/cpuinfo.xml.template'), + default='$pybasedir/nova/virt/cpuinfo.xml.template', help='CpuInfo XML Template (Used only live migration now)'), cfg.StrOpt('live_migration_uri', default="qemu+tcp://%s/system",