7190917 distro-const building was interrupted by another dc building operation S11U1Build23
authorDrew Fisher <drew.fisher@oracle.com>
Tue, 14 Aug 2012 15:09:28 -0600
changeset 1764 5edb43a1e745
parent 1763 ca9c641c8ec7
child 1765 e9fe614297c7
7190917 distro-const building was interrupted by another dc building operation
usr/src/cmd/distro_const/__init__.py
--- a/usr/src/cmd/distro_const/__init__.py	Wed Aug 08 15:25:24 2012 -0700
+++ b/usr/src/cmd/distro_const/__init__.py	Tue Aug 14 15:09:28 2012 -0600
@@ -319,6 +319,12 @@
     logs = Filesystem(os.path.join(zpool.name, fs.name, "logs"))
     media = Filesystem(os.path.join(zpool.name, fs.name, "media"))
 
+    # check for a lock file
+    if fs.exists:
+        if os.path.exists(os.path.join(fs.get("mountpoint"), DC_LOCKFILE)):
+            raise RuntimeError("distro_const: An instance of distro_const "
+                "is already running in %s" % fs.get("mountpoint"))
+
     if fs.action == "create":
         # recursively destroy the Filesystem dataset before creating it
         fs.destroy(dry_run=False, recursive=True)
@@ -341,12 +347,6 @@
     # Now that the base dataset is created, store the mountpoint ZFS calculated
     base_dataset_mp = fs.get("mountpoint")
 
-    # check for the existence of a lock file, bail out if one exists.
-    if os.path.exists(base_dataset_mp):
-        if os.path.exists(os.path.join(base_dataset_mp, DC_LOCKFILE)):
-            raise RuntimeError("distro_const: An instance of distro_const "
-                               "is already running in %s" % base_dataset_mp)
-
     DC_LOGGER.info("Build datasets successfully setup")
     return (base_dataset_mp, build_data.get("mountpoint"),
             logs.get("mountpoint"), media.get("mountpoint"))