Ensure instances path is accessible by varying users, ie qemu needs this
This commit is contained in:
parent
09159336f4
commit
d01eb472b6
@ -14,6 +14,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
|
||||
from urlparse import urlunparse
|
||||
|
||||
from devstack import component as comp
|
||||
@ -759,13 +761,21 @@ class NovaConfConfigurator(object):
|
||||
|
||||
def _configure_instances_path(self, instances_path, nova_conf):
|
||||
nova_conf.add('instances_path', instances_path)
|
||||
LOG.debug("Attempting to create instance directory: %s" % (instances_path))
|
||||
LOG.debug("Attempting to create instance directory: %r", instances_path)
|
||||
self.tracewriter.dirs_made(*sh.mkdirslist(instances_path))
|
||||
LOG.debug("Adjusting permissions of instance directory: %s" % (instances_path))
|
||||
LOG.debug("Adjusting permissions of instance directory: %r", instances_path)
|
||||
sh.chmod(instances_path, 0777)
|
||||
instance_parent = sh.dirname(instances_path)
|
||||
LOG.debug("Adjusting permissions of instance directory parent: %r", instance_parent)
|
||||
# In cases where you are using kvm + qemu
|
||||
# On certain distros (ie RHEL) this user needs to be able
|
||||
# To enter the parents of the instance path, if this is in /home/BLAH/ then
|
||||
# Without enabling the whole path, this user can't write there. This helps fix that
|
||||
with sh.Rooted(True):
|
||||
# This seems required... (maybe only on RHEL?)
|
||||
sh.rchmod(sh.dirname(instances_path), 0665)
|
||||
for p in sh.explode_path(instance_parent):
|
||||
if not os.access(os.X_OK) and sh.isdir(p):
|
||||
# Need to be able to go into that directory
|
||||
sh.chmod(p, 0755)
|
||||
|
||||
def _configure_libvirt(self, virt_type, nova_conf):
|
||||
if virt_type == 'lxc':
|
||||
|
@ -285,10 +285,8 @@ def _explode_form_path(path):
|
||||
return ret_paths
|
||||
|
||||
|
||||
def rchmod(path, perm):
|
||||
paths = _explode_form_path(path)
|
||||
for p in paths:
|
||||
chmod(p, perm)
|
||||
def explode_path(path):
|
||||
return _explode_form_path(path)
|
||||
|
||||
|
||||
def in_terminal(check_both=False):
|
||||
|
@ -49,7 +49,6 @@ LOG = logging.getLogger("devstack.util")
|
||||
DEF_IP = "127.0.0.1"
|
||||
IP_LOOKER = '8.8.8.8'
|
||||
DEF_IP_VERSION = settings.IPV4
|
||||
PRIVATE_OCTS = []
|
||||
ALL_NUMS = re.compile(r"^\d+$")
|
||||
START_NUMS = re.compile(r"^(\d+)(\D+)")
|
||||
STAR_VERSION = 0
|
||||
@ -250,9 +249,8 @@ def get_host_ip():
|
||||
for (_, net_info) in interfaces.items():
|
||||
ip_info = net_info.get(DEF_IP_VERSION)
|
||||
if ip_info:
|
||||
a_ip = ip_info.get('addr') or ""
|
||||
first_oct = a_ip.split(".")[0]
|
||||
if first_oct and first_oct not in PRIVATE_OCTS:
|
||||
a_ip = ip_info.get('addr')
|
||||
if a_ip:
|
||||
ip = a_ip
|
||||
break
|
||||
# Just return a localhost version then
|
||||
|
Loading…
Reference in New Issue
Block a user