Files
xen-orchestra/src/api/vif.js
2015-11-17 10:33:56 +01:00

44 lines
1.0 KiB
JavaScript

// TODO: move into vm and rename to removeInterface
async function delete_ ({vif}) {
await this.getXAPI(vif).deleteVif(vif._xapiId)
}
export {delete_ as delete}
delete_.params = {
id: { type: 'string' }
}
delete_.resolve = {
vif: ['id', 'VIF', 'administrate']
}
// -------------------------------------------------------------------
// TODO: move into vm and rename to disconnectInterface
export async function disconnect ({vif}) {
// TODO: check if VIF is attached before
await this.getXAPI(vif).call('VIF.unplug_force', vif._xapiRef)
}
disconnect.params = {
id: { type: 'string' }
}
disconnect.resolve = {
vif: ['id', 'VIF', 'operate']
}
// -------------------------------------------------------------------
// TODO: move into vm and rename to connectInterface
export async function connect ({vif}) {
// TODO: check if VIF is attached before
await this.getXAPI(vif).call('VIF.plug', vif._xapiRef)
}
connect.params = {
id: { type: 'string' }
}
connect.resolve = {
vif: ['id', 'VIF', 'operate']
}