diff options
| -rw-r--r-- | nova/virt/libvirt/utils.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nova/virt/libvirt/utils.py b/nova/virt/libvirt/utils.py index c954d70ad..5adfe4cae 100644 --- a/nova/virt/libvirt/utils.py +++ b/nova/virt/libvirt/utils.py @@ -19,6 +19,7 @@ # License for the specific language governing permissions and limitations # under the License. +import errno import hashlib import os import random @@ -255,7 +256,14 @@ def ensure_tree(path): :param path: Directory to create """ - execute('mkdir', '-p', path) + try: + os.makedirs(path) + except OSError as exc: + if exc.errno == errno.EEXIST: + if not os.path.isdir(path): + raise + else: + raise def write_to_file(path, contents, umask=None): |
