You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
"use strict";
|
|
|
|
const Promise = require("bluebird");
|
|
const dlayerSource = require("../../../packages/dlayer-source");
|
|
|
|
const types = require("../");
|
|
const All = require("../../../packages/graphql-interface/symbols/all");
|
|
|
|
module.exports = function LVMVolumeGroup ({ name }) {
|
|
return dlayerSource.withSources({
|
|
physicalVolumes: function (_args, { sources }) {
|
|
return Promise.try(() => {
|
|
return sources.lvmPhysicalVolumes.load(All);
|
|
}).filter((volume) => {
|
|
return (volume.volumeGroup === name);
|
|
}).map((volume) => {
|
|
return types.LVMPhysicalVolume({ path: volume.path });
|
|
});
|
|
},
|
|
logicalVolumes: function (_args, { sources }) {
|
|
return Promise.try(() => {
|
|
return sources.lvmLogicalVolumes.load(All);
|
|
}).filter((volume) => {
|
|
return (volume.volumeGroup === name);
|
|
}).map((volume) => {
|
|
return types.LVMLogicalVolume({ path: volume.path });
|
|
});
|
|
},
|
|
$sources: {
|
|
lvmVolumeGroups: {
|
|
[dlayerSource.ID]: name,
|
|
name: "name",
|
|
totalSpace: "totalSpace",
|
|
freeSpace: "freeSpace",
|
|
physicalVolumeCount: "physicalVolumeCount",
|
|
logicalVolumeCount: "logicalVolumeCount",
|
|
snapshotCount: "snapshotCount",
|
|
isReadOnly: "isReadOnly",
|
|
isResizeable: "isResizeable",
|
|
isExported: "isExported",
|
|
isIncomplete: "isIncomplete",
|
|
allocationPolicy: "allocationPolicy",
|
|
mode: "mode"
|
|
// FIXME: physicalVolumes, logicalVolumes
|
|
}
|
|
}
|
|
});
|
|
};
|