Cloud config management for CoreOS
This commit is contained in:
parent
658008ab64
commit
cbcc400eb4
@ -915,6 +915,39 @@ setBootOrder.resolve = {
|
|||||||
}
|
}
|
||||||
exports.setBootOrder = setBootOrder
|
exports.setBootOrder = setBootOrder
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
|
||||||
|
getCloudInitConfig = $coroutine ({template}) ->
|
||||||
|
return yield @getXAPI(template).getCloudInitConfig(template._xapiId)
|
||||||
|
|
||||||
|
getCloudInitConfig.params = {
|
||||||
|
template: { type: 'string' }
|
||||||
|
}
|
||||||
|
|
||||||
|
getCloudInitConfig.resolve = {
|
||||||
|
template: ['template', 'VM-template', 'administrate'],
|
||||||
|
}
|
||||||
|
exports.getCloudInitConfig = getCloudInitConfig
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
|
||||||
|
createCloudInitConfigDrive = $coroutine ({vm, sr, config}) ->
|
||||||
|
xapi = @getXAPI vm
|
||||||
|
yield xapi.createCloudInitConfigDrive(vm._xapiId, sr._xapiId, config)
|
||||||
|
return true
|
||||||
|
|
||||||
|
createCloudInitConfigDrive.params = {
|
||||||
|
vm: { type: 'string' },
|
||||||
|
sr: { type: 'string' },
|
||||||
|
config: { type: 'string' }
|
||||||
|
}
|
||||||
|
|
||||||
|
createCloudInitConfigDrive.resolve = {
|
||||||
|
vm: ['vm', 'VM', 'administrate'],
|
||||||
|
sr: [ 'sr', 'SR', 'operate' ]
|
||||||
|
}
|
||||||
|
exports.createCloudInitConfigDrive = createCloudInitConfigDrive
|
||||||
|
|
||||||
#=====================================================================
|
#=====================================================================
|
||||||
|
|
||||||
Object.defineProperty(exports, '__esModule', {
|
Object.defineProperty(exports, '__esModule', {
|
||||||
|
24
src/xapi.js
24
src/xapi.js
@ -1309,7 +1309,7 @@ export default class Xapi extends XapiBase {
|
|||||||
|
|
||||||
async _doDockerAction (vmId, action, containerId) {
|
async _doDockerAction (vmId, action, containerId) {
|
||||||
const vm = this.getObject(vmId)
|
const vm = this.getObject(vmId)
|
||||||
const host = vm.$resident_on
|
const host = vm.$resident_on || this.pool.$master
|
||||||
|
|
||||||
return await this.call('host.call_plugin', host.$ref, 'xscontainer', action, {
|
return await this.call('host.call_plugin', host.$ref, 'xscontainer', action, {
|
||||||
vmuuid: vm.uuid,
|
vmuuid: vm.uuid,
|
||||||
@ -1345,6 +1345,28 @@ export default class Xapi extends XapiBase {
|
|||||||
await this._doDockerAction(vmId, 'unpause', containerId)
|
await this._doDockerAction(vmId, 'unpause', containerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getCloudInitConfig (templateId) {
|
||||||
|
const template = this.getObject(templateId)
|
||||||
|
const host = this.pool.$master
|
||||||
|
|
||||||
|
let config = await this.call('host.call_plugin', host.$ref, 'xscontainer', 'get_config_drive_default', {
|
||||||
|
templateuuid: template.uuid
|
||||||
|
})
|
||||||
|
return config.slice(4) // FIXME remove the "True" string on the begining
|
||||||
|
}
|
||||||
|
|
||||||
|
async createCloudInitConfigDrive (vmId, srId, config) {
|
||||||
|
const vm = this.getObject(vmId)
|
||||||
|
const host = this.pool.$master
|
||||||
|
const sr = this.getObject(srId)
|
||||||
|
|
||||||
|
await this.call('host.call_plugin', host.$ref, 'xscontainer', 'create_config_drive', {
|
||||||
|
vmuuid: vm.uuid,
|
||||||
|
sruuid: sr.uuid,
|
||||||
|
configuration: config
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// =================================================================
|
// =================================================================
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user