diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index e95b72613..f2a50d159 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -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 diff --git a/packages/xo-server/src/api/sr.js b/packages/xo-server/src/api/sr.js index 2d1bd70fd..ccb737e05 100644 --- a/packages/xo-server/src/api/sr.js +++ b/packages/xo-server/src/api/sr.js @@ -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 diff --git a/packages/xo-web/src/common/xo/index.js b/packages/xo-web/src/common/xo/index.js index a992287f5..9a2638b88 100644 --- a/packages/xo-web/src/common/xo/index.js +++ b/packages/xo-web/src/common/xo/index.js @@ -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,