chore(xo-server/vm.import): remove host parameter (#3663)

This commit is contained in:
Julien Fontanet 2018-11-08 16:30:50 +01:00 committed by GitHub
parent 6b394302c1
commit d49294849f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 24 deletions

View File

@ -103,6 +103,6 @@ encoding by prefixing with `json:`:
##### VM import
```
> xo-cli vm.import host=60a6939e-8b0a-4352-9954-5bde44bcdf7d @=vm.xva
> xo-cli vm.import sr=60a6939e-8b0a-4352-9954-5bde44bcdf7d @=vm.xva
```
> Note: `xo-cli` only supports the import of XVA files. It will not import OVA files. To import OVA images, you must use the XOA web UI.

View File

@ -120,7 +120,7 @@ encoding by prefixing with `json:`:
##### VM import
```
> xo-cli vm.import host=60a6939e-8b0a-4352-9954-5bde44bcdf7d @=vm.xva
> xo-cli vm.import sr=60a6939e-8b0a-4352-9954-5bde44bcdf7d @=vm.xva
```
## Development

View File

@ -1188,34 +1188,17 @@ async function handleVmImport (req, res, { data, srId, type, xapi }) {
}
// TODO: "sr_id" can be passed in URL to target a specific SR
async function import_ ({ data, host, sr, type }) {
let xapi
async function import_ ({ data, sr, type }) {
if (data && type === 'xva') {
throw invalidParameters('unsupported field data for the file type xva')
}
if (!sr) {
if (!host) {
throw invalidParameters('you must provide either host or SR')
}
xapi = this.getXapi(host)
sr = xapi.pool.$default_SR
if (!sr) {
throw invalidParameters('there is not default SR in this pool')
}
// FIXME: must have administrate permission on default SR.
} else {
xapi = this.getXapi(sr)
}
return {
$sendTo: await this.registerHttpRequest(handleVmImport, {
data,
srId: sr._xapiId,
type,
xapi,
xapi: this.getXapi(sr),
}),
}
}
@ -1250,13 +1233,11 @@ import_.params = {
},
},
},
host: { type: 'string', optional: true },
type: { type: 'string', optional: true },
sr: { type: 'string', optional: true },
sr: { type: 'string' },
}
import_.resolve = {
host: ['host', 'host', 'administrate'],
sr: ['sr', 'SR', 'administrate'],
}