Project: mesos
Issue MESOS-4400: Create persistent volume directories based on DiskInfo.Source.
Currently, we always create persistent volumes from root disk, and the persistent volumes are directories. With DiskInfo.Source being added, we should create the persistent volume accordingly based on the information in DiskInfo.Source. This ticket handles the case where DiskInfo.Source.type is PATH. In that case, we should create sub-directories and use the same layout as slave.work_dir. See the relevant code here: {code} void Slave::checkpointResources(...) { // Creates persistent volumes that do not exist and schedules // releasing those persistent volumes that are no longer needed. // // TODO(jieyu): Consider introducing a volume manager once we start // to support multiple disks, or raw disks. Depending on the // DiskInfo, we may want to create either directories under a root // directory, or LVM volumes from a given device. Resources volumes = newCheckpointedResources.persistentVolumes(); foreach (const Resource& volume, volumes) { // This is validated in master. CHECK_NE(volume.role(), "*"); string path = paths::getPersistentVolumePath( flags.work_dir, volume.role(), volume.disk().persistence().id()); if (!os::exists(path)) { CHECK_SOME(os::mkdir(path, true)) << "Failed to create persistent volume at '" << path << "'"; } } } {code}
Story points: 2