enable/disable docker and more robust spec with XML parsing for docker stuff
This commit is contained in:
parent
89d485e188
commit
873e2aed94
@ -1006,7 +1006,6 @@ detachPci.resolve = {
|
||||
}
|
||||
detachPci.permission = 'admin'
|
||||
exports.detachPci = detachPci
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -1103,3 +1102,44 @@ stats.resolve = {
|
||||
}
|
||||
|
||||
exports.stats = stats;
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
enableDocker = $coroutine ({vm}) ->
|
||||
xapi = @getXAPI vm
|
||||
|
||||
$wait xapi.call 'VM.remove_from_other_config', vm.ref, 'xscontainer-monitor'
|
||||
$wait xapi.call 'VM.add_to_other_config', vm.ref, 'xscontainer-monitor', 'True'
|
||||
|
||||
return true
|
||||
|
||||
|
||||
enableDocker.params = {
|
||||
vm: { type: 'string' }
|
||||
}
|
||||
|
||||
enableDocker.resolve = {
|
||||
vm: ['vm', 'VM'],
|
||||
}
|
||||
enableDocker.permission = 'admin'
|
||||
exports.enableDocker = enableDocker
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
disableDocker = $coroutine ({vm}) ->
|
||||
xapi = @getXAPI vm
|
||||
|
||||
$wait xapi.call 'VM.remove_from_other_config', vm.ref, 'xscontainer-monitor'
|
||||
$wait xapi.call 'VM.add_to_other_config', vm.ref, 'xscontainer-monitor', 'False'
|
||||
|
||||
return true
|
||||
|
||||
|
||||
disableDocker.params = {
|
||||
vm: { type: 'string' }
|
||||
}
|
||||
|
||||
disableDocker.resolve = {
|
||||
vm: ['vm', 'VM'],
|
||||
}
|
||||
disableDocker.permission = 'admin'
|
||||
exports.disableDocker = disableDocker
|
||||
|
@ -475,14 +475,28 @@ module.exports = ->
|
||||
current_operations: -> @genval.current_operations
|
||||
|
||||
docker: ->
|
||||
if @genval.other_config.docker_info
|
||||
docker = {
|
||||
enabled: @genval.other_config.xscontainer_monitor
|
||||
process: ($parseXML @genval.other_config.docker_ps).docker_ps
|
||||
info: ($parseXML @genval.other_config.docker_info).docker_info
|
||||
version: ($parseXML @genval.other_config.docker_version).docker_version
|
||||
monitor = @genval.other_config['xscontainer-monitor']
|
||||
return if not monitor?
|
||||
|
||||
if monitor is 'False'
|
||||
return {
|
||||
enabled: false
|
||||
}
|
||||
else false
|
||||
|
||||
if @genval.power_state is 'Running'
|
||||
if @genval.other_config.docker_ps && @genval.other_config.docker_info && @genval.other_config.docker_version
|
||||
process = ($parseXML @genval.other_config.docker_ps).docker_ps
|
||||
info = ($parseXML @genval.other_config.docker_info).docker_info
|
||||
version = ($parseXML @genval.other_config.docker_version).docker_version
|
||||
|
||||
return {
|
||||
enabled: true
|
||||
process: process
|
||||
info: info
|
||||
version: version
|
||||
}
|
||||
|
||||
return { enabled: true}
|
||||
|
||||
# TODO: there is two possible value: "best-effort" and "restart"
|
||||
high_availability: ->
|
||||
|
Loading…
Reference in New Issue
Block a user