feat(sr): add disconnect and connect all PBDs to a SR (#324)
This commit is contained in:
parent
4d0673f489
commit
9ce8a24eea
@ -76,6 +76,34 @@ forget.resolve = {
|
|||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
|
export async function connectAllPbds ({SR}) {
|
||||||
|
await this.getXapi(SR).connectAllSrPbds(SR._xapiId)
|
||||||
|
}
|
||||||
|
|
||||||
|
connectAllPbds.params = {
|
||||||
|
id: { type: 'string' }
|
||||||
|
}
|
||||||
|
|
||||||
|
connectAllPbds.resolve = {
|
||||||
|
SR: ['id', 'SR', 'administrate']
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
|
export async function disconnectAllPbds ({SR}) {
|
||||||
|
await this.getXapi(SR).disconnectAllSrPbds(SR._xapiId)
|
||||||
|
}
|
||||||
|
|
||||||
|
disconnectAllPbds.params = {
|
||||||
|
id: { type: 'string' }
|
||||||
|
}
|
||||||
|
|
||||||
|
disconnectAllPbds.resolve = {
|
||||||
|
SR: ['id', 'SR', 'administrate']
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
export async function createIso ({
|
export async function createIso ({
|
||||||
host,
|
host,
|
||||||
nameLabel,
|
nameLabel,
|
||||||
|
@ -3,6 +3,16 @@ import {
|
|||||||
} from '../utils'
|
} from '../utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
_connectAllSrPbds (sr) {
|
||||||
|
return Promise.all(
|
||||||
|
mapToArray(sr.$PBDs, pbd => this._plugPbd(pbd))
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
|
async connectAllSrPbds (id) {
|
||||||
|
await this._connectAllSrPbds(this.getObject(id))
|
||||||
|
},
|
||||||
|
|
||||||
_disconnectAllSrPbds (sr) {
|
_disconnectAllSrPbds (sr) {
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
mapToArray(sr.$PBDs, pbd => this._unplugPbd(pbd))
|
mapToArray(sr.$PBDs, pbd => this._unplugPbd(pbd))
|
||||||
@ -25,6 +35,14 @@ export default {
|
|||||||
await this.call('SR.forget', sr.$ref)
|
await this.call('SR.forget', sr.$ref)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_plugPbd (pbd) {
|
||||||
|
return this.call('PBD.plug', pbd.$ref)
|
||||||
|
},
|
||||||
|
|
||||||
|
async plugPbd (id) {
|
||||||
|
await this._plugPbd(this.getObject(id))
|
||||||
|
},
|
||||||
|
|
||||||
_unplugPbd (pbd) {
|
_unplugPbd (pbd) {
|
||||||
return this.call('PBD.unplug', pbd.$ref)
|
return this.call('PBD.unplug', pbd.$ref)
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user