chore(xo-server): move LVM start hook to file restore NG

Otherwise, I have a feeling that we may forget to migrate this code when
legacy backup code will be retired.
This commit is contained in:
Julien Fontanet 2018-10-19 11:10:27 +02:00
parent b3681e7c39
commit 0cd84ee250
2 changed files with 7 additions and 8 deletions

View File

@ -300,14 +300,6 @@ const mountLvmPv = (device, partition) => {
export default class {
constructor (xo) {
this._xo = xo
// clean any LVM volumes that might have not been properly
// unmounted
xo.on('start', () =>
Promise.all([execa('losetup', ['-D']), execa('vgchange', ['-an'])]).then(
() => execa('pvscan', ['--cache'])
)
)
}
async listRemoteBackups (remoteId) {

View File

@ -163,6 +163,13 @@ export default class BackupNgFileRestore {
constructor (app) {
this._app = app
this._mounts = { __proto__: null }
// clean any LVM volumes that might have not been properly
// unmounted
app.on('start', async () => {
await Promise.all([execa('losetup', ['-D']), execa('vgchange', ['-an'])])
await execa('pvscan', ['--cache'])
})
}
@defer