| 1165 | // Helper for creating a disk source with type `PATH`. |
| 1166 | template <typename TResource> |
| 1167 | inline typename TResource::DiskInfo::Source createDiskSourcePath( |
| 1168 | const Option<std::string>& root = None(), |
| 1169 | const Option<std::string>& id = None(), |
| 1170 | const Option<std::string>& profile = None()) |
| 1171 | { |
| 1172 | typename TResource::DiskInfo::Source source; |
| 1173 | |
| 1174 | source.set_type(TResource::DiskInfo::Source::PATH); |
| 1175 | |
| 1176 | if (root.isSome()) { |
| 1177 | source.mutable_path()->set_root(root.get()); |
| 1178 | } |
| 1179 | |
| 1180 | if (id.isSome()) { |
| 1181 | source.set_id(id.get()); |
| 1182 | } |
| 1183 | |
| 1184 | if (profile.isSome()) { |
| 1185 | source.set_profile(profile.get()); |
| 1186 | } |
| 1187 | |
| 1188 | return source; |
| 1189 | } |
| 1190 | |
| 1191 | |
| 1192 | // Helper for creating a disk source with type `MOUNT`. |