feat(new SR): use zfs type when XCP-ng 8.2+ #5302 (#5330)

This commit is contained in:
Nicolas Raynaud
2020-11-16 15:04:39 +01:00
committed by GitHub
parent 7fcfc306f9
commit 949ddbdcd7
3 changed files with 30 additions and 30 deletions

View File

@@ -9,6 +9,7 @@
- [LDAP] Prevent LDAP-provided groups from being edited from XO [#1884](https://github.com/vatesfr/xen-orchestra/issues/1884) (PR [#5351](https://github.com/vatesfr/xen-orchestra/pull/5351))
- [Licensing] Allow Free and Starter users to copy VMs and create a VM from snapshot on the same pool [#4890](https://github.com/vatesfr/xen-orchestra/issues/4890) (PR [5333](https://github.com/vatesfr/xen-orchestra/pull/5333))
- [SR] Use SR type `zfs` instead of `file` for ZFS storage repositories (PR [5302](https://github.com/vatesfr/xen-orchestra/pull/5330))
### Bug fixes

View File

@@ -180,35 +180,6 @@ createIso.resolve = {
host: ['host', 'host', 'administrate'],
}
// -------------------------------------------------------------------
export async function createFile({
host,
nameLabel,
nameDescription,
location,
}) {
const xapi = this.getXapi(host)
return xapi.createSr({
hostRef: host._xapiRef,
name_label: nameLabel,
name_description: nameDescription,
type: 'file',
device_config: { location },
})
}
createFile.params = {
host: { type: 'string' },
nameLabel: { type: 'string' },
nameDescription: { type: 'string' },
location: { type: 'string' },
}
createFile.resolve = {
host: ['host', 'host', 'administrate'],
}
// -------------------------------------------------------------------
// NFS SR
@@ -443,6 +414,34 @@ probeZfs.resolve = {
host: ['host', 'host', 'administrate'],
}
export async function createZfs({
host,
nameLabel,
nameDescription,
location,
}) {
const xapi = this.getXapi(host)
// only XCP-ng >=8.2 support the ZFS SR
const types = await xapi.call('SR.get_supported_types')
return xapi.createSr({
hostRef: host._xapiRef,
name_label: nameLabel,
name_description: nameDescription,
type: types.includes('zfs') ? 'zfs' : 'file',
device_config: { location },
})
}
createZfs.params = {
host: { type: 'string' },
nameLabel: { type: 'string' },
nameDescription: { type: 'string' },
location: { type: 'string' },
}
createZfs.resolve = {
host: ['host', 'host', 'administrate'],
}
// -------------------------------------------------------------------
// This function helps to detect all NFS shares (exports) on a NFS server
// Return a table of exports with their paths and ACLs

View File

@@ -2680,7 +2680,7 @@ export const createSrExt = (host, nameLabel, nameDescription, device) =>
_call('sr.createExt', { host, nameLabel, nameDescription, device })
export const createSrZfs = (host, nameLabel, nameDescription, location) =>
_call('sr.createFile', {
_call('sr.createZfs', {
host: resolveId(host),
nameDescription,
nameLabel,