parent
56cf6fba2f
commit
a43dfc62c2
@ -211,7 +211,7 @@ create.params = {
|
|||||||
resourceSet: {
|
resourceSet: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: true
|
optional: true
|
||||||
},
|
}
|
||||||
|
|
||||||
installation: {
|
installation: {
|
||||||
type: 'object'
|
type: 'object'
|
||||||
@ -222,6 +222,16 @@ create.params = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vgpuType: {
|
||||||
|
type: 'string',
|
||||||
|
optional: true
|
||||||
|
}
|
||||||
|
|
||||||
|
gpuGroup: {
|
||||||
|
type: 'string',
|
||||||
|
optional: true
|
||||||
|
}
|
||||||
|
|
||||||
# Name/description of the new VM.
|
# Name/description of the new VM.
|
||||||
name_label: { type: 'string' }
|
name_label: { type: 'string' }
|
||||||
name_description: { type: 'string', optional: true }
|
name_description: { type: 'string', optional: true }
|
||||||
@ -310,6 +320,8 @@ create.params = {
|
|||||||
|
|
||||||
create.resolve = {
|
create.resolve = {
|
||||||
template: ['template', 'VM-template', ''],
|
template: ['template', 'VM-template', ''],
|
||||||
|
vgpuType: ['vgpuType', 'vgpuType', ''],
|
||||||
|
gpuGroup: ['gpuGroup', 'gpuGroup', ''],
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.create = create
|
exports.create = create
|
||||||
@ -1352,6 +1364,43 @@ createCloudInitConfigDrive.resolve = {
|
|||||||
}
|
}
|
||||||
exports.createCloudInitConfigDrive = createCloudInitConfigDrive
|
exports.createCloudInitConfigDrive = createCloudInitConfigDrive
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
|
||||||
|
createVgpu = $coroutine ({ vm, gpuGroup, vgpuType }) ->
|
||||||
|
# TODO: properly handle device. Can a VM have 2 vGPUS?
|
||||||
|
yield @getXapi(vm).createVgpu(vm._xapiId, gpuGroup._xapiId, vgpuType._xapiId)
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
|
createVgpu.params = {
|
||||||
|
vm: { type: 'string' },
|
||||||
|
gpuGroup: { type: 'string' },
|
||||||
|
vgpuType: { type: 'string' }
|
||||||
|
}
|
||||||
|
|
||||||
|
createVgpu.resolve = {
|
||||||
|
vm: ['vm', 'VM', 'administrate'],
|
||||||
|
gpuGroup: ['gpuGroup', 'gpuGroup', ''],
|
||||||
|
vgpuType: ['vgpuType', 'vgpuType', '']
|
||||||
|
}
|
||||||
|
exports.createVgpu = createVgpu
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
|
||||||
|
deleteVgpu = $coroutine ({ vgpu }) ->
|
||||||
|
yield @getXapi(vgpu).deleteVgpu(vgpu._xapiId)
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
|
deleteVgpu.params = {
|
||||||
|
vgpu: { type: 'string' }
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteVgpu.resolve = {
|
||||||
|
vgpu: ['vgpu', 'vgpu', '']
|
||||||
|
}
|
||||||
|
exports.deleteVgpu = deleteVgpu
|
||||||
|
|
||||||
#=====================================================================
|
#=====================================================================
|
||||||
|
|
||||||
Object.defineProperty(exports, '__esModule', {
|
Object.defineProperty(exports, '__esModule', {
|
||||||
|
@ -675,6 +675,7 @@ const TRANSFORMS = {
|
|||||||
|
|
||||||
dom0Access: obj.dom0_access,
|
dom0Access: obj.dom0_access,
|
||||||
enabledVgpuTypes: link(obj, 'enabled_VGPU_types'),
|
enabledVgpuTypes: link(obj, 'enabled_VGPU_types'),
|
||||||
|
gpuGroup: link(obj, 'GPU_group'),
|
||||||
isSystemDisplayDevice: Boolean(obj.is_system_display_device),
|
isSystemDisplayDevice: Boolean(obj.is_system_display_device),
|
||||||
pci: link(obj, 'PCI'),
|
pci: link(obj, 'PCI'),
|
||||||
supportedVgpuMaxCapcities: link(obj, 'supported_VGPU_max_capacities'),
|
supportedVgpuMaxCapcities: link(obj, 'supported_VGPU_max_capacities'),
|
||||||
@ -692,7 +693,7 @@ const TRANSFORMS = {
|
|||||||
|
|
||||||
vgpu (obj) {
|
vgpu (obj) {
|
||||||
return {
|
return {
|
||||||
type: 'VGPU',
|
type: 'vgpu',
|
||||||
|
|
||||||
currentlyAttached: Boolean(obj.currently_attached),
|
currentlyAttached: Boolean(obj.currently_attached),
|
||||||
device: obj.device,
|
device: obj.device,
|
||||||
@ -730,12 +731,12 @@ const TRANSFORMS = {
|
|||||||
|
|
||||||
experimental: Boolean(obj.experimental),
|
experimental: Boolean(obj.experimental),
|
||||||
framebufferSize: obj.framebuffer_size,
|
framebufferSize: obj.framebuffer_size,
|
||||||
gpuGroup: link(obj, 'GPU_group'),
|
gpuGroups: link(obj, 'enabled_on_GPU_groups'),
|
||||||
maxHeads: obj.max_heads,
|
maxHeads: obj.max_heads,
|
||||||
maxResolutionX: obj.max_resolution_x,
|
maxResolutionX: obj.max_resolution_x,
|
||||||
maxResolutionY: obj.max_resolution_y,
|
maxResolutionY: obj.max_resolution_y,
|
||||||
modelName: obj.model_name,
|
modelName: obj.model_name,
|
||||||
pgpu: link(obj, 'PGPU'),
|
pgpus: link(obj, 'enabled_on_PGPUs'),
|
||||||
vendorName: obj.vendor_name,
|
vendorName: obj.vendor_name,
|
||||||
vgpus: link(obj, 'VGPUs')
|
vgpus: link(obj, 'VGPUs')
|
||||||
}
|
}
|
||||||
|
9
src/xapi/mixins/gpu.js
Normal file
9
src/xapi/mixins/gpu.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export default {
|
||||||
|
createVgpu (vm, gpuGroup, vgpuType) {
|
||||||
|
// TODO: properly handle device. Can a VM have 2 vGPUS?
|
||||||
|
return this.call('VGPU.create', this.getObject(vm).$ref, this.getObject(gpuGroup).$ref, '0', {}, this.getObject(vgpuType).$ref)
|
||||||
|
},
|
||||||
|
deleteVgpu (vgpu) {
|
||||||
|
return this.call('VGPU.destroy', this.getObject(vgpu).$ref)
|
||||||
|
}
|
||||||
|
}
|
@ -41,6 +41,9 @@ export default {
|
|||||||
coreOs = false,
|
coreOs = false,
|
||||||
cloudConfig = undefined,
|
cloudConfig = undefined,
|
||||||
|
|
||||||
|
vgpuType = undefined,
|
||||||
|
gpuGroup = undefined,
|
||||||
|
|
||||||
...props
|
...props
|
||||||
} = {}, checkLimits) {
|
} = {}, checkLimits) {
|
||||||
const installMethod = (() => {
|
const installMethod = (() => {
|
||||||
@ -187,7 +190,9 @@ export default {
|
|||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Assign VGPUs.
|
if (vgpuType !== undefined && gpuGroup !== undefined) {
|
||||||
|
await this.createVgpu(vm, gpuGroup, vgpuType)
|
||||||
|
}
|
||||||
|
|
||||||
if (cloudConfig != null) {
|
if (cloudConfig != null) {
|
||||||
// Refresh the record.
|
// Refresh the record.
|
||||||
|
Loading…
Reference in New Issue
Block a user