26 def start(): |
26 def start(): |
27 """ retrieves the setting for 'zfs_volume_base' from Cinder's conf file in |
27 """ retrieves the setting for 'zfs_volume_base' from Cinder's conf file in |
28 order to set it up properly for Cinder to use. |
28 order to set it up properly for Cinder to use. |
29 |
29 |
30 """ |
30 """ |
|
31 cinder_conf = "/etc/cinder/cinder.conf" |
|
32 if not os.path.exists(cinder_conf): |
|
33 print "%s doesn't exist" % cinder_conf |
|
34 return smf_include.SMF_EXIT_ERR_CONFIG |
|
35 |
31 parser = ConfigParser.ConfigParser() |
36 parser = ConfigParser.ConfigParser() |
32 parser.read("/etc/cinder/cinder.conf") |
37 parser.read(cinder_conf) |
33 |
38 |
34 # set up the top-level dataset with the proper permissions for cinder |
39 # retrieve the top-level dataset or just get the default (rpool/cinder) |
35 top_ds = parser.get("DEFAULT", "zfs_volume_base") |
40 try: |
|
41 top_ds = parser.get("DEFAULT", "zfs_volume_base") |
|
42 except ConfigParser.NoOptionError: |
|
43 top_ds = "rpool/cinder" |
36 |
44 |
37 # look to see if the dataset exists |
45 # look to see if the dataset exists |
38 cmd = ["/usr/sbin/zfs", "list", top_ds] |
46 cmd = ["/usr/sbin/zfs", "list", top_ds] |
39 try: |
47 try: |
40 check_call(cmd, stdout=PIPE, stderr=PIPE) |
48 check_call(cmd, stdout=PIPE, stderr=PIPE) |