cinder-volume-setup revision 2900
a1e4113a5388e34c08459c5b69679c82ac2bddc9Pavel Březina# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
a1e4113a5388e34c08459c5b69679c82ac2bddc9Pavel Březina# Licensed under the Apache License, Version 2.0 (the "License"); you may
a1e4113a5388e34c08459c5b69679c82ac2bddc9Pavel Březina# not use this file except in compliance with the License. You may obtain
a1e4113a5388e34c08459c5b69679c82ac2bddc9Pavel Březina# a copy of the License at
a1e4113a5388e34c08459c5b69679c82ac2bddc9Pavel Březina# Unless required by applicable law or agreed to in writing, software
a1e4113a5388e34c08459c5b69679c82ac2bddc9Pavel Březina# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
a1e4113a5388e34c08459c5b69679c82ac2bddc9Pavel Březina# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
a1e4113a5388e34c08459c5b69679c82ac2bddc9Pavel Březina# License for the specific language governing permissions and limitations
a1e4113a5388e34c08459c5b69679c82ac2bddc9Pavel Březina# under the License.
a1e4113a5388e34c08459c5b69679c82ac2bddc9Pavel Březinafrom subprocess import CalledProcessError, Popen, PIPE, check_call
a1e4113a5388e34c08459c5b69679c82ac2bddc9Pavel Březina """ retrieves the setting for 'zfs_volume_base' from Cinder's conf file in
a1e4113a5388e34c08459c5b69679c82ac2bddc9Pavel Březina order to set it up properly for Cinder to use.
132e477d69e07e02fe6e4d668c0bb6226206474aPavel Březina # retrieve the top-level dataset or just get the default (rpool/cinder)
132e477d69e07e02fe6e4d668c0bb6226206474aPavel Březina top_ds = parser.get("DEFAULT", "zfs_volume_base")
132e477d69e07e02fe6e4d668c0bb6226206474aPavel Březina # look to see if the dataset exists
132e477d69e07e02fe6e4d668c0bb6226206474aPavel Březina # the dataset doesn't exist, so go create it
132e477d69e07e02fe6e4d668c0bb6226206474aPavel Březina check_call(["/usr/sbin/zfs", "create", "-p", top_ds])
132e477d69e07e02fe6e4d668c0bb6226206474aPavel Březina print "unable to create %s: %s" % (top_ds, err)
a1e4113a5388e34c08459c5b69679c82ac2bddc9Pavel Březina # get the mountpoint
try:
try:
return int(smf_include.SMF_EXIT_OK)