From cf9eef859791d7ce6b809808d756c36ece5550e7 Mon Sep 17 00:00:00 2001
From: Doug Hellmann <doug.hellmann@dreamhost.com>
Date: Mon, 25 Mar 2013 19:34:48 -0400
Subject: [PATCH] Make sure the NOVA_INSTANCES_PATH is created

Under some conditions when NOVA_STATE_PATH is set
the NOVA_INSTANCES_PATH directory under it is removed
but then not correctly recreated if the parent directory
is owned by root instead of the current user running
devstack. This change fixes that problem by creating
the NOVA_INSTANCES_PATH as root, and then chowning it
to the correct user.

Change-Id: I7fb724787b5e915bae9bd058454d2aa38991364e
Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
---
 lib/nova | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/nova b/lib/nova
index 9632a8c5e9..4449f81674 100644
--- a/lib/nova
+++ b/lib/nova
@@ -355,7 +355,8 @@ EOF"
         # ----------------
 
         # Nova stores each instance in its own directory.
-        mkdir -p $NOVA_INSTANCES_PATH
+        sudo mkdir -p $NOVA_INSTANCES_PATH
+        sudo chown -R $STACK_USER $NOVA_INSTANCES_PATH
 
         # You can specify a different disk to be mounted and used for backing the
         # virtual machines.  If there is a partition labeled nova-instances we