Example #1
0
        private void SetupDiskData()
        {
            int dataDiskId = int.Parse(this.platform.GetDataDiskDeviceName, CultureInfo.InvariantCulture);

            string dataDir = Path.Combine(BaseDir, "data");

            if (!Directory.Exists(dataDir))
            {
                Directory.CreateDirectory(dataDir);
            }

            if (!DiskUtil.DiskHasPartition(dataDiskId))
            {
                Logger.Info("Creating partition on drive " + dataDiskId);
                if (DiskUtil.CreatePrimaryPartition(dataDiskId, "data") != 0)
                {
                    Logger.Error("Could not create partition on drive " + dataDiskId);
                }
            }

            if (!DiskUtil.IsMountPoint(dataDir))
            {
                if (DiskUtil.MountPartition(dataDiskId, dataDir) != 0)
                {
                    Logger.Error("Could not mount disk " + dataDiskId + " to " + dataDir);
                }
            }
            SetupDataSys();
        }
Example #2
0
        public static void MountPersistentDisk(int diskId)
        {
            if (!Directory.Exists(StorePath))
            {
                Directory.CreateDirectory(StorePath);
            }
            if (!DiskUtil.DiskHasPartition(diskId))
            {
                if (DiskUtil.CreatePrimaryPartition(diskId, "store") != 0)
                {
                    Logger.Error("Could not create partition on drive " + diskId);
                }
            }

            if (DiskUtil.MountPartition(diskId, StorePath) != 0)
            {
                Logger.Error("Could not mount disk " + diskId + " to " + StorePath);
                throw new Errors.FatalBoshException("Failed to mount: " + diskId + " to " + StorePath);
            }
        }