feat(xo-server/rest-api): expose VM snapshots and templates
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
- [API] `proxy.register` accepts `vmUuid` parameter which can be used when not connected to the XAPI containing the XO Proxy VM
|
- [API] `proxy.register` accepts `vmUuid` parameter which can be used when not connected to the XAPI containing the XO Proxy VM
|
||||||
- [Proxy] Can now upgrade proxies in VMs not connected to XO
|
- [Proxy] Can now upgrade proxies in VMs not connected to XO
|
||||||
|
- [REST API] Expose VM snapshots and templates
|
||||||
|
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ export default class RestApi {
|
|||||||
{ id: 'vbds', type: 'VBD' },
|
{ id: 'vbds', type: 'VBD' },
|
||||||
{ id: 'vdis', type: 'VDI' },
|
{ id: 'vdis', type: 'VDI' },
|
||||||
{ id: 'vifs', type: 'VIF' },
|
{ id: 'vifs', type: 'VIF' },
|
||||||
|
{ id: 'vm-snapshots', type: 'VM-snapshot' },
|
||||||
|
{ id: 'vm-templates', type: 'VM-template' },
|
||||||
{ id: 'vms', type: 'VM' },
|
{ id: 'vms', type: 'VM' },
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -160,9 +162,10 @@ export default class RestApi {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
api.get('/vms/:uuid.xva', async (req, res, next) => {
|
api.get('/vm:subtype(|-snapshot|-template)s/:uuid.xva', async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const vm = app.getXapiObject(req.params.uuid, 'VM')
|
const { subtype, uuid } = req.params
|
||||||
|
const vm = app.getXapiObject(uuid, 'VM' + subtype)
|
||||||
const stream = await vm.$export({ compress: req.query.compress })
|
const stream = await vm.$export({ compress: req.query.compress })
|
||||||
|
|
||||||
stream.headers['content-disposition'] = 'attachment'
|
stream.headers['content-disposition'] = 'attachment'
|
||||||
|
|||||||
Reference in New Issue
Block a user