Host and SR basic edition.
This commit is contained in:
parent
d1b54c4195
commit
17f75bbd77
32
src/api/host.coffee
Normal file
32
src/api/host.coffee
Normal file
@ -0,0 +1,32 @@
|
||||
exports.set = ->
|
||||
params = @getParams {
|
||||
id: { type: 'string' }
|
||||
|
||||
name_label: { type: 'string', optional: true }
|
||||
|
||||
name_description: { type: 'string', optional: true }
|
||||
|
||||
enabled: { type: 'boolean', optional: true }
|
||||
}
|
||||
|
||||
# Current user must be an administrator.
|
||||
@checkPermission 'admin'
|
||||
|
||||
try
|
||||
host = @getObject params.id
|
||||
catch
|
||||
@throw 'NO_SUCH_OBJECT'
|
||||
|
||||
xapi = @getXAPI host
|
||||
|
||||
for param, field of {
|
||||
'name_label'
|
||||
'name_description'
|
||||
'enabled'
|
||||
}
|
||||
continue unless param of params
|
||||
|
||||
xapi.call "VM.set_#{field}", VM.ref, params[param] for field in fields
|
||||
|
||||
|
||||
|
29
src/api/sr.coffee
Normal file
29
src/api/sr.coffee
Normal file
@ -0,0 +1,29 @@
|
||||
exports.set = ->
|
||||
params = @getParams {
|
||||
id: { type: 'string' }
|
||||
|
||||
name_label: { type: 'string', optional: true }
|
||||
|
||||
name_description: { type: 'string', optional: true }
|
||||
}
|
||||
|
||||
# Current user must be an administrator.
|
||||
@checkPermission 'admin'
|
||||
|
||||
try
|
||||
SR = @getObject params.id
|
||||
catch
|
||||
@throw 'NO_SUCH_OBJECT'
|
||||
|
||||
xapi = @getXAPI SR
|
||||
|
||||
for param, field of {
|
||||
'name_label'
|
||||
'name_description'
|
||||
}
|
||||
continue unless param of params
|
||||
|
||||
xapi.call "VM.set_#{field}", VM.ref, params[param] for field in fields
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user