network.create instead of createNetwork for host and pool

This commit is contained in:
Pierre
2016-03-04 18:06:26 +01:00
parent d452702aef
commit 2995f48ede

View File

@@ -1,3 +1,4 @@
<<<<<<< 91431201771f54434ebda173c26bda1c3df405d4
export async function create ({ pool, name, description, pif, mtu = 1500, vlan = 0 }) {
return this.getXapi(pool).createNetwork({
name,
@@ -6,6 +7,20 @@ export async function create ({ pool, name, description, pif, mtu = 1500, vlan =
mtu: +mtu,
vlan: +vlan
})
=======
export async function create ({ pool, name, description, pif, mtu, vlan }) {
if (pif) {
pif = this.getObject(pif, 'PIF')
}
const params = {
name,
description,
pif: pif && pif._xapiRef,
mtu: mtu || '1500',
vlan: vlan || '0'
}
return this.getXapi(pool).createNetwork(params)
>>>>>>> `network.create` instead of `createNetwork` for host and pool
}
create.params = {
@@ -13,11 +28,20 @@ create.params = {
name: { type: 'string' },
description: { type: 'string', optional: true },
pif: { type: 'string', optional: true },
<<<<<<< 91431201771f54434ebda173c26bda1c3df405d4
mtu: { type: ['integer', 'string'], optional: true },
vlan: { type: ['integer', 'string'], optional: true }
=======
mtu: { type: 'string', optional: true },
vlan: { type: 'string', optional: true }
>>>>>>> `network.create` instead of `createNetwork` for host and pool
}
create.resolve = {
pool: ['pool', 'pool', 'administrate']
}
create.permission = 'admin'
<<<<<<< 91431201771f54434ebda173c26bda1c3df405d4
=======
exports.create = create
>>>>>>> `network.create` instead of `createNetwork` for host and pool