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.
cvm/src/packages/exec-lvm/modifiers/handle-device-in-use.js

22 lines
741 B
JavaScript

"use strict";
const { errorResult } = require("../../text-parser");
const createRegexParser = require("../../text-parser-regex");
const errors = require("../errors");
module.exports = function (devicePath) {
return function handleDeviceInUse(command) {
return command.expectOnStderr(createRegexParser(/Can't initialize physical volume "([^"]+)" of volume group "([^"]+)" without -ff/, (match) => {
let [ _device, existingVolumeGroup ] = match.subMatches;
return errorResult(new errors.DeviceInUse(`Specified device '${devicePath}' is already in use as a Physical Volume in another Volume Group (${existingVolumeGroup})`, {
volume: {
device: devicePath,
volumeGroup: existingVolumeGroup
}
}));
}));
};
};