Compare commits

..

315 Commits

Author SHA1 Message Date
Sebastian CZECH
d62433148b update 2025-05-07 16:08:49 +02:00
Sebastian CZECH
d44364d4d5 update 2025-05-07 14:08:15 +02:00
Sebastian CZECH
9118dc0835 update 2025-05-07 14:05:35 +02:00
Sebastian CZECH
97bf035a9f update 2025-05-07 14:03:28 +02:00
Sebastian CZECH
1e7ac62c51 feat(web-core): create task item component 2025-04-30 03:17:11 +02:00
Joris K
1613293f46 feat(xo-lite): add topology field in vm creation (#8491) 2025-04-29 16:50:16 +02:00
Pierre Donias
2ebffdf9e2 fix(lite,web): use VtsInputWrapper to show input labels (#8542)
Introduced by #8436
2025-04-29 15:45:36 +02:00
Mathieu
2ea30b1899 feat(xo-server-web-hooks): handle office 365 connector format (#8498)
See Zammad#36742

Microsoft teams webhook requires a payload in the office 365 connector format.
2025-04-29 12:04:57 +02:00
Florent BEAUCHAMP
9c92f3a561 feat(license): better handling of expiring licenses (#8523) 2025-04-29 11:39:14 +02:00
Mathieu
374bd22f7b fix(xo-server): fix possible race condition at VIF level on VM creation (#8541) 2025-04-29 11:00:36 +02:00
Thomas Moraine
eae00400b8 doc(XO): Remove orphan Plugins page (#8539)
The page https://docs.xen-orchestra.com/plugins is not referenced in the navigation bar
 and duplicates the content in the https://docs.xen-orchestra.com/architecture#plugins page.
As a result, this commit deletes the Plugins page.

Signed-off-by: Thomas Moraine <thomas.moraine@vates.tech>
2025-04-29 10:55:54 +02:00
MlssFrncJrg
18c9259982 feat(@xen-orchestra/rest-api): expose get group and get groups (#8496) 2025-04-29 10:27:59 +02:00
Florent BEAUCHAMP
11050ca6d0 feat(v2v): resume import 2025-04-29 10:17:28 +02:00
Florent BEAUCHAMP
8756d12b8b fix(vmware-explorer): correctly handle stream and buffer
following dependence update 34e8ff6bae
2025-04-29 10:17:28 +02:00
MlssFrncJrg
93394508de feat(@xen-orchestra/rest-api): expose get networks and get network (#8497) 2025-04-29 09:42:19 +02:00
Bastien Nollet
ba8516d2d3 feat: technical release (#8537) 2025-04-28 16:20:12 +02:00
MlssFrncJrg
ae44845c09 feat(@xen-orchestra/rest-api): expose get user and get users (#8494) 2025-04-28 15:11:12 +02:00
Cyrille G.
88ccb60b60 feat(hub/recipes): update kubernetes version list to use Microk8s version (#8530)
feat(hub/recipes): update kubernetes version list to use Microk8s versions
2025-04-28 12:14:22 +02:00
Thomas Moraine
f879728ee9 docs(manage_infrastructure): document usage-report plugin (#8533)
The usage-reports plugin was not covered at all in the Xen Orchestra technical documentation.

This improvement explains how to get usage reports from your resources, by enabling and setting up the plugin.

Signed-off-by: Thomas Moraine <thomas.moraine@vates.tech>
2025-04-28 10:30:48 +02:00
OlivierFL
47b2a45548 chore(xo-core/docs): update guidelines (#8519) 2025-04-25 17:25:41 +02:00
Enée DI IORIO
404f5a3d88 feat(web-stack/host-header): add host master icon in host header (#8512) 2025-04-25 16:12:58 +02:00
OlivierFL
c3a5fefa02 feat(xo-lite/host): add dashboard view (#8504) 2025-04-25 15:35:37 +02:00
Florent BEAUCHAMP
34e8ff6bae fix: update following dependabot (#8509) 2025-04-25 15:05:11 +02:00
Mathieu
f9838c51d9 fix(xo-server): fix videoram not correctly parsed if defined in platform (#8524)
fix videoram not correctly parsed if defined in platform
2025-04-25 08:32:48 +02:00
Bastien Nollet
9ed551f87d feat: technical release (#8528)
* feat(@xen-orchestra/fs): 4.5.0

* feat(@vates/types): 1.2.0

* feat(@xen-orchestra/audit-core): 0.4.0

* feat(@xen-orchestra/backups): 0.59.0

* feat(@xen-orchestra/backups-cli): 1.0.30

* feat(@xen-orchestra/immutable-backups): 1.0.18

* feat(@xen-orchestra/web-core): 0.19.0

* feat(@xen-orchestra/proxy): 0.29.17

* feat(@xen-orchestra/rest-api): 0.4.0

* feat(@xen-orchestra/web): 0.16.0

* feat(xo-server): 5.176.1

* feat(xo-server-audit): 0.14.0

* feat(xo-web): 5.172.0

* chore(CHANGELOG): update next
2025-04-24 15:16:31 +02:00
Nathanaël
b5dd90f731 feat(web-stack/i18n): update Xen Orchestra 6 (#8465) 2025-04-24 10:24:04 +02:00
Bastien Nollet
d7e64028ec feat(xo-server-audit): audit import (#8474) 2025-04-23 11:03:29 +02:00
Pierre Donias
f17dde1021 fix(xo-web): do not show VM creator when user is not admin (#8503)
Fixes #8463
Introduced by #7276
2025-04-23 09:28:27 +02:00
Julien Fontanet
5c386c1987 feat(xo-web/host/networks): PIFs can be filtered by network names
Internal request: https://team.vates.fr/vates/pl/fgh4irbsi3f65xpzpyh4xe16za
2025-04-22 16:58:20 +02:00
Julien Fontanet
6f0f506d31 fix(CHANGELOG.unreleased): fix Markdown 2025-04-22 16:58:20 +02:00
Enée DI IORIO
058e43c692 feat(web-core): update UiInfo component (#8513) 2025-04-22 14:01:57 +02:00
mathieuRA
355d582965 feat(@xen-orchestra/rest-api): expose get messages and get message 2025-04-22 10:27:46 +02:00
mathieuRA
bc4df1872e feat(@xen-orchestra/rest-api): expose get alarms and get alarm 2025-04-22 10:27:46 +02:00
mathieuRA
d2e5f4213e feat(@vates/types): add XoMessage and XoAlarm 2025-04-22 10:27:46 +02:00
Mathieu
41b56a7fa8 fix(xo-server/createVm): fix DEVICE_ALREADY_EXISTS (#8473)
Introduced by 04dd9e9c40
See [mm](https://team.vates.fr/vates/pl/xn49jke9sfb7byt3k94ngjgq8a)
zammad#36543
2025-04-22 09:56:31 +02:00
Thomas Moraine
8a7d7f5748 docs(continuous_replication): rename to incremental_replication (#8514)
Signed-off-by: Thomas Moraine <thomas.moraine@vates.tech>
2025-04-22 09:27:54 +02:00
Thomas Moraine
48ca9597ff docs(load_balancing): explain how to find the load balancer plugin (#8511)
Signed-off-by: Thomas Moraine <thomas.moraine@vates.tech>
2025-04-22 08:49:38 +02:00
Thomas Moraine
9d24901300 doc(manage_infrastructure): add link to the V2V section of the XCP-ng doc (#8502)
The XCP-ng doc has been recently updated with more details on how to migrate from VMware to a Vates environment,
with a choice of methods including V2V within Xen Orchestra.

As a result, a mention of V2V is added to the XO doc, with a link to the relevant section in the XCP-ng doc.

Signed-off-by: Thomas Moraine <thomas.moraine@vates.tech>
2025-04-18 11:52:18 +02:00
Florent BEAUCHAMP
72f3c9f755 Update CHANGELOG.unreleased.md
Co-authored-by: Bastien Nollet <150058367+b-Nollet@users.noreply.github.com>
2025-04-16 08:45:06 +02:00
Florent BEAUCHAMP
44658110e1 fix(fs): better handling of rmtree EPERM errors
from ticket 37120
an EPERM error during a rmtree , called by the cleanup at the end
of a metdatadat backup, will trigger a ENOTDIR error
this can be caused by a misconfigured/failing immutable backup
2025-04-16 08:45:06 +02:00
Florent BEAUCHAMP
f461eff69a fix(fs): better handling of remote without VMs
remote without any VM ( either empty remote of config only remote)
are flooding the logs with errors like

Error: ENOENT: no such file or directory, scandir '/run/xo-server/mounts/f0952d37-294a-4d5e-8ba5-565e9932b4a7/xo-vm-backups'
2025-04-16 08:45:06 +02:00
Thierry Goettelmann
c609c58398 feat(web-core): don't force collection properties to be computed (#8510) 2025-04-15 16:24:19 +02:00
Florent BEAUCHAMP
e71c17bde3 chore: update dependencies (#8508)
chore: update dependencies
2025-04-15 13:49:15 +02:00
Thierry Goettelmann
06d62e9c28 feat(web-core): create useCollection composable (#8447) 2025-04-14 17:28:38 +02:00
mathieuRA
8e90ad487c feat(@xen-orchestra/rest-api): expose schedule/run 2025-04-14 13:37:09 +02:00
mathieuRA
17b95a8a8f feat(@xen-orchestra/rest-api): expose get schedules and get schedule 2025-04-14 13:37:09 +02:00
mathieuRA
11d78db88d feat(@vates/types): expose XoSchedule type 2025-04-14 13:37:09 +02:00
MlssFrncJrg
748a2ff860 feat(xo-web/dashboard): display snapshots older than 30 days (#8487)
Fixes #8258
2025-04-14 09:39:01 +02:00
MlssFrncJrg
83a69fd00f feat(@xen-orchestra/rest-api): expose get pools and get pool (#8490) 2025-04-11 13:22:27 +02:00
Thomas Moraine
6b89d30e29 Doc: Explain what 'Prevent migration' does (#8222) 2025-04-10 16:04:22 +02:00
Mathieu
5c88f9ee82 feat(xo-web/vm): rename 'disable migration' to 'prevent migration' (#8500)
introduced by dba08f0f
see https://xcp-ng.org/forum/topic/10206/block-migraton-option-on-the-vm-s-advanced-tab/14
related to #8222
2025-04-10 16:00:36 +02:00
René Paw Christensen
0ed5b7c788 docs(backups): exclude disks (#8493)
I have checked the source code, and it uses a "Contains" and not some kind of "StartsWith" to check whether the disk name should be excluded.

I think it is important to clarify that it is possible to place the "[NOBAK]" label after the disk name, which might help some to maintain their naming convention.
2025-04-09 16:59:38 +02:00
Mathieu
dba08f0fac feat(xo-web/vm): rename 'block migration' to 'disable migration' (#8492)
Introduced by 11a801c
Related to #8222
2025-04-09 10:46:30 +02:00
OlivierFL
18d8a29175 fix(xo-6/vm-creation): remove TS errors from type-check (#8472)
- Updated VM creation code to match the TS typing and remove errors in `type-check`
- Refactored code
- Simplified and improved business logic
- Improved naming
2025-04-08 16:56:16 +02:00
Thierry Goettelmann
838564b570 feat(web-core): update UiInput (#8436) 2025-04-08 16:26:08 +02:00
Mathieu
f04a469797 fix(@xen-orchestra/rest-api): fix unbrand type (#8480) 2025-04-08 11:52:28 +02:00
Mathieu
b32dcc2dcb feat(@xen-orchestra/rest-api): swagger interface qol (#8484) 2025-04-08 11:40:17 +02:00
mathieuRA
8128846ea4 feat(@xen-orchestra/rest-api): expose get vifs and get vif 2025-04-07 12:09:11 +02:00
mathieuRA
0dac0c212a feat(@vates/types): add XoVif type 2025-04-07 12:09:11 +02:00
Pierre Donias
dac9aab269 fix(xo-web/acls): disable ACL feature on plans <Enterprise (#8470)
Introduced by #3774
Introduced by #8412

ACLs feature is only available for XOA plans Enterprise and Premium. The
feature is properly disabled on the main ACL config page but was still
available from a VM's Advanced page and from the VM creation form.
2025-04-07 11:32:52 +02:00
Joris K
cf8065e56e feat(web-core): add alert component (#8459) 2025-04-07 11:29:04 +02:00
Olivier Lambert
e896ce6182 chore(docs): update Docusaurus to 3.7 (#8479)
Signed-off-by: Olivier Lambert <olivier.lambert@vates.fr>
2025-04-05 20:15:49 +02:00
Mathieu
224c840147 feat(lite): 0.9.1 (#8475) 2025-04-02 14:32:26 +02:00
Mathieu
ec78209f65 fix(web-core): fix _s is undefined (#8471)
Introduced by ac2f4e9
2025-04-01 16:48:35 +02:00
Sebastian CZECH
fd67016657 feat(web-core): circle progress bar component (#8402) 2025-04-01 14:01:22 +02:00
Mathieu
a420a95c09 feat(lite): 0.9.0 (#8468)
* feat(lite): 0.9.0
2025-03-31 16:44:41 +02:00
Mathieu
1b23812ddc feat: release 5.105 (#8467) 2025-03-31 16:31:53 +02:00
Mathieu
5c390d76e9 feat: technical release (#8466)
* feat(@vates/types): 1.1.1

* feat(@xen-orchestra/web-core): 0.18.0

* feat(@xen-orchestra/rest-api): 0.3.0

* feat(@xen-orchestra/web): 0.15.0

* feat(xo-server): 5.176.0

* feat(xo-server-backup-reports): 1.5.1

* feat(xo-web): 5.171.0

* chore(CHANGELOG): update next
2025-03-31 15:10:21 +02:00
Sebastian CZECH
82ed2bbf8c feat(xo-6): VM creation (#8324) 2025-03-31 14:49:03 +02:00
Joris K
3f565ff4a8 feat(xo-lite): VM creation (#8317) 2025-03-31 11:12:18 +02:00
Nathanaël
6d99331f26 feat(web-stack/i18n): update Xen Orchestra 6 (#8396) 2025-03-28 17:26:42 +01:00
MlssFrncJrg
b88e5c8e8f feat(@xen-orchestra/rest-api): expose get VM snapshots and get VM snapshot (#8453) 2025-03-28 16:36:31 +01:00
MlssFrncJrg
edc2591ce5 feat(@xen-orchestra/rest-api): expose get VM templates and get VM template (#8450) 2025-03-28 16:06:37 +01:00
MlssFrncJrg
2ff482ccad feat(@xen-orchestra/rest-api): expose get VM controllers and get VM controller (#8454) 2025-03-28 15:02:41 +01:00
OlivierFL
ad8f8fe0a4 fix(xo-6/host): ram usage progress bar not handling values properly (#8461) 2025-03-28 10:10:37 +01:00
MlssFrncJrg
873fe76d26 feat(xo-server): set new XAPI platform flag for nested virtualization (#8395)
set new XAPI platform flag for nested virtualization
2025-03-28 09:15:47 +01:00
Mathieu
782a93cdf8 feat(xo-server/xostor): handle XOSTOR on RPU process (#8455) 2025-03-27 12:25:06 +01:00
Mathieu
890766636a fix(xo-server/rest-api): return 404 if backup log do not exist (#8457) 2025-03-27 12:19:22 +01:00
OlivierFL
d77b195213 feat(xo-6/host): add dashboard view (#8398) 2025-03-27 09:52:51 +01:00
Mathieu
60b0b35eaa feat: technical release (#8458) 2025-03-26 15:50:59 +01:00
Joris K
6f578c0302 feat(xo-6/vm): add VIFs information in side panel (#8443) 2025-03-25 16:53:55 +01:00
Florent BEAUCHAMP
a6265fba0f fix(xo-web): remove spec message (#8452)
introduced by dca3f39
2025-03-25 16:50:32 +01:00
Mathieu
85fbdb1cd5 fix(@xen-orchestra/rest-api): remove unused return type (#8449) 2025-03-25 14:12:41 +01:00
Mathieu
d3c655bd49 feat(@xen-orchestra/rest-api): expose get servers and get server (#8385)
Implement the mecanism to expose non XAPI object endpoints:

    Added a new type, NonXapiXoRecord, which represents all XO objects that are not XAPI objects (e.g., users, servers, groups, etc.).
    Split XapiXoController to create BaseController, allowing code reuse between XapiXoController and the new XoController.
    BaseController exposes sendObjects and createAction (unchanged) and enforces subclasses to define the getObject and getObjects methods.
    XoController requires subclasses to implement getAllCollectionObjects and getCollectionObject, as these are used in its getObjects and getObject methods.
    filter and limit are handled by xo-server for XAPI objects. XoController implements its own filter and limit mechanisms for all non XAPI object in getObjects

And finally expose /rest/v0/servers and /rest/v0/servers/<server-id>🥳
2025-03-25 09:38:28 +01:00
Thierry Goettelmann
05d1552c7f feat(web-core): create usePagination composable (#8267) 2025-03-24 17:58:21 +01:00
Thierry Goettelmann
3a80bdfb36 feat(web-core): update VtsLoadingHero logic (#8437) 2025-03-24 17:35:48 +01:00
mathieuRA
39f4ad494d feat(@xen-orchestra/rest-api): expose get vdi-snapshots and get vdi-snapshot 2025-03-24 16:37:17 +01:00
mathieuRA
3aeab1585b feat(@xen-orchestra/rest-api): expose get vdis and get vdi 2025-03-24 16:37:17 +01:00
mathieuRA
2851bcbc5c feat(@vates/types): add XoVdi(-snapshot|unmanaged) types 2025-03-24 16:37:17 +01:00
Florent BEAUCHAMP
bb554a0ddd fix(@xen-orchestra/xapi): remove automatic disabling of cbt chain on export failure (#8446)
introduced by 2a2c966
zammad#35683
2025-03-24 14:34:05 +01:00
Julien Fontanet
f9de5b7e3a feat(README): add translation status and link 2025-03-24 11:59:48 +01:00
Florent BEAUCHAMP
86961aa782 fix(fs): improve compatibility with backblaze (#8393)
Fix `Unsupported header 'x-amz-checksum-mode' received for this API call.`
on backblaze/cloudlfare object storage
from version 3.729, aws sdk send headers that aren't supported yet by backblaze
2025-03-24 11:06:45 +01:00
Joris K
3aa36f907c feat(xo-6/vm): display VIFs in VM network tab (#8442) 2025-03-21 17:43:28 +01:00
Joris K
be44d75f43 feat(xo-lite/vm): display VIFs in VM network tab (#8441) 2025-03-21 16:00:41 +01:00
Sebastian CZECH
a04e58d0a5 feat(xo-6): add sidebar to host networks view (#8287) 2025-03-20 15:48:44 +01:00
OlivierFL
54e00924ed feat(xo-core): add UiProgressBar component (#8410) 2025-03-20 11:05:18 +01:00
Mathieu
f830315a3e fix(@xen-orchestra/rest-api): remove mutualization of query params (#8424)
Mutualiztion of query params require to also mutualize examples.
Introduced by 0951d56
2025-03-19 09:15:18 +01:00
Mathieu
8cc6b33ca1 fix(@vates/types): enhance xen-api and xo types (#8434) 2025-03-19 09:05:50 +01:00
Bastien Nollet
4f969adbe8 feat(xo-server-audit): log warning when audit log chain is broken (#8439) 2025-03-19 09:04:03 +01:00
Thierry Goettelmann
4f46c68aaa feat(web-core): create VtsInputWrapper component (#8435) 2025-03-17 12:03:32 +01:00
Thierry Goettelmann
9b56d93073 feat(web-core): create useRanked composable (#8431) 2025-03-14 17:23:45 +01:00
Thierry Goettelmann
9b93a7d9b3 feat(web-core): create useMapper composable (#8430) 2025-03-14 17:11:45 +01:00
Mathieu
2d062a301e fix(@xen-orchestra/lite): fix JSONRPC request type (#8421) 2025-03-14 15:23:44 +01:00
Thierry Goettelmann
7fd4528eae feat(web-core): recreate UiDropdown component from DS (#8418) 2025-03-13 12:09:39 +01:00
Thierry Goettelmann
ac2f4e9f32 chore(web-stack): update deps (#8428) 2025-03-13 11:54:36 +01:00
Mathieu
1d4b04c777 feat(@xen-orchestra/rest-api): expose get vbd and get vbds (#8404) 2025-03-13 09:41:52 +01:00
Florent BEAUCHAMP
e16f9bfa91 fix(v2v): assert error on import delta from esxi < 7.5 (#8422)
it happens when the source disk is not aligned with the vhd block size ( 2MB)
this PR will read more data into the grain directory / grain tables, but
this data won't be used since we use the virtual size to compute which
grain to read

from ticket 33018
2025-03-12 17:47:11 +01:00
Pierre Donias
9c27b53dfd fix(netbox/name-dedup): perform a case-insensitive name comparison (#8413)
Netbox doesn't allow 2 VM names to be equal within the same cluster even if they
don't have the same case.
2025-03-11 17:03:20 +01:00
Thomas Moraine
763e5f082d docs(backups): Microsoft ReFS is unsupported (#8423)
Signed-off-by: Thomas Moraine <thomas.moraine@vates.tech>
2025-03-11 16:16:09 +01:00
Pierre Donias
8a0604c274 feat(netbox): support Netbox v4.2 (#8417)
Fixes #8280
Fixes #7645
See Zammad#34699
See https://xcp-ng.org/forum/topic/10236/netbox-version-4-2-1-not-supported
See https://github.com/netbox-community/netbox/releases/tag/v4.2.0
2025-03-11 15:35:53 +01:00
Mathieu
ca84af4eda feat(@xen-orchestra/rest-api): migrate vms/:id/actions/start (#8379) 2025-03-11 12:50:42 +01:00
Mathieu
57056b2298 Add XoSr type + expose /rest/v0/srs and /rest/v0/srs/:id (#8419)
* feat(@vates/types): add XoSr type

* feat(@xen-orchestra/rest-api): expose get srs and get sr
2025-03-11 11:18:38 +01:00
Florent BEAUCHAMP
517a0c7b6b fix(backups): handle case when a new disk is added to a replicated VM (#8400)
* fix(backups): handle case when a new disk is added to a replicated VM

* changelog

* changelog
2025-03-11 10:31:56 +01:00
Mathieu
0951d5606d feat(@xen-orchestra/rest-api): mutualize code for better qol (#8401)
* feat(@xen-orchestra/rest-api): mutualize code for better qol

* fix after rebase

* use queries instead of query(s)
2025-03-11 09:16:37 +01:00
Thomas Moraine
d74828017a doc(XO): Add Amazon S3 to the list of supported remotes (#8407)
doc(XO): Add Amazon S3 to list of supported remotes

Amazon S3 remotes have been supported for a while,
but there was no section mentioning it in the Backups → Remotes doc.
This is now fixed

Signed-off-by: Thomas Moraine <thomas.moraine@vates.tech>
2025-03-11 09:00:31 +01:00
Pierre Donias
1bd7bd6661 feat(xo-web,xo-server/createVm): ability to assign ACLs to VM during creation (#8412)
Fixes #6996
2025-03-10 17:10:46 +01:00
Mathieu
6816d6e759 fix(CHANGELOG.unreleased.md): fix extra space (#8420) 2025-03-10 11:29:34 +01:00
Pierre Donias
8fd8e3dff5 fix(netbox): fetch Netbox version even if version check is disabled (#8416)
See Zammad#34699
2025-03-10 09:52:59 +01:00
Bastien Nollet
37fbb7edb8 docs(perf-alert): functional description (#8414) 2025-03-07 16:04:53 +01:00
Bastien Nollet
9e7e4298ab fix(perf-alert): preventing alerts sent endlessly every minute (#8408)
Introduced by b1ce62f
2025-03-07 15:38:58 +01:00
Mathieu
f310575d0c fix(xo-server/createVm): fix OTHER_OPERATION_IN_PROGRESS (#8399)
Introduced by 04dd9e9
2025-03-07 15:27:57 +01:00
Julien Fontanet
5a501d9ee2 fix(xo-server): clarify session duration validity (#8411)
Related to zammad#35588
2025-03-07 14:04:15 +01:00
mathieuRA
37444afa12 fix(xo-server/rest-api): on VM import SR ID is no longer ignored 2025-03-07 12:10:30 +01:00
mathieuRA
31b049963f fix(@xen-orchestra/xapi/VM): throws a nice error when migrating VM without SR or default SR 2025-03-07 12:10:30 +01:00
mathieuRA
76e23ecdcc feat(@xen-orchestra/rest-api): expose hosts/:id/stats 2025-03-06 16:56:38 +01:00
mathieuRA
93706d70c9 feat(@xen-orchestra/rest-api): expose get hosts and get host 2025-03-06 16:56:38 +01:00
mathieuRA
a5866bbb6a feat(@vates/types): add XoHost type 2025-03-06 16:56:38 +01:00
Mathieu
034d9b5eca feat(@xen-orchestra/rest-api): expose VM stats (#8359) 2025-03-06 15:06:28 +01:00
Mathieu
a415c452ef fix(@xen-orchestra/rest-api): fix null values not displayed as nullable (#8406) 2025-03-06 09:23:51 +01:00
OlivierFL
adc5bea153 feat: release 5.104.1 (#8405) 2025-03-04 16:49:47 +01:00
OlivierFL
600d8d9e85 feat: technical release (#8403) 2025-03-04 15:37:15 +01:00
Florent BEAUCHAMP
82f0894fec fix(xapi): add missing changelog entry (#8397) 2025-03-04 13:19:52 +01:00
Florent BEAUCHAMP
90f8f9cff4 feat(vhd-lib): handle broken vhd directory named as aliases (#8292) 2025-03-04 09:55:04 +01:00
Florent BEAUCHAMP
cf0331391b fix(backups): handle undefined remote name in restore description (#8367) 2025-03-04 08:39:11 +01:00
Florent BEAUCHAMP
2a2c966126 fix(backups): disable CBT when CBT is unusable (#8313) 2025-03-03 11:41:39 +01:00
Julien Fontanet
39613ff2fa feat(xo-server/vdi.migrate): returns the new UUID
See https://team.vates.fr/vates/pl/169jwdqkeiys8boftay745iony
2025-02-28 11:18:39 +01:00
Sebastian CZECH
9033577406 feat(xo-6): add sidebar to pool networks view (#8286) 2025-02-28 10:18:46 +01:00
OlivierFL
6125348529 feat(lite): 0.8.0 (#8392) 2025-02-27 14:51:44 +01:00
OlivierFL
b59125cf5a feat: release 5.104.0 (#8391) 2025-02-27 14:26:02 +01:00
OlivierFL
73c9f74a45 feat: technical release (#8389) 2025-02-27 11:48:59 +01:00
OlivierFL
6a21e5525a feat(xo-core): update UiInput and UiTextArea components (#8349) 2025-02-27 11:03:55 +01:00
Sebastian CZECH
e0338c33d7 fix(xo-server): add pifs bond master of (#8368) 2025-02-27 10:49:59 +01:00
Joris K
e905817ea5 fix(xo-lite): add changelog (#8386) 2025-02-27 10:49:13 +01:00
Thomas Moraine
b0ab26b77e docs(backups): Microsoft Data Deduplication and Logical Disk Manager are unsupported (#8382)
Also, replace the screenshot of the file restore feature with an example that uses Linux instead of a Microsoft/NTFS resource

Signed-off-by: Thomas Moraine <thomas.moraine@vates.tech>
2025-02-27 10:32:38 +01:00
Pierre Donias
82daa3550f fix(xo-web/tab-disks): wrong PropTypes on AttachDisk's vbds (#8387) 2025-02-27 10:27:18 +01:00
Pierre Donias
db4d394449 feat(xo-web/vm/disks): allow Self Service users to attach disks to their VMs (#8384)
See Zammad#30630
2025-02-27 10:19:51 +01:00
Joris K
8063f438d9 feat(xo-lite/host): display pif information in side panel / add pif metrics store (#8186) 2025-02-27 09:33:05 +01:00
OlivierFL
b3d66497b9 feat: technical release (#8383) 2025-02-26 16:34:07 +01:00
Mathieu
e567a3b358 feat(xo-server/rest-api): expose vms/hosts stats (#8378)
`GET /rest/v0/vms/f26eb0a5-1d91-4682-ae58-96df405a3af6/stats`
`GET /rest/v0/hosts/f26eb0a5-1d91-4682-ae58-96df405a3af6/stats`
2025-02-26 12:01:03 +01:00
Mathieu
468732cdba fix(xo-server/rest-api): do not show route twice (#8377) 2025-02-26 11:55:55 +01:00
MlssFrncJrg
13bda9812e feat(xo-server/rest-api): ability to update a user (#8343) 2025-02-26 10:03:29 +01:00
OlivierFL
ff8a020fa2 feat(web-stack): update typography (#8320) 2025-02-26 09:30:44 +01:00
OlivierFL
d1c65756be feat(web-stack/i18n): merge translation files into single file (#8380) 2025-02-26 09:00:18 +01:00
Nathanaël
905e3cc943 feat(web-stack/i18n): update translations (#8294) 2025-02-25 17:57:35 +01:00
Joris K
5a21bdfe10 feat(xo-lite/network): add side panel informations and some trad (#8150) 2025-02-25 16:16:30 +01:00
Dan Pollak
a7446ae4af fix(xo-server-audit): ignore additional API calls (#8353) 2025-02-25 15:58:46 +01:00
Julien Fontanet
d46c871b06 fix(xo-server/joinPool): remove useless and bogus obfuscation
Username was obfuscated instead of password.

Obfuscation is now properly done in `xen-api`.
2025-02-25 13:44:14 +01:00
Julien Fontanet
7cc89012d7 fix(xen-api): obfuscate password for pool.join{,_force}
Fixes zammad#35148
2025-02-25 13:44:14 +01:00
Julien Fontanet
bd8a1b25ed fix(xo-cli): timeouts with legacy JSON-RPC API
Fixes zammad#34473
2025-02-25 10:30:01 +01:00
OlivierFL
f18b010588 feat(web-stack): update "info" and "brand" colors usages (#8345) 2025-02-24 16:30:18 +01:00
Mathieu
ac2ff9b38d fix(@vates/types): add missing VM-template in XapiXoRecord (#8376)
Introduced by 0ef95d9
2025-02-24 15:54:19 +01:00
MlssFrncJrg
1a3cd3e2b9 feat(xo-server/rest-api): ability to delete user by its ID (#8283) 2025-02-24 14:46:26 +01:00
OlivierFL
f25c67d5a8 feat: technical release (#8375) 2025-02-24 10:48:54 +01:00
Pierre Donias
821c25f864 fix(generator-toolbox): normalize (#8374) 2025-02-24 10:12:19 +01:00
Mathieu
5910a47780 fix(@xen-orchestra/rest-api): rename example files to not be ignored by npm (#8373)
Introduced by 780e0bb

`.npmignore` ignores all `examples/` folders and all `*.example.*` files
Rename Open API examples as `*.oa-example.mts`
2025-02-24 09:51:05 +01:00
OlivierFL
749f063dc6 fix: bump versions of packages with wrong dependencies (#8371)
Introduced by 4eed730a09

Due to an issue with bump-pkg script, some packages were previously published on
NPM before their dependencies' versions were updated. This commit simply bumps
the versions of those packages to publish the correct list of dependencies.
2025-02-21 17:04:25 +01:00
OlivierFL
4eed730a09 feat: technical release (#8370) 2025-02-21 15:29:00 +01:00
Stephane
42ca53f80c feat(@xen-orchestra/xapi): smart reboot improvements (#8333)
feat(xapi): smart reboot improvements
2025-02-21 11:21:41 +01:00
Julien Fontanet
6b8167a2fc docs(installation): add missing openssl dependency 2025-02-21 10:50:08 +01:00
Mathieu
780e0bbefa feat(@xen-orchestra/rest-api): expose get vms and get vm (#8356)
@vates/types Added an export to the root of the lib because TSOA requires importing the type from the root library to generate the OpenAPI specification
    @vates/types Tuples ([number, number]) throw errors when generating the OpenAPI specification. They have been updated to number[]
    @vates/types Created a XapiXoRecord to be able to differentiate between XO types that come from xapi-object-to-xo and XO types that come from XO collections
    xo-server Added getObjectsByType to avoid iterating over all XAPI objects when we know what type of object we want
    Branded is not a valid type for the OpenAPI spec. I created a Unbrand type, that convert all Branded to string . (Use Unbrand only for OpenAPI specification definition to maintain Branded type safety)
    Added another error middleware to catch TSOA errors and throw XO errors
    Added a README.md to have consistency of order in the use of decorators
2025-02-21 10:31:57 +01:00
Bastien Nollet
b2ba5abacf docs(fuse-vhd): document cli file restoration (#8355)
Document how to restore a file from a VHD with fuse-vhd CLI.
This will allow users to restore by themselves large files that make the restore fail when done from the UI.
2025-02-21 10:26:12 +01:00
Pierre Donias
695b3d76e8 fix(xo-web): empty list of options in selects (#8363)
Introduced by a386680d90
Fixes #8361
See https://github.com/bvaughn/react-virtualized/issues/1871

react-virtualized@9.22.6 seems to be breaking old versions of React
Error in browser console: `TypeError: p.createRef is not a function`
2025-02-20 17:08:52 +01:00
Mathieu
6f5b97f7f3 feat(@xen-orchestra/rest-api): setup simple auth middleware (#8327)
Configure dependency injection + configure authentication middleware for openapi (copy of what actually exists in the current REST API. Will be improved later when implementing ACL/resource set)
2025-02-20 16:07:09 +01:00
OlivierFL
db3f702235 fix(web-stack): rollback vue-tsc version (#8362)
Rollback `vue-tsc` version to `2.1.10`, to fix broken `yarn type-check` and CI.
2025-02-20 13:04:43 +01:00
Bastien Nollet
fb02bf07f6 fix(@vates/task): ensure compatibility between library versions (#8347) 2025-02-19 17:44:34 +01:00
Florent BEAUCHAMP
9723075253 feat(generator): create a toolbox (#8295) 2025-02-18 17:23:51 +01:00
MlssFrncJrg
4b8cdf8043 feat(xo-server/rest-api): ability to create user (#8282) 2025-02-18 16:54:02 +01:00
Florent BEAUCHAMP
397e8b6ed7 fix(xo-server-test): normalize package 2025-02-18 16:45:23 +01:00
Florent BEAUCHAMP
da332715f6 doc(sdn-controller): update readme 2025-02-18 16:45:23 +01:00
Florent BEAUCHAMP
08c47da2b6 fix(rest-api): normalize package 2025-02-18 16:45:23 +01:00
Florent BEAUCHAMP
aa27e3ba46 fix(fatfs): normalize package 2025-02-18 16:45:23 +01:00
Julien Fontanet
a386680d90 chore: update dev deps 2025-02-18 11:05:22 +01:00
Julien Fontanet
6e508b03d8 fix(xo-server-audit): ignore host.getBiosInfo
Introduced by d5217f92f

Related to zammad#34890
2025-02-18 09:19:32 +01:00
Julien Fontanet
2aa7c012f1 fix(xo-server-audit): ignore host.getMdadmHealth
Introduced by c41ae0527

Related to zammad#34890
2025-02-18 09:13:47 +01:00
Julien Fontanet
18fec2a0af fix(CHANGELOG.unreleased): fix Markdown
Introduced by 137837cda
2025-02-18 09:10:56 +01:00
David Johnston
be6b73dcb5 docs: fix links to cloud-init (#8354)
Introduced by a89c31c75

Co-authored-by: David Johnston <david@johnstons.net>
2025-02-18 08:58:37 +01:00
Thomas Moraine
a89c31c75b docs: add page to explain VM templates (#8340)
A forum user suggested changes for better understanding of VM templates.
A new page has been created just for templates,
with Create, Read, Update, Delete (CRUD) sections.

Also, the Cloud-init/Cloudbase-init section of the Advanced page has been moved
to this new page.

This should make it easier for users to get all useful information on templates
in a single document.

Signed-off-by: Thomas Moraine <thomas.moraine@vates.tech>
2025-02-17 10:06:30 +01:00
Julien Fontanet
51b06b1177 docs(xoa): always use HTTPS and wget --no-verbose
`--no-verbose-` is better than `--quite` because it does not hide errors.
2025-02-17 09:36:04 +01:00
Florent BEAUCHAMP
c0d434b612 fix(v2v): Cannot read properties of undefined (reading 'map') with empty datastore (#8311) 2025-02-17 09:35:42 +01:00
Thomas Moraine
b390f36deb doc(XO): Update encryption algorithm transition guidance (#8350)
Update the Xen Orchestra documentation to guide users
on transitioning from AES-256-GCM to ChaCha20-Poly1305 encryption,
solving an issue where users could encounter warnings due to mixed
encryption algorithms in remote storage.
Fix [this]((https://xcp-ng.org/forum/topic/10453/remote-encryption-algorithm)
2025-02-17 09:32:10 +01:00
Mathieu
1983025403 fix(@vates/types): normalize package (#8332) 2025-02-17 09:22:07 +01:00
OlivierFL
9e29c98735 feat(xo-core): update treeview components colors (#8326) 2025-02-17 09:18:00 +01:00
Florent BEAUCHAMP
66e677d7cb feat(V2V/powerOff): handle queued state when stopping the VM (#8328)
zammad#34451
2025-02-14 17:16:50 +01:00
OlivierFL
ecd7d624a0 feat(xo-core): update UiTablePagination component (#8344) 2025-02-14 16:20:24 +01:00
Florent BEAUCHAMP
5219d47fd0 test(vhd-lib): improve ci (#8335) 2025-02-14 15:05:34 +01:00
Mathieu
b7a056dfaf feat(@xen-orchestra/rest-api): add error middlware (#8323) 2025-02-14 14:54:44 +01:00
Mathieu
a5831f8a58 fix(xo-server/rest-api): restore legacy rest-api doc (#8346) 2025-02-14 11:43:41 +01:00
Thomas Moraine
ef636a9821 docs(users): add troubleshooting steps for LDAP group sync issues (#8312)
Some users weren't able to sync all LDAP groups with XO.
Adding what to check to troubleshoot the issue.
Also, refreshing the style and presentation of the LDAP section in the Users page
2025-02-14 09:20:35 +01:00
Nathanaël
987e969103 docs(airgap): replace curl by wget to avoid download errors (#8227)
cURL configuration in old XCP-ng/XenServer hosts is not compatible with https://xoa.io, use wget instead.
2025-02-13 14:40:39 +01:00
MlssFrncJrg
7615a6c5f8 feat(xo-server/rest-api): ability to remove user from a group (#8336) 2025-02-13 12:51:29 +01:00
MlssFrncJrg
a0b1ac9388 feat(xo-server/rest-api): ability to add user in a group (#8334) 2025-02-13 12:36:46 +01:00
MlssFrncJrg
4c6797d278 feat(xo-server/rest-api): ability to update group's name (#8278) 2025-02-13 12:25:02 +01:00
MlssFrncJrg
4b244daebd feat(xo-server/rest-api): ability to delete group (#8277) 2025-02-13 11:45:21 +01:00
MlssFrncJrg
2994b9a327 feat(xo-server/rest-api): ability to create group (#8276) 2025-02-13 11:08:10 +01:00
Mathieu
137837cdab fix(sdn-controller): fix no PIF found when creating private network (#8319)
Fix #8027 zammad#34140
2025-02-12 17:07:40 +01:00
OlivierFL
1fd74a29b9 feat(xo-core): update UiCheckbox and UiRadioButton components (#8342) 2025-02-12 15:26:51 +01:00
Mathieu
877ca82600 feat(@xen-orchestra/rest-api): initial setup for swagger (#8316) 2025-02-12 14:09:22 +01:00
OlivierFL
5dbb529126 feat(xo-core): update UiCounter component (#8337) 2025-02-12 11:55:18 +01:00
OlivierFL
78c3b40762 feat(xo-core): update Button components (#8329) 2025-02-12 11:25:07 +01:00
OlivierFL
47ee8799f3 feat(xo-core): update UiCardTitle and UiCardSubtitle components (#8338) 2025-02-12 11:07:00 +01:00
OlivierFL
8f877962f3 feat(xo-core): update VtsIcon component brand color (#8325) 2025-02-11 17:06:55 +01:00
b-Nollet
832634f284 chore(xo-server): upgrade hashy version (#8304) 2025-02-11 15:50:07 +01:00
Sebastian CZECH
6b6a9a4942 feat(xo-6): dashboard mobile layout (#8268) 2025-02-11 15:11:58 +01:00
OlivierFL
87551ca7b8 feat(xo-core): update UiLink component (#8331) 2025-02-11 13:57:10 +01:00
Julien Fontanet
decf1ebf3e feat(normalize-packages): Node defaults to >=18
See https://github.com/vatesfr/xen-orchestra/pull/8332/files#r1950603611
2025-02-11 11:37:27 +01:00
OlivierFL
aeb22636c7 feat(xo-core): update scrollbars color (#8330) 2025-02-11 09:39:31 +01:00
Thomas Moraine
82473fdf37 docs(sdn_controller): remove XCP-ng 8.0 and prior (obsolete) (#8322)
XCP-ng 8.0 and 7.6 are references in multiple sections.

These versions are obsolete, nobody should be using SDN Controller on anything older than XCP-ng 8.2.

As a result, references to XCP-ng 8.0 and older can be removed safely.

Signed-off-by: Thomas Moraine <thomas.moraine@vates.tech>
2025-02-10 17:19:25 +01:00
Truong
f692c25638 VM Description in backup report (#8253)
Sometime, the name does not provide enough information about the VM, adding more with Description, we will know more which VM has issue with backup.

Co-authored-by: b-Nollet <150058367+b-Nollet@users.noreply.github.com>
2025-02-10 17:05:06 +01:00
OlivierFL
6b30fb50c4 feat(xo-core): update color "info" values (#8314) 2025-02-10 15:10:38 +01:00
Mathieu
0ef95d9911 feat(@vates/types): create @vates/types lib (#8308) 2025-02-10 10:16:39 +01:00
Thomas Moraine
37aa941796 docs(sdn-controller): various improvements (#8318) 2025-02-09 00:33:40 +01:00
Jonas
d907129e82 docs(users): using Google for SAML auth (#8296) 2025-02-07 12:46:57 +01:00
Thomas Moraine
57fe8aec51 docs(users): authentication with auth-oidc plugin (#8230)
Signed-off-by: Thomas Moraine <thomas.moraine@vates.tech>
2025-02-07 12:44:24 +01:00
Sebastian CZECH
90188726e3 feat(lite/release): add changelog to GitHub release description (#8265) 2025-02-07 11:18:09 +01:00
Sebastian CZECH
564a2af879 feat(web-core): migrate UiResource(s) to VtsResource(s) (#8315) 2025-02-06 11:08:37 +01:00
b-Nollet
13488b41b1 feat(lite): 0.7.1 (#8310) 2025-02-04 16:37:53 +01:00
b-Nollet
3e335a3741 feat: release 5.103.1 (#8309) 2025-02-04 16:09:19 +01:00
b-Nollet
ac015305d7 feat: technical release (#8307)
* feat(@xen-orchestra/web-core): 0.13.0

* feat(@xen-orchestra/web): 0.9.0

* feat(xo-server): 5.170.0

* chore(CHANGELOG): update next
2025-02-04 14:48:46 +01:00
Mathieu
936bdaac45 fix(web-core): fix UiStackedBar percent calculation (#8306)
Introduced by 14da422
2025-02-04 13:30:46 +01:00
OlivierFL
0960f8d8d3 fix(lite/host): improve console retrieval (#8305) 2025-02-04 10:17:18 +01:00
Mathieu
6ae05398d7 feat(XO6/dashboard): display size used by replications (#8300) 2025-02-04 10:15:11 +01:00
Stephane
e1b1fcd948 fix(xo-server): fix calculate size replication in sr (#8302)
Introduced by 90a33ea
2025-02-03 17:35:57 +01:00
Florent BEAUCHAMP
7579b3359c docs(async-each): improve the js doc (#8293) 2025-02-03 13:00:25 +01:00
Thomas Moraine
dfbdcd23f2 docs: update XO logo & require Debian 12 (#8263)
Signed-off-by: Thomas Moraine <thomas.moraine@vates.tech>
2025-02-03 12:48:49 +01:00
Thomas Moraine
683f5f61d3 docs: remove references to XOSAN (legacy) (#8299)
Since XOSAN is now legacy and XOSTOR has taken its place, we are removing XOSAN from the Xen Orchestra doc.

Links to XOSAN docs are replaced with links to XOSTOR (from the XCP-ng doc).

Signed-off-by: Thomas Moraine <thomas.moraine@vates.tech>
2025-02-03 09:28:53 +01:00
b-Nollet
c8c9f77d45 feat(xo-server): remember server's pool name and description (#8206)
Remember server's pool name and description, and display the pool name as server default label. The server label can be deleted (since 81e7e07) to get back to the default pool name value.

We did multiple commits to keep the original changes around, but I would advise not to review by commit.

XO-437
2025-02-03 08:41:38 +01:00
Mathieu
7aa51f20c9 fix(xo-server/VM): do not try to resize vdi if vdi.size is undefined (#8291) 2025-02-03 08:35:13 +01:00
b-Nollet
494ea4509f feat(lite): 0.7.0 (#8290) 2025-01-30 16:39:46 +01:00
b-Nollet
4296ca7e9b feat: release 5.103.0 (#8289) 2025-01-30 13:58:52 +01:00
b-Nollet
437e438672 feat: technical release (#8288) 2025-01-30 11:54:42 +01:00
Julien Fontanet
81e7e07312 fix(xo-server,xo-web): allow deleting server's label 2025-01-30 10:27:37 +01:00
Mathieu
05dd9238b8 fix(xo-server/test): use mock.timers for getFromAsyncCache test (#8279)
introduced by 1eeff13

use mock.timers to avoid false negative.
https://nodejs.org/dist/v23.6.1/docs/api/test.html#timers
2025-01-30 08:21:56 +01:00
b-Nollet
aae8b6b1d8 fix(@xen-orchestra/backups): avoid undefined target (#8275) 2025-01-29 17:43:26 +01:00
Sebastian CZECH
097aa5a584 feat(xo-6): add host network view (#8198) 2025-01-29 16:29:41 +01:00
Nathanaël
062dd7561f feat(web-stack/i18n): translations update from Weblate (#8178) 2025-01-29 14:41:03 +01:00
Joris K
2fe2ef49db fix(xo-lite,xo-6): issue with status in pool network table (#8284)
Fix issue with how status is calculated in pool table
2025-01-29 12:23:35 +01:00
Joris K
7862952cf6 fix(xo-lite): issue with wording in host pif table (#8285) 2025-01-29 12:18:02 +01:00
Sebastian CZECH
76c3f7472f feat(xo-6): add pool network view (#8182) 2025-01-29 09:54:06 +01:00
Thomas Moraine
35e8af6313 docs(advanced): disk health monitoring (#8264)
Disk health monitoring from XO was available since XO v5.87.
It's now documented as part of the Management -> Advanced features section.
2025-01-29 09:53:01 +01:00
Joris K
3e69d4c84b feat(xo-lite/host): add host network tab and pif table / status component … (#8180) 2025-01-28 16:22:58 +01:00
Stephane
7e3b7367f1 fix(backups): backup worker inspect failed: address already in use (#8197) 2025-01-28 15:50:45 +01:00
Pierre Donias
42b32eb079 feat: technical release (#8274) 2025-01-28 11:43:52 +01:00
Florent BEAUCHAMP
bf874bce7c fix(xo-server/getAllUnhealthyVdiChainsLength): better handling of vdi not in cache (#8273) 2025-01-28 10:32:22 +01:00
Florent BEAUCHAMP
989b3888ee feat(backups): don't use checksum if not needed (#8270)
* feat(backups): don't use checksum if not needed

encrypted backups are already authenticated, this guarantee that
a readble file has not been modified
thus, no need to compute a relatively slow hash is encryption is already done
2025-01-28 10:30:15 +01:00
MlssFrncJrg
b519e25601 fix(xo-web): in storage creation, display error when selecting SR type (#8250) 2025-01-28 10:02:03 +01:00
Florent BEAUCHAMP
2677b8ca38 fix(backups): weekly ltr retention last week of year (#8269)
the year computation use the locale year computation, whereas the week 
was using the iso week computation
2025-01-28 08:19:16 +01:00
Florent BEAUCHAMP
5024bd765b test: fix ci (#8271)
* test(xo-server/asynccache): more time to let the test run
* test(vhd-lib/openvhd): concurrency on openvhd tests
2025-01-27 16:27:52 +01:00
Joris K
6761274a16 feat(xo-lite/network): implementation of network tab and add network/pif store (#8147) 2025-01-27 16:21:46 +01:00
Thomas Moraine
512af62f7f docs(backups): long term retention (GFS) (#8223) 2025-01-27 15:38:05 +01:00
Thomas Moraine
4123ae731f docs(backups): encryption algorithms (#8266)
Explain how backups are encrypted by Xen Orchestra,
what each encryption algorithm does,
and how it works with Amazon S3
2025-01-27 11:52:39 +01:00
Stephane
90a33ead6d feat(xo-server): calculate size replication in sr (#8262) 2025-01-27 11:49:37 +01:00
Florent BEAUCHAMP
a49864abfb fix(V2V/Vsan): better handling of multiple VSAN (#8243) 2025-01-24 11:34:50 +01:00
Sebastian CZECH
1f4ec8d0e1 feat(xo-6): add console fullscreen action (#8238) 2025-01-23 15:00:22 +01:00
Mathieu
3e615f725b fix(xapi): VDI_destroyCloudInitConfig wait 5 minutes before removing the VDI (#8247) 2025-01-23 13:09:43 +01:00
Mathieu
9af58185cf fix(xo-server, xo-web): fix install patches and RPU on XS8 (#8241) 2025-01-22 15:58:18 +01:00
Sebastian CZECH
2b63829e91 feat(web-core): inverse the logic of border props in MenuList.vue (#8246) 2025-01-22 15:34:56 +01:00
Sebastian CZECH
300bb18a64 feat(web-core): focus on console (#8235) 2025-01-22 15:14:09 +01:00
Sebastian CZECH
42f205e473 feat(xo-6): switch to language based on xo5 cookie (#8242) 2025-01-22 14:55:01 +01:00
Thierry Goettelmann
fe5276217f fix(web-core): useRouteQuery composable type issue (#8261) 2025-01-22 09:04:59 +01:00
Julien Fontanet
1765600437 fix(xo-server-audit): ignore host.getIpmiSensors
Introduced by e30f28907
2025-01-21 09:07:09 +01:00
Stephane
f0680df1e1 feat(backups): add encryption chacha20-poly1305, allow file larger than 64GB on encrypted remote (#8237)
This will also incite users to create new remote with the chacha20-poly1305 instead of aes-256-gcm that will continue to work on exusting remote
2025-01-20 20:10:34 +01:00
Sebastian CZECH
6d34cf67fb feat(web-core): move chart lib from xo-lite to web-core (#8248) 2025-01-20 15:15:46 +01:00
Sebastian CZECH
9c97ac903f feat(xo-6): add Ctrl+Alt+Del (#8239)
functionality to console
2025-01-20 14:56:46 +01:00
OlivierFL
a96d5e64de docs(xo-core): update guidelines (#8194) 2025-01-20 11:44:49 +01:00
b-Nollet
4744071098 fix(usage-report): avoid report failure when previous stats are invalid (#8240) 2025-01-20 11:43:02 +01:00
b-Nollet
dc9dbd9018 fix(xo-web): display mirror backup transfer size (#8224) 2025-01-20 11:40:31 +01:00
b-Nollet
6405eeb1b5 fix(xo-server): throw when remote uses encryption without data blocks (#8244) 2025-01-20 11:38:42 +01:00
Stephane
7c666d1156 fix(backups): fix metadata.isVhdDifferencing key computation (#8216)
This PR fix metadata.isVhdDifferencing where an object was used instead of a string to set the filename.
2025-01-20 10:55:56 +01:00
Sebastian CZECH
7ca6829c27 feat(web-core): standardize console component between xo-lite and xo-6 (#8245) 2025-01-20 10:25:30 +01:00
Florent BEAUCHAMP
97cd50af44 test(backups): fix parallel test (#8257) 2025-01-20 10:16:43 +01:00
David Johnston
5bfd462616 feat(web-stack): add Spanish translation (#8220) 2025-01-20 09:03:41 +01:00
Florent BEAUCHAMP
2b964576f2 test(vhd-lib): fix ci (#8255)
Assertion messages can now contain extra info since Node 20.18.1
2025-01-17 11:50:59 +01:00
MlssFrncJrg
d044dda59a fix(xo-web/SelectTag): list SR tags (#8251)
See https://xcp-ng.org/forum/topic/9953
2025-01-16 15:22:42 +01:00
Julien Fontanet
11a4ceddce chore: update dev deps 2025-01-15 14:46:20 +01:00
Thierry Goettelmann
b97268727c feat(web-core,lite,xo6): add useDisabled composable and replace DisabledContext usage (#8133) 2025-01-13 16:30:24 +01:00
Sebastian CZECH
3a21290fde feat(web-core): add loading state on console (#8226) 2025-01-09 14:43:09 +01:00
Julien Fontanet
299a109eb6 fix(CHANGELOG): fix date
Introduced by 4235e9816
2025-01-09 14:28:28 +01:00
Julien Fontanet
4235e98166 fix(CHANGELOG): add missing date
Introduced by 281ccbb8b
2025-01-09 12:03:04 +01:00
Julien Fontanet
281ccbb8ba feat: release 5.102.1 2025-01-09 11:42:32 +01:00
Julien Fontanet
7053fc4a08 feat(xo-server-backup-reports): 1.4.4 2025-01-09 10:31:12 +01:00
b-Nollet
cd2f74cd63 fix(xo-server-backup-reports): fix undefined function in partial (#8229)
In some failure cases, backup reports were not sent because of an error during handlebars compilation.
The `formatDate` function was incorrectly passed from partial to partial causing the `executeFunction` helper to execute `undefined` as a function (the `vmFailure` helper used default `formatDate=./formatDate` instead of `formatDate=../formatDate`, the `..` being necessary because of the `#each` loop)


Introduced by aa9c49ce6a
2025-01-08 17:25:01 +01:00
Thomas Moraine
6d836df6bf docs(xoa): NTP synchronization with systemd-timesyncd (#8217)
On recent versions of Xen Orchestra, we switched to systemd-timesyncd for NTP management.
XOA documentation is updated to reflect this change.
2025-01-08 09:07:50 +01:00
Joris K
93a11cfb28 fix(lite): fix issue due to update dev deps (#8218) 2025-01-06 11:31:57 +01:00
Julien Fontanet
fd9c9b214a chore: update dev deps 2024-12-31 12:17:18 +01:00
Julien Fontanet
34c1cce029 fix(CHANGELOG): add 5.102.0 Highlights
Introduced by 320a61323
2024-12-30 13:56:14 +01:00
Julien Fontanet
320a61323c feat: release 5.102.0 2024-12-30 13:38:05 +01:00
Mathieu
db9c85df7a feat: technical release (#8214) 2024-12-20 17:34:32 +01:00
Mathieu
c4104b2d58 chore(CHANGELOG.unreleased.md): add missing @xen-orchestra/xapi entry (#8213) 2024-12-20 17:24:11 +01:00
Mathieu
79847a9129 feat: technical release (#8212) 2024-12-20 16:18:43 +01:00
Pierre Donias
0ec86e409c chore(CHANGELOG.unreleased.md): add missing XO 6 entry (#8211) 2024-12-20 16:04:54 +01:00
MlssFrncJrg
c41ae05275 feat(xo-server,xo-web): in host advanced tab, display mdadm status (#8190)
Fixes #7634
2024-12-20 15:59:38 +01:00
Paloma
9af2463922 feat(xo6/dashboard): add Pool Status component to dashboard (#7800) 2024-12-20 15:57:26 +01:00
Pierre Donias
22f9b3598d feat(xo-server/signin): temporary design matching XO 6 color palette (#8209) 2024-12-20 15:56:16 +01:00
MlssFrncJrg
97e7b9e5fe feat(xo-server/xo-web): in dashboard view, display more alarms (#8199) 2024-12-20 15:47:34 +01:00
Mathieu
87cfa649d3 fix(xo-server): fix 'HANDLE_INVALID' when creating VM (#8208)
Introduced by 04dd9e9
2024-12-20 15:23:03 +01:00
Sebastian CZECH
a945888e63 feat: technical release (#8207) 2024-12-20 09:34:02 +01:00
b-Nollet
4833c143de docs(backups): describe config (#8169) 2024-12-19 18:09:31 +01:00
MlssFrncJrg
8c8519f02d fix(xo-web): fix 'Pool is undefined' when creating a private network (#8188) 2024-12-19 17:02:29 +01:00
Mathieu
8ddd7b5290 feat(xo-web/VM/advanced): ability to manage XenStore entries (#8174)
See Zammad#26951
2024-12-19 16:13:10 +01:00
Mathieu
2b679c6cc1 feat(xo-server/rest): add pools status in the /dashboard endpoint (#8203) 2024-12-19 15:47:27 +01:00
Thomas Moraine
2f2a0aeed0 docs: cloudbase-init documentation (#8173)
Xen Orchestra now supports Cloudbase-init (for Windows VMs),
on top of the already-supported Cloud-init (for Linux VMs).
The Cloud-init section is therefore expanded to mention Cloudbase-init,
and we explain how to create a template for Windows VMs using Cloudbase-init.
2024-12-19 14:51:38 +01:00
OlivierFL
68168647aa fix(xo-core/UiInfo): issue with typography and add prop to handle text wrap (#8205) 2024-12-19 10:37:58 +01:00
Joris K
fd7d6b7ad7 feat(web-core): add table-pagination component (#8164) 2024-12-19 10:12:09 +01:00
Sebastian CZECH
086a42f38d feat(core): create connection status component (#8204) 2024-12-18 15:09:15 +01:00
Sebastian CZECH
d864cb57e0 feat: technical release (#8202) 2024-12-18 14:53:31 +01:00
684 changed files with 35364 additions and 9549 deletions

View File

@@ -192,18 +192,14 @@ module.exports = {
// Specific rules for XO i18n-related files
{
files: [
'@xen-orchestra/lite/**/*.{vue,ts,json}',
'@xen-orchestra/web/**/*.{vue,ts,json}',
'@xen-orchestra/lite/**/*.{vue,ts}',
'@xen-orchestra/web/**/*.{vue,ts}',
'@xen-orchestra/web-core/**/*.{vue,ts,json}',
],
extends: ['plugin:@intlify/vue-i18n/base'],
settings: {
'vue-i18n': {
localeDir: [
'@xen-orchestra/lite/src/locales/*.json',
'@xen-orchestra/web/src/locales/*.json',
'@xen-orchestra/web-core/lib/locales/*.json',
],
localeDir: ['@xen-orchestra/web-core/lib/locales/*.json'],
messageSyntaxVersion: '^9.9.0',
},
},
@@ -227,7 +223,10 @@ module.exports = {
'@intlify/vue-i18n/no-v-html': 'error',
'@intlify/vue-i18n/valid-message-syntax': 'error',
'@intlify/vue-i18n/no-duplicate-keys-in-locale': 'error',
'@intlify/vue-i18n/no-missing-keys-in-other-locales': ['error', { ignoreLocales: ['de', 'fa', 'cs'] }],
'@intlify/vue-i18n/no-missing-keys-in-other-locales': [
'error',
{ ignoreLocales: ['de', 'fa', 'cs', 'es', 'sv', 'it', 'ru', 'uk', 'nl'] },
],
},
},
// Specific rules for XO dev-related files

2
.gitignore vendored
View File

@@ -7,6 +7,8 @@
/@vates/*/node_modules/
/@xen-orchestra/*/dist/
/@xen-orchestra/*/node_modules/
/@xen-orchestra/rest-api/open-api/spec/swagger.json
/@xen-orchestra/rest-api/src/open-api/routes/routes.ts
/packages/*/dist/
/packages/*/node_modules/

View File

@@ -11,8 +11,8 @@ class AggregateError extends Error {
/**
* @template Item
* @param {Iterable<Item>} iterable
* @param {(item: Item, index: number, iterable: Iterable<Item>) => Promise<void>} iteratee
* @param {Iterable<Item>|AsyncIterable<Item>} iterable
* @param {(item: Item, index: number, iterable: Iterable<Item>|AsyncIterable<Item>) => Promise<void>} iteratee
* @returns {Promise<void>}
*/
exports.asyncEach = function asyncEach(iterable, iteratee, { concurrency = 10, signal, stopOnError = true } = {}) {

View File

@@ -1,3 +0,0 @@
.DS_Store
.vscode/
node_modules/

1
@vates/fatfs/.npmignore Symbolic link
View File

@@ -0,0 +1 @@
../../scripts/npmignore

View File

@@ -8,8 +8,9 @@
"postversion": "npm publish --access public"
},
"repository": {
"directory": "@vates/fatfs",
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra"
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"keywords": [
"filesystem",
@@ -20,13 +21,14 @@
],
"author": "Vates SAS",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/vatesfr/xen-orchestra/issues"
},
"homepage": "https://github.com/vatesfr/xen-orchestra",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@vates/fatfs",
"dependencies": {
"fifolock": "^1.0.0",
"struct-fu": "^1.2.1",
"xok": "^1.0.0"
},
"engines": {
"node": ">=18"
}
}

View File

@@ -13,7 +13,7 @@ await mount(handler, diskId, mountPoint)
### cli
From the install folder :
From the install folder:
```
cli.mjs <remoteUrl> <vhdPathInRemote> <mountPoint>
@@ -25,4 +25,25 @@ After installing the package
xo-fuse-vhd <remoteUrl> <vhdPathInRemote> <mountPoint>
```
remoteUrl can be found by using cli in `@xen-orchestra/fs` , for example a local remote will have a url like `file:///path/to/remote/root`
The `remoteUrl` can be found using the following command from the XOA CLI, and then picking the right `url` property:
`xo-server-db ls remote`
The `vhdPathInRemote` follows a file structure described [here](https://github.com/vatesfr/xen-orchestra/blob/master/%40xen-orchestra/backups/docs/VM%20backups/README.md).
## Restore a file from a VHD using `fuse-vhd` CLI
1. Mount a VHD to the Filesystem (see **Usage**).
2. Verify the VHD is Correctly Mounted:
`mount | grep fuse`
3. Get the `START` and `SIZE` of the disk whose file you want to restore. Multiply `START` by 512 (block size) to get the offset value. (`mountedVhdPath` is the `mountPoint` value from earlier, followed by `/vhd0`, for example). Depending on the partition type, you may need to do some additional setup to discover the partitions.
`partx --bytes --output=NR,START,SIZE,NAME,UUID,TYPE --pairs <mountedVhdPath>`
4. Mount the disk. Depending on the partition type, you may need to add some additionnal options. The `norecovery` option is used for ext3/ext4/xfs file systems, otherwise remove this option.
`mount --options=loop,ro,norecovery,sizelimit=<SIZE>,offset=<START*512> --source=<mountedVhdPath> --target=<diskMountPoint>`
5. Copy your files from the mounted partition, then unmount the partition.

View File

@@ -29,7 +29,7 @@ await mount(handler, diskId, mountPoint)
### cli
From the install folder :
From the install folder:
```
cli.mjs <remoteUrl> <vhdPathInRemote> <mountPoint>
@@ -41,7 +41,28 @@ After installing the package
xo-fuse-vhd <remoteUrl> <vhdPathInRemote> <mountPoint>
```
remoteUrl can be found by using cli in `@xen-orchestra/fs` , for example a local remote will have a url like `file:///path/to/remote/root`
The `remoteUrl` can be found using the following command from the XOA CLI, and then picking the right `url` property:
`xo-server-db ls remote`
The `vhdPathInRemote` follows a file structure described [here](https://github.com/vatesfr/xen-orchestra/blob/master/%40xen-orchestra/backups/docs/VM%20backups/README.md).
## Restore a file from a VHD using `fuse-vhd` CLI
1. Mount a VHD to the Filesystem (see **Usage**).
2. Verify the VHD is Correctly Mounted:
`mount | grep fuse`
3. Get the `START` and `SIZE` of the disk whose file you want to restore. Multiply `START` by 512 (block size) to get the offset value. (`mountedVhdPath` is the `mountPoint` value from earlier, followed by `/vhd0`, for example). Depending on the partition type, you may need to do some additional setup to discover the partitions.
`partx --bytes --output=NR,START,SIZE,NAME,UUID,TYPE --pairs <mountedVhdPath>`
4. Mount the disk. Depending on the partition type, you may need to add some additionnal options. The `norecovery` option is used for ext3/ext4/xfs file systems, otherwise remove this option.
`mount --options=loop,ro,norecovery,sizelimit=<SIZE>,offset=<START*512> --source=<mountedVhdPath> --target=<diskMountPoint>`
5. Copy your files from the mounted partition, then unmount the partition.
## Contributions

View File

@@ -19,12 +19,12 @@
},
"main": "./index.mjs",
"dependencies": {
"@xen-orchestra/fs": "^4.3.0",
"@xen-orchestra/fs": "^4.5.0",
"@xen-orchestra/log": "^0.7.1",
"fuse-native": "^2.2.6",
"lru-cache": "^7.14.0",
"promise-toolbox": "^0.21.0",
"vhd-lib": "^4.11.2"
"vhd-lib": "^4.11.3"
},
"bin": {
"xo-fuse-vhd": "./cli.mjs"

View File

@@ -0,0 +1,58 @@
A toolbox to ease the use of generator
### Timeout
wrap a source async generator to have it throw an error when timeout is reached
timeout is a positive number in milliseconds
```js
import { Timeout } from '@vates/generator-toolbox'
const wrappedGenerator = new Timeout(sourceGenerator, timeout)
```
### Throttle
wrap a source async generator to have it respect a max speed ( in bytes per seconds).
speed is either a strictly positive number or a function returning a strictly positive number. A speed change will be used for the next emitted packet.
The source generator must yield object with a length property.
Optimized for small yields regarding to the speed, since it won't split incoming packet.
If the generator reached the max speed it will be paused, limiting memory consumption.
```js
import { Throttle } from '@vates/generator-toolbox'
const wrappedGenerator = new Throttle(sourceGenerator, speed)
```
### Synchronized
Fork a generator. The rules ares:
- if the source returns, all the forks returns
- if the forks errors, all the forks errors with the same error
- if a the fork return , it is stopped, but the generator continue with the other
- if a the fork error , it is stopped, but the generator continue with the other
- if all the fork return , the source is stopped
- if all the fork error , the source is errored with the last error
- the source start producing a packet when the fastest forked ask for it
- the source forks get the packet only when all the forks asked for it, no buffer stores in memory
```ts
import { Synchronized } from '@vates/generator-toolbox'
async function consume(generator: AsyncGenerator) {
for await (const val of generator) {
console.log({ val })
}
}
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
await Promise.all([consume(first), consume(second)])
```
Note: you can stop early a generator by calling `generator.return()`, and you can stop in in error by calling `generator.throw(error)`

View File

@@ -0,0 +1 @@
../../scripts/npmignore

View File

@@ -0,0 +1,89 @@
<!-- DO NOT EDIT MANUALLY, THIS FILE HAS BEEN GENERATED -->
# @vates/generator-toolbox
[![Package Version](https://badgen.net/npm/v/@vates/generator-toolbox)](https://npmjs.org/package/@vates/generator-toolbox) ![License](https://badgen.net/npm/license/@vates/generator-toolbox) [![PackagePhobia](https://badgen.net/bundlephobia/minzip/@vates/generator-toolbox)](https://bundlephobia.com/result?p=@vates/generator-toolbox) [![Node compatibility](https://badgen.net/npm/node/@vates/generator-toolbox)](https://npmjs.org/package/@vates/generator-toolbox)
## Install
Installation of the [npm package](https://npmjs.org/package/@vates/generator-toolbox):
```sh
npm install --save @vates/generator-toolbox
```
## Usage
A toolbox to ease the use of generator
### Timeout
wrap a source async generator to have it throw an error when timeout is reached
timeout is a positive number in milliseconds
```js
import { Timeout } from '@vates/generator-toolbox'
const wrappedGenerator = new Timeout(sourceGenerator, timeout)
```
### Throttle
wrap a source async generator to have it respect a max speed ( in bytes per seconds).
speed is either a strictly positive number or a function returning a strictly positive number. A speed change will be used for the next emitted packet.
The source generator must yield object with a length property.
Optimized for small yields regarding to the speed, since it won't split incoming packet.
If the generator reached the max speed it will be paused, limiting memory consumption.
```js
import { Throttle } from '@vates/generator-toolbox'
const wrappedGenerator = new Throttle(sourceGenerator, speed)
```
### Synchronized
Fork a generator. The rules ares:
- if the source returns, all the forks returns
- if the forks errors, all the forks errors with the same error
- if a the fork return , it is stopped, but the generator continue with the other
- if a the fork error , it is stopped, but the generator continue with the other
- if all the fork return , the source is stopped
- if all the fork error , the source is errored with the last error
- the source start producing a packet when the fastest forked ask for it
- the source forks get the packet only when all the forks asked for it, no buffer stores in memory
```ts
import { Synchronized } from '@vates/generator-toolbox'
async function consume(generator: AsyncGenerator) {
for await (const val of generator) {
console.log({ val })
}
}
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
await Promise.all([consume(first), consume(second)])
```
Note: you can stop early a generator by calling `generator.return()`, and you can stop in in error by calling `generator.throw(error)`
## Contributions
Contributions are _very_ welcomed, either on the documentation or on
the code.
You may:
- report any [issue](https://github.com/vatesfr/xen-orchestra/issues)
you've encountered;
- fork and create a pull request.
## License
[MIT](https://spdx.org/licenses/MIT) © [Vates SAS](https://vates.fr)

View File

@@ -0,0 +1,6 @@
// @ts-check
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
export default tseslint.config(eslint.configs.recommended, tseslint.configs.recommended)

View File

@@ -0,0 +1,34 @@
{
"name": "@vates/generator-toolbox",
"version": "1.0.1",
"main": "dist/index.mjs",
"license": "MIT",
"private": false,
"type": "module",
"devDependencies": {
"@eslint/js": "^9.19.0",
"@types/node": "^20.6",
"typescript": "~5.6",
"typescript-eslint": "^8.23.0"
},
"scripts": {
"build": "tsc",
"dev": "tsc --watch",
"postversion": "npm publish --access public",
"test": "tsc && node --test **/*.test.mjs"
},
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@vates/generator-toolbox",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"repository": {
"directory": "@vates/generator-toolbox",
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"author": {
"name": "Vates SAS",
"url": "https://vates.fr"
},
"engines": {
"node": ">=20.18"
}
}

View File

@@ -0,0 +1,3 @@
export { Synchronized } from './synchronized.mjs'
export { Throttle } from './throttle.mjs'
export { Timeout } from './timeout.mjs'

View File

@@ -0,0 +1,148 @@
import assert from 'node:assert'
export class Synchronized<T, TReturn, TNext> {
#source: AsyncGenerator<T, TReturn, TNext>
#forks = new Map<string, Forked<T, TReturn, TNext>>()
#removedForks = new Set<string>()
#waitingForks = new Set<string>()
#started = false
#nextValueForksReady?: {
promise: Promise<IteratorResult<T>>
forksWaitingReject: (error: Error) => void
forksWaitingResolve: () => void
}
constructor(source: AsyncGenerator<T, TReturn, TNext>) {
this.#source = source
}
fork(uid: string): AsyncGenerator {
assert.strictEqual(this.#started, false, `can't create a fork after consuming the data`)
const fork = new Forked<T, TReturn, TNext>(this, uid)
this.#forks.set(uid, fork)
return fork
}
async #resolveWhenAllForksReady(): Promise<IteratorResult<T>> {
if (!this.#nextValueForksReady) {
throw new Error('Can t wait forks if there are noone waiting')
}
const { promise, forksWaitingResolve } = this.#nextValueForksReady
if (this.#waitingForks.size === this.#forks.size) {
// reset value
this.#waitingForks.clear()
this.#nextValueForksReady = undefined
forksWaitingResolve() // for the other forks waiting
}
return promise
}
async next(uid: string): Promise<IteratorResult<T>> {
if (this.#removedForks.has(uid)) {
return { done: true, value: undefined }
}
if (!this.#forks.has(uid)) {
throw new Error(`trying to advance fork ${uid} that is not a fork of this one`)
}
if (this.#waitingForks.has(uid)) {
throw new Error(`Fork ${uid} is already waiting`)
}
this.#started = true
if (this.#nextValueForksReady === undefined) {
let forksWaitingResolve = () => {}
let forksWaitingReject: (reason?: Error) => void = () => {}
const next = this.#source.next().catch(async error => {
const e = new Error(`Error in the source generator ${error.message}`, { cause: error })
forksWaitingReject(e)
// source has failed, kill everything, and stop the forks
for (const uid of [...this.#forks.keys()]) {
await this.remove(uid, error)
}
})
const promise = Promise.all([
next,
new Promise((_resolve, _reject) => {
forksWaitingResolve = () => _resolve(undefined)
forksWaitingReject = _reject
}),
]).then(([_]) => _ as IteratorResult<T>)
this.#nextValueForksReady = { promise, forksWaitingResolve, forksWaitingReject }
}
this.#waitingForks.add(uid)
return this.#resolveWhenAllForksReady()
}
async remove(uid: string, error?: Error): Promise<IteratorResult<T>> {
const fork = this.#forks.get(uid)
if (fork === undefined) {
if (this.#removedForks.has(uid)) {
// already removed
return { done: true, value: undefined }
}
throw new Error(`trying to remove fork wih uid ${uid} that is not a fork of this one`)
}
this.#forks.delete(uid)
this.#waitingForks.delete(uid)
this.#removedForks.add(uid)
try {
if (error === undefined) {
await fork.return()
} else {
await fork.throw(error)
}
} catch (cleaningError) {
console.error('Error while cleaning the forked', {
cleaningError,
sourceError: error,
})
}
if (this.#forks.size === 0) {
if (error === undefined) {
await this.#source.return(undefined as TReturn)
} else {
await this.#source.throw(error)
}
// Reject any pending forks waiting for the next value
if (this.#nextValueForksReady) {
this.#nextValueForksReady.forksWaitingReject(new Error('Source generator terminated.', { cause: error }))
this.#nextValueForksReady = undefined
}
// clear state
this.#removedForks.clear()
this.#waitingForks.clear()
} else {
// this fork was maybe blocking the others
if (this.#nextValueForksReady) {
await this.#resolveWhenAllForksReady()
}
}
return { done: true, value: undefined }
}
}
class Forked<T, TReturn, TNext> implements AsyncGenerator<T, TReturn, TNext> {
#parent: Synchronized<T, TReturn, TNext>
#uid: string
constructor(parent: Synchronized<T, TReturn, TNext>, uid: string) {
this.#parent = parent
this.#uid = uid
}
next(): Promise<IteratorResult<T>> {
return this.#parent.next(this.#uid)
}
async return(): Promise<IteratorResult<T>> {
return this.#parent.remove(this.#uid)
}
async throw(e: Error): Promise<IteratorResult<T>> {
return this.#parent.remove(this.#uid, e)
}
[Symbol.asyncIterator](): AsyncGenerator<T> {
return this
}
}

View File

@@ -0,0 +1,142 @@
import assert from 'node:assert'
import { suite, test } from 'node:test'
import { Synchronized } from './synchronized.mjs'
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function* makeRangeGenerator(end = Infinity, progress = { yielded: 0 }, onYielded = (val: unknown) => {}) {
for (let i = 0; i < end; i++) {
await new Promise(resolve => setTimeout(resolve, 10))
yield i
onYielded(i)
progress.yielded = i
}
return progress
}
async function consume(
iterable: AsyncGenerator,
delay = 2500,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
onConsumed = (val: unknown, iterable: AsyncGenerator) => Promise.resolve(false)
) {
for await (const val of iterable) {
await new Promise(resolve => setTimeout(resolve, delay))
if (await onConsumed(val, iterable)) {
iterable.return(undefined)
}
}
}
suite('success', () => {
test('if works with multiple consumer', async () => {
const progress = { yielded: 0 }
const generator = makeRangeGenerator(3, progress)
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
await Promise.all([consume(first, 50), consume(second, 500)])
assert.strictEqual(progress.yielded, 2)
})
test('if works with one consumer returning', async () => {
const progress = { yielded: 0 }
const generator = makeRangeGenerator(10, progress)
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
await new Promise(resolve => setTimeout(resolve, 500))
await Promise.all([
consume(first, 1),
consume(second, 1, async (val: unknown) => {
return Promise.resolve(val === 2)
}),
])
assert.strictEqual(progress.yielded, 9)
})
test('if works with all consumers returning', async () => {
const progress = { yielded: 0 }
const generator = makeRangeGenerator(10, progress)
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
await new Promise(resolve => setTimeout(resolve, 500))
await Promise.all([
consume(first, 1, async (val: unknown) => {
return Promise.resolve(val === 5)
}),
consume(second, 1, async (val: unknown) => {
return Promise.resolve(val === 2)
}),
])
assert.strictEqual(progress.yielded, 4)
})
})
suite('error', () => {
test('it fails all if error on source', async () => {
const progress = { yielded: 0 }
const generator = makeRangeGenerator(5, progress, (val: unknown) => {
if (val === 2) {
throw new Error('source stop')
}
})
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
await assert.rejects(Promise.all([consume(first, 1), consume(second, 1)]))
assert.strictEqual(progress.yielded, 1)
})
test('it flows until the end if one consumer throws', async () => {
const progress = { yielded: 0 }
const generator = makeRangeGenerator(10, progress)
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
const firstConsume = consume(first, 1)
const secondConsume = assert.rejects(() =>
consume(second, 1, async (val: unknown, iterable) => {
if (val === 1) {
await iterable.throw(new Error('error on second'))
}
return false
})
)
await Promise.allSettled([firstConsume, secondConsume])
assert.strictEqual(progress.yielded, 9)
})
test('it throw if ALL consumer throws', async () => {
const progress = { yielded: 0 }
const generator = makeRangeGenerator(5, progress)
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
const firstConsume = consume(first, 1, async (val: unknown, iterable) => {
if (val === 3) {
await iterable.throw(new Error('error on first'))
}
return false
})
const secondConsume = consume(second, 1, async (val: unknown, iterable) => {
if (val === 1) {
await iterable.throw(new Error('error on second'))
}
return false
})
await assert.rejects(Promise.all([firstConsume, secondConsume]))
assert.strictEqual(progress.yielded, 2)
})
test('It should not allow a new fork after the start', async () => {
const progress = { yielded: 0 }
const generator = makeRangeGenerator(5, progress)
const forker = new Synchronized(generator)
const first = forker.fork('first')
await first.next()
assert.throws(() => forker.fork('second'))
})
})

View File

@@ -0,0 +1,66 @@
import assert from 'node:assert'
/**
*
* This class will throttle the production of a group of generators
*
* limits: depends on the event loop, so don't expect it to be very precise
* works better with more small blocks
* The source generator must yield object with a length property
* Changing the speed will only be takin into account fot the next packets asked
*/
export class Throttle {
#previousSlot = 0
#bytesPerSecond: number | (() => number)
get speed(): number {
let speed: number
if (typeof this.#bytesPerSecond === 'function') {
speed = this.#bytesPerSecond()
} else {
speed = this.#bytesPerSecond
}
assert.ok(speed > 0, `speed must be greater than zero, ${speed} computed`)
return speed
}
constructor(speed: number | (() => number)) {
this.#bytesPerSecond = speed
}
getNextSlot(length: number): { timeout?: ReturnType<typeof setTimeout>; promise?: Promise<unknown> } {
assert.notStrictEqual(length, undefined, `throttled stream need to expose a length property }`)
assert.ok(length > 0, `throttled stream must expose a positive length property , ${length} given }`)
const previous = this.#previousSlot
const nextSlot = Math.round(previous + (length * 1000) / this.speed)
if (nextSlot < Date.now()) {
// we're above the limit, go now
this.#previousSlot = Date.now()
return {}
}
this.#previousSlot = nextSlot
// wait till the next slot
// it won't be extremely precise since the event loop is not
let timeout: ReturnType<typeof setTimeout> | undefined = undefined
const promise = new Promise(function (resolve) {
timeout = setTimeout(resolve, nextSlot - Date.now())
})
return { promise, timeout }
}
async *createThrottledGenerator(source: AsyncGenerator<{ length: number }>): AsyncGenerator<{ length: number }> {
let timeout: ReturnType<typeof setTimeout> | undefined
try {
for await (const value of source) {
const res = this.getNextSlot(value.length)
timeout = res.timeout
// wait for the time slot before yielding the data
if (res.promise !== undefined) {
await res.promise
}
yield value
}
} finally {
clearTimeout(timeout)
}
}
}

View File

@@ -0,0 +1,63 @@
import { Throttle } from './throttle.mjs'
import { suite, test } from 'node:test'
import assert from 'node:assert'
async function* makeGenerator(chunkSize = 1024 * 1024, nbChunks = 100) {
for (let i = 0; i < nbChunks; i++) {
yield Buffer.allocUnsafe(chunkSize)
}
}
async function consumes(generator: AsyncGenerator) {
// eslint-disable-next-line no-empty,@typescript-eslint/no-unused-vars
for await (const data of generator) {
}
}
suite('it throttle one', () => {
test('base test', async () => {
// 10MB/s
const throttler = new Throttle(10 * 1024 * 1024)
const throttled = throttler.createThrottledGenerator(makeGenerator(1024 * 1024, 20))
const start = Date.now()
await consumes(throttled)
const end = Date.now()
assert.strictEqual(Math.round((end - start) / 1000), 2)
})
test('variable speed test', async () => {
// 10MB/s
const throttler = new Throttle(() => 10 * 1024 * 1024)
const throttled = throttler.createThrottledGenerator(makeGenerator(1024 * 1024, 20))
const start = Date.now()
await consumes(throttled)
const end = Date.now()
assert.strictEqual(Math.round((end - start) / 1000), 2)
})
test('multiple generator test', async () => {
// 10MB/s
const throttler = new Throttle(10 * 1024 * 1024)
const first = throttler.createThrottledGenerator(makeGenerator(1024 * 1024, 10))
const second = throttler.createThrottledGenerator(makeGenerator(1024 * 1024, 10))
const start = Date.now()
await Promise.all([consumes(first), consumes(second)])
const end = Date.now()
assert.strictEqual(Math.round((end - start) / 1000), 2)
})
test(`it doesn't accept negative value`, async () => {
// 10MB/s
let throttler = new Throttle(-10 * 1024 * 1024)
let generator = throttler.createThrottledGenerator(makeGenerator(1024 * 1024, 10))
await assert.rejects(() => consumes(generator))
let index = 5
throttler = new Throttle(() => {
index--
return index > 0 ? 10 * 1024 * 1024 : -10 * 1024 * 1024
})
generator = throttler.createThrottledGenerator(makeGenerator(1024 * 1024, 10))
await assert.rejects(() => consumes(generator))
})
})

View File

@@ -0,0 +1,37 @@
import assert from 'node:assert'
export class Timeout<T> implements AsyncGenerator {
#source: AsyncGenerator<T>
#timeout: number
constructor(source: AsyncGenerator<T>, timeout: number) {
assert.ok(timeout > 0, `Timeout value must be positive, ${timeout} received`)
this.#source = source
this.#timeout = timeout
}
async next(): Promise<IteratorResult<T>> {
let timeout: ReturnType<typeof setTimeout>
const promiseTimeout = new Promise((_, reject) => {
timeout = setTimeout(() => {
reject(new Error('Timeout reached '))
}, this.#timeout)
})
const promiseNext = new Promise((resolve, reject) => {
this.#source.next().then(res => {
// ensure timetout won't fire later
clearTimeout(timeout)
resolve(res)
}, reject)
})
// promiseTimeout will never resolve
return Promise.race([promiseNext, promiseTimeout]) as Promise<IteratorResult<T>>
}
return(): Promise<IteratorResult<T>> {
return this.#source.return(undefined)
}
throw(e: Error): Promise<IteratorResult<T>> {
return this.#source.throw(e)
}
[Symbol.asyncIterator](): AsyncGenerator<T> {
return this
}
}

View File

@@ -0,0 +1,67 @@
import { describe, it } from 'node:test'
import assert from 'node:assert'
import { Timeout } from './timeout.mjs'
describe('Timeout class', () => {
it('should reject a timeout with a negative or zero value ', async () => {
// Create a mock async generator that never resolves
const mockGenerator = (async function* () {
yield 1
})()
assert.throws(() => new Timeout(mockGenerator, 0))
assert.throws(() => new Timeout(mockGenerator, -10))
})
it('should resolve with the value from the source generator if it completes before the timeout', async () => {
// Create a mock async generator that resolves immediately
const mockGenerator = (async function* () {
yield 1
})()
const timeout = new Timeout(mockGenerator, 100) // 100ms timeout
const result = await timeout.next()
assert.strictEqual(result.value, 1)
assert.strictEqual(result.done, false)
})
it('should reject with a timeout error if the source generator takes too long', async () => {
// Create a mock async generator that never resolves
// eslint-disable-next-line require-yield
const mockGenerator = (async function* () {
await new Promise(() => {}) // Never resolves
})()
const timeout = new Timeout(mockGenerator, 10) // 10ms timeout
await assert.rejects(timeout.next(), 'Expected timeout error was not thrown')
})
it('should allow iteration using for-await-of', async () => {
// Create a mock async generator that yields values
const mockGenerator: AsyncGenerator<number> = (async function* () {
yield 1
yield 2
yield 3
})()
const timeout = new Timeout(mockGenerator, 100) // 100ms timeout
const results: Array<number> = []
for await (const value of timeout) {
results.push(value as number)
}
assert.deepStrictEqual(results, [1, 2, 3])
})
it('should handle the throw method correctly', async () => {
// Create a mock async generator with a throw method
const mockGenerator = (async function* () {
yield 1
})()
const timeout = new Timeout(mockGenerator, 100) // 100ms timeout
await assert.rejects(timeout.throw(new Error('Test error')), 'Expected error was not thrown')
})
})

View File

@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "es2023",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"declaration": true, // Generates `.d.ts` files for type safety
"outDir": "dist" // Outputs compiled code to the `dist` directory
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}

View File

@@ -24,7 +24,7 @@
"@xen-orchestra/async-map": "^0.1.2",
"@xen-orchestra/log": "^0.7.1",
"promise-toolbox": "^0.21.0",
"xen-api": "^4.6.0"
"xen-api": "^4.7.1"
},
"devDependencies": {
"tap": "^18.7.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@vates/node-vsphere-soap",
"version": "2.1.1",
"version": "2.1.2",
"description": "interface to vSphere SOAP/WSDL from node for interfacing with vCenter or ESXi, forked from node-vsphere-soap",
"main": "lib/client.mjs",
"author": "reedog117",
@@ -12,7 +12,7 @@
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"dependencies": {
"@xen-orchestra/log": "^0.7.1",
"axios": "^1.4.0",
"axios": "^1.8.0",
"soap": "^1.0.0",
"soap-cookie": "^0.10.1"
},

View File

@@ -29,7 +29,7 @@ class Task {
static get abortSignal() {
const task = getTask()
if (task !== undefined) {
return task.#abortController.signal
return task._abortController.signal
}
}
@@ -65,8 +65,11 @@ class Task {
}
}
#abortController = new AbortController()
#onProgress
// These two properties should not be used outside the class
//
// To ensure compatibility between multiple versions of this lib, they are kept public for now
_abortController = new AbortController()
_onProgress
get id() {
return (this.id = Math.random().toString(36).slice(2))
@@ -86,23 +89,23 @@ class Task {
this.#startData = { properties }
if (onProgress !== undefined) {
this.#onProgress = onProgress
this._onProgress = onProgress
} else {
const parent = getTask()
if (parent !== undefined) {
const { signal } = parent.#abortController
const { signal } = parent._abortController
signal.addEventListener('abort', () => {
this.#abortController.abort(signal.reason)
this._abortController.abort(signal.reason)
})
this.#onProgress = parent.#onProgress
this._onProgress = parent._onProgress
this.#startData.parentId = parent.id
} else {
this.#onProgress = noop
this._onProgress = noop
}
}
const { signal } = this.#abortController
const { signal } = this._abortController
signal.addEventListener('abort', () => {
if (this.status === PENDING) {
this.#maybeStart()
@@ -117,7 +120,7 @@ class Task {
}
abort(reason) {
this.#abortController.abort(reason)
this._abortController.abort(reason)
}
#emit(type, data) {
@@ -126,7 +129,7 @@ class Task {
data.id = this.id
data.timestamp = Date.now()
data.type = type
this.#onProgress(data)
this._onProgress(data)
}
#end(status, result) {
@@ -134,7 +137,7 @@ class Task {
assert.equal(this.#running, false)
this.#emit('end', { status, result })
this.#onProgress = alreadyEnded
this._onProgress = alreadyEnded
this.#status = status
}

View File

@@ -13,7 +13,7 @@
"url": "https://vates.fr"
},
"license": "ISC",
"version": "0.6.0",
"version": "0.6.1",
"engines": {
"node": ">=14"
},

1
@vates/types/.npmignore Symbolic link
View File

@@ -0,0 +1 @@
../../scripts/npmignore

View File

@@ -0,0 +1,8 @@
// @ts-check
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
export default tseslint.config(eslint.configs.recommended, tseslint.configs.recommended, {
ignores: ['dist'],
})

48
@vates/types/package.json Normal file
View File

@@ -0,0 +1,48 @@
{
"name": "@vates/types",
"private": false,
"version": "1.2.0",
"main": "./dist/index.mjs",
"exports": {
".": {
"default": "./dist/index.mjs",
"types": "./dist/index.d.mts"
},
"./xo": "./dist/xo.d.mts",
"./xen-api": "./dist/xen-api.d.mts",
"./common": {
"default": "./dist/common.mjs",
"types": "./dist/common.d.mts"
},
"./lib/vates/*": {
"default": "./dist/lib/vates-*.mjs",
"type": "./dist/lib/vates-*.d.mts"
}
},
"type": "module",
"devDependencies": {
"@eslint/js": "^9.19.0",
"typescript": "~5.6.3",
"typescript-eslint": "^8.23.0"
},
"scripts": {
"build": "tsc",
"prepublishOnly": "yarn run build",
"postversion": "npm publish --access public"
},
"license": "AGPL-3.0-or-later",
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@vates/types",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"repository": {
"directory": "@vates/types",
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"author": {
"name": "Vates SAS",
"url": "https://vates.fr"
},
"engines": {
"node": ">=18.18"
}
}

702
@vates/types/src/common.mts Normal file
View File

@@ -0,0 +1,702 @@
declare const __brand: unique symbol
export type Branded<TBrand extends string, TType = string> = TType & { [__brand]: TBrand }
export const HOST_POWER_STATE = {
RUNNING: 'Running',
HALTED: 'Halted',
UNKNOWN: 'Unknown',
} as const
export type HOST_POWER_STATE = (typeof HOST_POWER_STATE)[keyof typeof HOST_POWER_STATE]
export const TASK_ALLOWED_OPERATIONS = {
CANCEL: 'cancel',
DESTROY: 'destroy',
} as const
export type TASK_ALLOWED_OPERATIONS = (typeof TASK_ALLOWED_OPERATIONS)[keyof typeof TASK_ALLOWED_OPERATIONS]
export const TASK_STATUS_TYPE = {
CANCELLED: 'cancelled',
CANCELLING: 'cancelling',
FAILURE: 'failure',
PENDING: 'pending',
SUCCESS: 'success',
} as const
export type TASK_STATUS_TYPE = (typeof TASK_STATUS_TYPE)[keyof typeof TASK_STATUS_TYPE]
export const EVENT_OPERATION = {
ADD: 'add',
DEL: 'del',
MOD: 'mod',
} as const
export type EVENT_OPERATION = (typeof EVENT_OPERATION)[keyof typeof EVENT_OPERATION]
export const POOL_ALLOWED_OPERATIONS = {
APPLY_UPDATES: 'apply_updates',
CERT_REFRESH: 'cert_refresh',
CLUSTER_CREATE: 'cluster_create',
CONFIGURE_REPOSITORIES: 'configure_repositories',
COPY_PRIMARY_HOST_CERTS: 'copy_primary_host_certs',
DESIGNATE_NEW_MASTER: 'designate_new_master',
EJECT: 'eject',
EXCHANGE_CA_CERTIFICATES_ON_JOIN: 'exchange_ca_certificates_on_join',
EXCHANGE_CERTIFICATES_ON_JOIN: 'exchange_certificates_on_join',
GET_UPDATES: 'get_updates',
HA_DISABLE: 'ha_disable',
HA_ENABLE: 'ha_enable',
SYNC_UPDATES: 'sync_updates',
TLS_VERIFICATION_ENABLE: 'tls_verification_enable',
} as const
export type POOL_ALLOWED_OPERATIONS = (typeof POOL_ALLOWED_OPERATIONS)[keyof typeof POOL_ALLOWED_OPERATIONS]
export const TELEMETRY_FREQUENCY = {
DAILY: 'daily',
MONTHLY: 'monthly',
WEEKLY: 'weekly',
} as const
export type TELEMETRY_FREQUENCY = (typeof TELEMETRY_FREQUENCY)[keyof typeof TELEMETRY_FREQUENCY]
export const UPDATE_SYNC_FREQUENCY = {
DAILY: 'daily',
WEEKLY: 'weekly',
} as const
export type UPDATE_SYNC_FREQUENCY = (typeof UPDATE_SYNC_FREQUENCY)[keyof typeof UPDATE_SYNC_FREQUENCY]
export const AFTER_APPLY_GUIDANCE = {
RESTART_HOST: 'restartHost',
RESTART_HVM: 'restartHVM',
RESTART_PV: 'restartPV',
RESTART_XAPI: 'restartXAPI',
} as const
export type AFTER_APPLY_GUIDANCE = (typeof AFTER_APPLY_GUIDANCE)[keyof typeof AFTER_APPLY_GUIDANCE]
export const UPDATE_AFTER_APPLY_GUIDANCE = {
RESTART_HOST: 'restartHost',
RESTART_HVM: 'restartHVM',
RESTART_PV: 'restartPV',
RESTART_XAPI: 'restartXAPI',
} as const
export type UPDATE_AFTER_APPLY_GUIDANCE = (typeof UPDATE_AFTER_APPLY_GUIDANCE)[keyof typeof UPDATE_AFTER_APPLY_GUIDANCE]
export const LIVEPATCH_STATUS = {
OK: 'ok',
OK_LIVEPATCH_COMPLETE: 'ok_livepatch_complete',
OK_LIVEPATCH_INCOMPLETE: 'ok_livepatch_incomplete',
} as const
export type LIVEPATCH_STATUS = (typeof LIVEPATCH_STATUS)[keyof typeof LIVEPATCH_STATUS]
export const VM_POWER_STATE = {
HALTED: 'Halted',
PAUSED: 'Paused',
RUNNING: 'Running',
SUSPENDED: 'Suspended',
} as const
export type VM_POWER_STATE = (typeof VM_POWER_STATE)[keyof typeof VM_POWER_STATE]
export const UPDATE_GUIDANCES = {
REBOOT_HOST: 'reboot_host',
REBOOT_HOST_ON_KERNEL_LIVEPATCH_FAILURE: 'reboot_host_on_kernel_livepatch_failure',
REBOOT_HOST_ON_LIVEPATCH_FAILURE: 'reboot_host_on_livepatch_failure',
REBOOT_HOST_ON_XEN_LIVEPATCH_FAILURE: 'reboot_host_on_xen_livepatch_failure',
RESTART_DEVICE_MODEL: 'restart_device_model',
RESTART_TOOLSTACK: 'restart_toolstack',
RESTART_VM: 'restart_vm',
} as const
export type UPDATE_GUIDANCES = (typeof UPDATE_GUIDANCES)[keyof typeof UPDATE_GUIDANCES]
export const ON_SOFTREBOOT_BEHAVIOR = {
DESTROY: 'destroy',
PRESERVE: 'preserve',
RESTART: 'restart',
SOFT_REBOOT: 'soft_reboot',
} as const
export type ON_SOFTREBOOT_BEHAVIOR = (typeof ON_SOFTREBOOT_BEHAVIOR)[keyof typeof ON_SOFTREBOOT_BEHAVIOR]
export const ON_NORMAL_EXIT = {
DESTROY: 'destroy',
RESTART: 'restart',
} as const
export type ON_NORMAL_EXIT = (typeof ON_NORMAL_EXIT)[keyof typeof ON_NORMAL_EXIT]
export const VM_OPERATIONS = {
ASSERT_OPERATION_VALID: 'assert_operation_valid',
AWAITING_MEMORY_LIVE: 'awaiting_memory_live',
CALL_PLUGIN: 'call_plugin',
CHANGING_DYNAMIC_RANGE: 'changing_dynamic_range',
CHANGING_MEMORY_LIMITS: 'changing_memory_limits',
CHANGING_MEMORY_LIVE: 'changing_memory_live',
CHANGING_NVRAM: 'changing_NVRAM',
CHANGING_SHADOW_MEMORY: 'changing_shadow_memory',
CHANGING_SHADOW_MEMORY_LIVE: 'changing_shadow_memory_live',
CHANGING_STATIC_RANGE: 'changing_static_range',
CHANGING_VCPUS: 'changing_VCPUs',
CHANGING_VCPUS_LIVE: 'changing_VCPUs_live',
CHECKPOINT: 'checkpoint',
CLEAN_REBOOT: 'clean_reboot',
CLEAN_SHUTDOWN: 'clean_shutdown',
CLONE: 'clone',
COPY: 'copy',
CREATE_TEMPLATE: 'create_template',
CREATE_VTPM: 'create_vtpm',
CSVM: 'csvm',
DATA_SOURCE_OP: 'data_source_op',
DESTROY: 'destroy',
EXPORT: 'export',
GET_BOOT_RECORD: 'get_boot_record',
HARD_REBOOT: 'hard_reboot',
HARD_SHUTDOWN: 'hard_shutdown',
IMPORT: 'import',
MAKE_INTO_TEMPLATE: 'make_into_template',
METADATA_EXPORT: 'metadata_export',
MIGRATE_SEND: 'migrate_send',
PAUSE: 'pause',
POOL_MIGRATE: 'pool_migrate',
POWER_STATE_RESET: 'power_state_reset',
PROVISION: 'provision',
QUERY_SERVICES: 'query_services',
RESUME: 'resume',
RESUME_ON: 'resume_on',
REVERT: 'revert',
REVERTING: 'reverting',
SEND_SYSRQ: 'send_sysrq',
SEND_TRIGGER: 'send_trigger',
SHUTDOWN: 'shutdown',
SNAPSHOT: 'snapshot',
SNAPSHOT_WITH_QUIESCE: 'snapshot_with_quiesce',
START: 'start',
START_ON: 'start_on',
SUSPEND: 'suspend',
UNPAUSE: 'unpause',
UPDATE_ALLOWED_OPERATIONS: 'update_allowed_operations',
} as const
export type VM_OPERATIONS = (typeof VM_OPERATIONS)[keyof typeof VM_OPERATIONS]
export const ON_CRASH_BEHAVIOUR = {
COREDUMP_AND_DESTROY: 'coredump_and_destroy',
COREDUMP_AND_RESTART: 'coredump_and_restart',
DESTROY: 'destroy',
PRESERVE: 'preserve',
RENAME_RESTART: 'rename_restart',
RESTART: 'restart',
} as const
export type ON_CRASH_BEHAVIOUR = (typeof ON_CRASH_BEHAVIOUR)[keyof typeof ON_CRASH_BEHAVIOUR]
export const DOMAIN_TYPE = {
HVM: 'hvm',
PV: 'pv',
PVH: 'pvh',
PV_IN_PVH: 'pv_in_pvh',
UNSPECIFIED: 'unspecified',
} as const
export type DOMAIN_TYPE = (typeof DOMAIN_TYPE)[keyof typeof DOMAIN_TYPE]
export const TRISTATE_TYPE = {
NO: 'no',
UNSPECIFIED: 'unspecified',
YES: 'yes',
} as const
export type TRISTATE_TYPE = (typeof TRISTATE_TYPE)[keyof typeof TRISTATE_TYPE]
export const VMPP_BACKUP_TYPE = {
CHECKPOINT: 'checkpoint',
SNAPSHOT: 'snapshot',
} as const
export type VMPP_BACKUP_TYPE = (typeof VMPP_BACKUP_TYPE)[keyof typeof VMPP_BACKUP_TYPE]
export const VMPP_BACKUP_FREQUENCY = {
DAILY: 'daily',
HOURLY: 'hourly',
WEEKLY: 'weekly',
} as const
export type VMPP_BACKUP_FREQUENCY = (typeof VMPP_BACKUP_FREQUENCY)[keyof typeof VMPP_BACKUP_FREQUENCY]
export const VMPP_ARCHIVE_FREQUENCY = {
ALWAYS_AFTER_BACKUP: 'always_after_backup',
DAILY: 'daily',
NEVER: 'never',
WEEKLY: 'weekly',
} as const
export type VMPP_ARCHIVE_FREQUENCY = (typeof VMPP_ARCHIVE_FREQUENCY)[keyof typeof VMPP_ARCHIVE_FREQUENCY]
export const VMPP_ARCHIVE_TARGET_TYPE = {
CIFS: 'cifs',
NFS: 'nfs',
NONE: 'none',
} as const
export type VMPP_ARCHIVE_TARGET_TYPE = (typeof VMPP_ARCHIVE_TARGET_TYPE)[keyof typeof VMPP_ARCHIVE_TARGET_TYPE]
export const VMSS_FREQUENCY = {
DAILY: 'daily',
HOURLY: 'hourly',
WEEKLY: 'weekly',
} as const
export type VMSS_FREQUENCY = (typeof VMSS_FREQUENCY)[keyof typeof VMSS_FREQUENCY]
export const VMSS_TYPE = {
CHECKPOINT: 'checkpoint',
SNAPSHOT: 'snapshot',
SNAPSHOT_WITH_QUIESCE: 'snapshot_with_quiesce',
} as const
export type VMSS_TYPE = (typeof VMSS_TYPE)[keyof typeof VMSS_TYPE]
export const VM_APPLIANCE_OPERATION = {
CLEAN_SHUTDOWN: 'clean_shutdown',
HARD_SHUTDOWN: 'hard_shutdown',
SHUTDOWN: 'shutdown',
START: 'start',
} as const
export type VM_APPLIANCE_OPERATION = (typeof VM_APPLIANCE_OPERATION)[keyof typeof VM_APPLIANCE_OPERATION]
export const HOST_ALLOWED_OPERATIONS = {
APPLY_UPDATES: 'apply_updates',
ENABLE: 'enable',
EVACUATE: 'evacuate',
POWER_ON: 'power_on',
PROVISION: 'provision',
REBOOT: 'reboot',
SHUTDOWN: 'shutdown',
VM_MIGRATE: 'vm_migrate',
VM_RESUME: 'vm_resume',
VM_START: 'vm_start',
} as const
export type HOST_ALLOWED_OPERATIONS = (typeof HOST_ALLOWED_OPERATIONS)[keyof typeof HOST_ALLOWED_OPERATIONS]
export const LATEST_SYNCED_UPDATES_APPLIED_STATE = {
NO: 'no',
UNKNOWN: 'unknown',
YES: 'yes',
} as const
export type LATEST_SYNCED_UPDATES_APPLIED_STATE =
(typeof LATEST_SYNCED_UPDATES_APPLIED_STATE)[keyof typeof LATEST_SYNCED_UPDATES_APPLIED_STATE]
export const HOST_DISPLAY = {
DISABLED: 'disabled',
DISABLE_ON_REBOOT: 'disable_on_reboot',
ENABLED: 'enabled',
ENABLE_ON_REBOOT: 'enable_on_reboot',
} as const
export type HOST_DISPLAY = (typeof HOST_DISPLAY)[keyof typeof HOST_DISPLAY]
export const HOST_SCHED_GRAN = {
CORE: 'core',
CPU: 'cpu',
SOCKET: 'socket',
} as const
export type HOST_SCHED_GRAN = (typeof HOST_SCHED_GRAN)[keyof typeof HOST_SCHED_GRAN]
export const HOST_NUMA_AFFINITY_POLICY = {
ANY: 'any',
BEST_EFFORT: 'best_effort',
DEFAULT_POLICY: 'default_policy',
} as const
export type HOST_NUMA_AFFINITY_POLICY = (typeof HOST_NUMA_AFFINITY_POLICY)[keyof typeof HOST_NUMA_AFFINITY_POLICY]
export const NETWORK_OPERATIONS = {
ATTACHING: 'attaching',
} as const
export type NETWORK_OPERATIONS = (typeof NETWORK_OPERATIONS)[keyof typeof NETWORK_OPERATIONS]
export const NETWORK_DEFAULT_LOCKING_MODE = {
DISABLED: 'disabled',
UNLOCKED: 'unlocked',
} as const
export type NETWORK_DEFAULT_LOCKING_MODE =
(typeof NETWORK_DEFAULT_LOCKING_MODE)[keyof typeof NETWORK_DEFAULT_LOCKING_MODE]
export const NETWORK_PURPOSE = {
INSECURE_NBD: 'insecure_nbd',
NBD: 'nbd',
} as const
export type NETWORK_PURPOSE = (typeof NETWORK_PURPOSE)[keyof typeof NETWORK_PURPOSE]
export const VIF_OPERATIONS = {
ATTACH: 'attach',
PLUG: 'plug',
UNPLUG: 'unplug',
} as const
export type VIF_OPERATIONS = (typeof VIF_OPERATIONS)[keyof typeof VIF_OPERATIONS]
export const VIF_LOCKING_MODE = {
DISABLED: 'disabled',
LOCKED: 'locked',
NETWORK_DEFAULT: 'network_default',
UNLOCKED: 'unlocked',
} as const
export type VIF_LOCKING_MODE = (typeof VIF_LOCKING_MODE)[keyof typeof VIF_LOCKING_MODE]
export const VIF_IPV4_CONFIGURATION_MODE = {
NONE: 'None',
STATIC: 'Static',
} as const
export type VIF_IPV4_CONFIGURATION_MODE = (typeof VIF_IPV4_CONFIGURATION_MODE)[keyof typeof VIF_IPV4_CONFIGURATION_MODE]
export const VIF_IPV6_CONFIGURATION_MODE = {
NONE: 'None',
STATIC: 'Static',
} as const
export type VIF_IPV6_CONFIGURATION_MODE = (typeof VIF_IPV6_CONFIGURATION_MODE)[keyof typeof VIF_IPV6_CONFIGURATION_MODE]
export const PIF_IGMP_STATUS = {
DISABLED: 'disabled',
ENABLED: 'enabled',
UNKNOWN: 'unknown',
} as const
export type PIF_IGMP_STATUS = (typeof PIF_IGMP_STATUS)[keyof typeof PIF_IGMP_STATUS]
export const IP_CONFIGURATION_MODE = {
DHCP: 'DHCP',
NONE: 'None',
STATIC: 'Static',
} as const
export type IP_CONFIGURATION_MODE = (typeof IP_CONFIGURATION_MODE)[keyof typeof IP_CONFIGURATION_MODE]
export const IPV6_CONFIGURATION_MODE = {
AUTOCONF: 'Autoconf',
DHCP: 'DHCP',
NONE: 'None',
STATIC: 'Static',
} as const
export type IPV6_CONFIGURATION_MODE = (typeof IPV6_CONFIGURATION_MODE)[keyof typeof IPV6_CONFIGURATION_MODE]
export const PRIMARY_ADDRESS_TYPE = {
IPV4: 'IPv4',
IPV6: 'IPv6',
} as const
export type PRIMARY_ADDRESS_TYPE = (typeof PRIMARY_ADDRESS_TYPE)[keyof typeof PRIMARY_ADDRESS_TYPE]
export const BOND_MODE = {
ACTIVE_BACKUP: 'active-backup',
BALANCE_SLB: 'balance-slb',
LACP: 'lacp',
} as const
export type BOND_MODE = (typeof BOND_MODE)[keyof typeof BOND_MODE]
export const STORAGE_OPERATIONS = {
DESTROY: 'destroy',
FORGET: 'forget',
PBD_CREATE: 'pbd_create',
PBD_DESTROY: 'pbd_destroy',
PLUG: 'plug',
SCAN: 'scan',
UNPLUG: 'unplug',
UPDATE: 'update',
VDI_CLONE: 'vdi_clone',
VDI_CREATE: 'vdi_create',
VDI_DATA_DESTROY: 'vdi_data_destroy',
VDI_DESTROY: 'vdi_destroy',
VDI_DISABLE_CBT: 'vdi_disable_cbt',
VDI_ENABLE_CBT: 'vdi_enable_cbt',
VDI_INTRODUCE: 'vdi_introduce',
VDI_LIST_CHANGED_BLOCKS: 'vdi_list_changed_blocks',
VDI_MIRROR: 'vdi_mirror',
VDI_RESIZE: 'vdi_resize',
VDI_SET_ON_BOOT: 'vdi_set_on_boot',
VDI_SNAPSHOT: 'vdi_snapshot',
} as const
export type STORAGE_OPERATIONS = (typeof STORAGE_OPERATIONS)[keyof typeof STORAGE_OPERATIONS]
export const SR_HEALTH = {
HEALTHY: 'healthy',
RECOVERING: 'recovering',
} as const
export type SR_HEALTH = (typeof SR_HEALTH)[keyof typeof SR_HEALTH]
export const VDI_OPERATIONS = {
BLOCKED: 'blocked',
CLONE: 'clone',
COPY: 'copy',
DATA_DESTROY: 'data_destroy',
DESTROY: 'destroy',
DISABLE_CBT: 'disable_cbt',
ENABLE_CBT: 'enable_cbt',
FORCE_UNLOCK: 'force_unlock',
FORGET: 'forget',
GENERATE_CONFIG: 'generate_config',
LIST_CHANGED_BLOCKS: 'list_changed_blocks',
MIRROR: 'mirror',
RESIZE: 'resize',
RESIZE_ONLINE: 'resize_online',
SET_ON_BOOT: 'set_on_boot',
SNAPSHOT: 'snapshot',
UPDATE: 'update',
} as const
export type VDI_OPERATIONS = (typeof VDI_OPERATIONS)[keyof typeof VDI_OPERATIONS]
export const VDI_TYPE = {
CBT_METADATA: 'cbt_metadata',
CRASHDUMP: 'crashdump',
EPHEMERAL: 'ephemeral',
HA_STATEFILE: 'ha_statefile',
METADATA: 'metadata',
PVS_CACHE: 'pvs_cache',
REDO_LOG: 'redo_log',
RRD: 'rrd',
SUSPEND: 'suspend',
SYSTEM: 'system',
USER: 'user',
} as const
export type VDI_TYPE = (typeof VDI_TYPE)[keyof typeof VDI_TYPE]
export const ON_BOOT = {
PERSIST: 'persist',
RESET: 'reset',
} as const
export type ON_BOOT = (typeof ON_BOOT)[keyof typeof ON_BOOT]
export const VBD_OPERATIONS = {
ATTACH: 'attach',
EJECT: 'eject',
INSERT: 'insert',
PAUSE: 'pause',
PLUG: 'plug',
UNPAUSE: 'unpause',
UNPLUG: 'unplug',
UNPLUG_FORCE: 'unplug_force',
} as const
export type VBD_OPERATIONS = (typeof VBD_OPERATIONS)[keyof typeof VBD_OPERATIONS]
export const VBD_TYPE = {
CD: 'CD',
DISK: 'Disk',
FLOPPY: 'Floppy',
} as const
export type VBD_TYPE = (typeof VBD_TYPE)[keyof typeof VBD_TYPE]
export const VBD_MODE = {
RO: 'RO',
RW: 'RW',
} as const
export type VBD_MODE = (typeof VBD_MODE)[keyof typeof VBD_MODE]
export const VTPM_OPERATIONS = {
DESTROY: 'destroy',
} as const
export type VTPM_OPERATIONS = (typeof VTPM_OPERATIONS)[keyof typeof VTPM_OPERATIONS]
export const PERSISTENCE_BACKEND = {
XAPI: 'xapi',
} as const
export type PERSISTENCE_BACKEND = (typeof PERSISTENCE_BACKEND)[keyof typeof PERSISTENCE_BACKEND]
export const CONSOLE_PROTOCOL = {
RDP: 'rdp',
RFB: 'rfb',
VT100: 'vt100',
} as const
export type CONSOLE_PROTOCOL = (typeof CONSOLE_PROTOCOL)[keyof typeof CONSOLE_PROTOCOL]
export const CLS = {
CERTIFICATE: 'Certificate',
HOST: 'Host',
POOL: 'Pool',
PVS_PROXY: 'PVS_proxy',
SR: 'SR',
VDI: 'VDI',
VM: 'VM',
VMPP: 'VMPP',
VMSS: 'VMSS',
} as const
export type CLS = (typeof CLS)[keyof typeof CLS]
export const TUNNEL_PROTOCOL = {
GRE: 'gre',
VXLAN: 'vxlan',
} as const
export type TUNNEL_PROTOCOL = (typeof TUNNEL_PROTOCOL)[keyof typeof TUNNEL_PROTOCOL]
export const SRIOV_CONFIGURATION_MODE = {
MANUAL: 'manual',
MODPROBE: 'modprobe',
SYSFS: 'sysfs',
UNKNOWN: 'unknown',
} as const
export type SRIOV_CONFIGURATION_MODE = (typeof SRIOV_CONFIGURATION_MODE)[keyof typeof SRIOV_CONFIGURATION_MODE]
export const PGPU_DOM0_ACCESS = {
DISABLED: 'disabled',
DISABLE_ON_REBOOT: 'disable_on_reboot',
ENABLED: 'enabled',
ENABLE_ON_REBOOT: 'enable_on_reboot',
} as const
export type PGPU_DOM0_ACCESS = (typeof PGPU_DOM0_ACCESS)[keyof typeof PGPU_DOM0_ACCESS]
export const ALLOCATION_ALGORITHM = {
BREADTH_FIRST: 'breadth_first',
DEPTH_FIRST: 'depth_first',
} as const
export type ALLOCATION_ALGORITHM = (typeof ALLOCATION_ALGORITHM)[keyof typeof ALLOCATION_ALGORITHM]
export const VGPU_TYPE_IMPLEMENTATION = {
GVT_G: 'gvt_g',
MXGPU: 'mxgpu',
NVIDIA: 'nvidia',
NVIDIA_SRIOV: 'nvidia_sriov',
PASSTHROUGH: 'passthrough',
} as const
export type VGPU_TYPE_IMPLEMENTATION = (typeof VGPU_TYPE_IMPLEMENTATION)[keyof typeof VGPU_TYPE_IMPLEMENTATION]
export const PVS_PROXY_STATUS = {
CACHING: 'caching',
INCOMPATIBLE_PROTOCOL_VERSION: 'incompatible_protocol_version',
INCOMPATIBLE_WRITE_CACHE_MODE: 'incompatible_write_cache_mode',
INITIALISED: 'initialised',
STOPPED: 'stopped',
} as const
export type PVS_PROXY_STATUS = (typeof PVS_PROXY_STATUS)[keyof typeof PVS_PROXY_STATUS]
export const SDN_CONTROLLER_PROTOCOL = {
PSSL: 'pssl',
SSL: 'ssl',
} as const
export type SDN_CONTROLLER_PROTOCOL = (typeof SDN_CONTROLLER_PROTOCOL)[keyof typeof SDN_CONTROLLER_PROTOCOL]
export const VUSB_OPERATIONS = {
ATTACH: 'attach',
PLUG: 'plug',
UNPLUG: 'unplug',
} as const
export type VUSB_OPERATIONS = (typeof VUSB_OPERATIONS)[keyof typeof VUSB_OPERATIONS]
export const CLUSTER_OPERATION = {
ADD: 'add',
DESTROY: 'destroy',
DISABLE: 'disable',
ENABLE: 'enable',
REMOVE: 'remove',
} as const
export type CLUSTER_OPERATION = (typeof CLUSTER_OPERATION)[keyof typeof CLUSTER_OPERATION]
export const CLUSTER_HOST_OPERATION = {
DESTROY: 'destroy',
DISABLE: 'disable',
ENABLE: 'enable',
} as const
export type CLUSTER_HOST_OPERATION = (typeof CLUSTER_HOST_OPERATION)[keyof typeof CLUSTER_HOST_OPERATION]
export const CERTIFICATE_TYPE = {
CA: 'ca',
HOST: 'host',
HOST_INTERNAL: 'host_internal',
} as const
export type CERTIFICATE_TYPE = (typeof CERTIFICATE_TYPE)[keyof typeof CERTIFICATE_TYPE]
export const OPAQUE_REF = { EMPTY: 'OpaqueRef:NULL' } as const
export type OPAQUE_REF_NULL = (typeof OPAQUE_REF)['EMPTY']
// ----- XAPI Stats
type XapiStatsResponse<T> = {
endTimestamp: number
interval: number
stats: T
}
export type XapiStatsGranularity = 'seconds' | 'minutes' | 'hours' | 'days'
export type XapiHostStats = XapiStatsResponse<{
cpus: Record<string, number[]>
ioThroughput: {
r: Record<string, number[]>
w: Record<string, number[]>
}
iops: {
r: Record<string, number[]>
w: Record<string, number[]>
}
iowait: Record<string, number[]>
latency: {
r: Record<string, number[]>
w: Record<string, number[]>
}
load: number[]
memory: number[]
memoryFree: number[]
pifs: {
rx: Record<string, number[]>
tx: Record<string, number[]>
}
}>
export type XapiVmStats = XapiStatsResponse<{
cpus: Record<string, number[]>
iops: {
r: Record<string, number[]>
w: Record<string, number[]>
}
memory: number[]
memoryFree?: number[]
vifs: {
rx: Record<string, number[]>
tx: Record<string, number[]>
}
xvds: {
w: Record<string, number[]>
r: Record<string, number[]>
}
}>

View File

@@ -0,0 +1,3 @@
export * from './common.mjs'
export * from './xen-api.mjs'
export * from './xo.mjs'

View File

@@ -0,0 +1,7 @@
import { Branded } from '../common.mjs'
export type Task = {
id: Branded<'task'>
run: <T>(fn: () => T) => Promise<T>
}

1346
@vates/types/src/xen-api.mts Normal file

File diff suppressed because it is too large Load Diff

507
@vates/types/src/xo.mts Normal file
View File

@@ -0,0 +1,507 @@
// Types based on xapi-object-to-xo
import type {
Branded,
DOMAIN_TYPE,
HOST_ALLOWED_OPERATIONS,
HOST_POWER_STATE,
NETWORK_OPERATIONS,
POOL_ALLOWED_OPERATIONS,
STORAGE_OPERATIONS,
VDI_OPERATIONS,
VDI_TYPE,
VIF_LOCKING_MODE,
VM_OPERATIONS,
VM_POWER_STATE,
} from './common.mjs'
type BaseXapiXo = {
$pool: XoPool['id']
/**
* @deprecated use $pool instead
*/
$poolId: XoPool['id']
_xapiRef: string
uuid: string
}
type BaseXoVm = BaseXapiXo & {
$VBDs: XoVbd['id'][]
$VGPUs: XoVgpu['id'][]
$container: XoPool['id'] | XoHost['id']
CPUs: {
max: number
number: number
}
PV_args?: string
VGPUs: XoVgpu['id'][]
VIFs: XoVif['id'][]
VTPMs: XoVtpm['id'][]
addresses: Record<string, string>
affinityHost?: XoHost['id']
attachedPcis?: string[]
auto_poweron: boolean
bios_strings: Record<string, string>
blockedOperations: Record<VM_OPERATIONS, string>
boot: Record<string, string>
coresPerSocket?: number
cpuCap?: number
cpuMask?: number[]
cpuWeight?: number
creation: Record<string, string>
current_operations: Record<string, VM_OPERATIONS>
docker?: {
containers?: string[]
enabled: boolean
info?: string
/** @deprecated */
process?: string
version?: string
}
/**
* @deprecated use isNestedVirtEnabled instead
*/
expNestedHvm: boolean
isNestedVirtEnabled: boolean
hasVendorDevice: boolean
high_availability: string
installTime?: number
isFirmwareSupported: boolean
memory: {
dynamic: number[]
size: number
static: number[]
usage?: number
}
mainIpAddress?: string
managementAgentDetected?: boolean
name_description: string
name_label: string
needsVtpm: boolean
nicType?: string
notes?: string
os_version: Record<string, string> | null
other: Record<string, string>
parent?: XoVm['id']
power_state: VM_POWER_STATE
pvDriversDetected?: boolean
pvDriversUpToDate?: boolean
pvDriversVersion?: string
resourceSet?: string
secureBoot: boolean
snapshots: XoVmSnapshot['id'][]
startDelay: number
startTime?: number
suspendSr?: XoSr['id']
tags: string[]
vga?: string
videoram?: number
viridian: boolean
virtualizationMode: DOMAIN_TYPE
xenStoreData: Record<string, string>
/**
* @deprecated use pvDriversVersion instead
*/
xentools?:
| false
| {
major: null | number
minor: null | number
version: null | string
}
}
export type XoAlarm = Omit<XoMessage, '$object' | 'body'> & {
body: {
value: string
name: string
}
object: {
type: XapiXoRecord['type'] | 'unknown'
uuid: XapiXoRecord['uuid']
href?: string
}
}
export type XoGroup = {
id: Branded<'group'>
name: string
provider?: string
providerGroupId?: string
users: XoUser['id'][]
}
export type XoHost = BaseXapiXo & {
$PBDs: XoPbd['id'][]
$PCIs: XoPci['id'][]
$PGPUs: XoPgpu['id'][]
$PIFs: XoPif['id'][]
PCIs: XoPci['id'][]
PGPUs: XoPgpu['id'][]
PIFs: XoPif['id'][]
/**
* @deprecated use cpus instead
*/
CPUs: Record<string, string>
address: string
agentStartTime: null | number
bios_string: Record<string, string>
build: string
certificates?: {
fingerprint: string
notAfter: number
}[]
chipset_info: {
iommu?: boolean
}
controlDomain?: XoVm['id']
cpus: {
cores?: number
sockets?: number
}
current_operations: Record<string, HOST_ALLOWED_OPERATIONS>
enabled: boolean
hostname: string
hvmCapable: boolean
id: Branded<'host'>
iscsiIqn: string
license_expiry: null | number
license_params: Record<string, string>
license_server: Record<string, string>
logging: Record<string, string>
memory: {
size: number
/**
* @deprecated
*/
total?: number
usage: number
}
multipathing: boolean
name_description: string
name_label: string
otherConfig: Record<string, string>
/**
* @deprecated
*/
patches: XoHostPatch['id'][]
power_state: HOST_POWER_STATE
powerOnMode: string
productBrand: string
rebootRequired: boolean
residentVms: XoVm['id'][]
startTime: null | number
supplementalPacks:
| {
author: string
description: string
guidance: string
hosts: XoHost['id'][]
name: string
size: number
version: string
vdi: XoVdi['id']
}[]
| {
author: string
description: string
name: string
version: string
}[]
tags: string[]
type: 'host'
version: string
zstdSupported: boolean
}
export type XoHostPatch = BaseXapiXo & {
id: Branded<'host_patch'>
type: 'host_patch'
}
export type XoMessage = BaseXapiXo & {
$object: XapiXoRecord['id']
body: string
id: Branded<'message'>
name: string
time: number
type: 'message'
}
export type XoNetwork = BaseXapiXo & {
MTU: number
PIFs: XoPif['id'][]
VIFs: XoVif['id'][]
automatic: boolean
bridge: string
current_operations: Record<string, NETWORK_OPERATIONS>
defaultIsLocked: boolean
id: Branded<'network'>
insecureNbd?: boolean
name_description: string
name_label: string
nbd?: boolean
other_config: Record<string, string>
tags: string[]
type: 'network'
}
export type XoPbd = BaseXapiXo & {
id: Branded<'PBD'>
type: 'PBD'
}
export type XoPci = BaseXapiXo & {
id: Branded<'PCI'>
type: 'PCI'
}
export type XoPgpu = BaseXapiXo & {
id: Branded<'PGPU'>
type: 'PGPU'
}
export type XoPif = BaseXapiXo & {
id: Branded<'PIF'>
type: 'PIF'
}
export type XoPool = BaseXapiXo & {
auto_poweron: boolean
cpus: {
cores?: number
sockets?: number
}
crashDumpSr?: XoSr['id']
current_operations: Record<string, POOL_ALLOWED_OPERATIONS>
defaultSr?: XoSr['id']
HA_enabled: boolean
haSrs: XoSr['id'][]
id: Branded<'pool'>
master: XoHost['id']
migrationCompression?: boolean
name_description: string
name_label: string
otherConfig: Record<string, string>
platform_version: string
suspendSr?: XoSr['id']
tags: string[]
type: 'pool'
vtpmSupported: boolean
xosanPackInstallationTime: number | null
zstdSupported: boolean
}
export type XoJob = {
id: Branded<'job'>
}
export type XoSchedule = {
cron: string
enable: boolean
id: Branded<'schedule'>
jobId: XoJob['id']
name?: string
timezone?: string
}
export type XoServer = {
allowUnauthorized: boolean
enabled: boolean
error?: Record<string, unknown>
host: string
httpProxy?: string
id: Branded<'server'>
label?: string
poolId?: XoPool['id']
poolNameDescription?: string
poolNameLabel?: string
readOnly: boolean
status: 'connected' | 'disconnected' | 'connecting'
username: string
}
export type XoSr = BaseXapiXo & {
$PBDs: XoPbd['id'][]
$container: XoPool['id'] | XoHost['id']
VDIs: XoVdi['id'][]
allocationStrategy: 'thin' | 'thick' | 'unknown'
content_type: string
current_operations: Record<string, STORAGE_OPERATIONS>
id: Branded<'SR'>
inMaintenanceMode: boolean
name_description: string
name_label: string
other_config: Record<string, string>
physical_usage: number | null
shared: boolean
size: number | null
sm_config: Record<string, string>
SR_type: string
tags: string[]
type: 'SR'
usage: number
}
export type XoUser = {
authProviders?: Record<string, string>
email: string
groups: XoGroup['id'][]
id: Branded<'user'>
name?: string
permission: string
pw_hash?: string
preferences: Record<string, string>
}
export type XoVbd = BaseXapiXo & {
attached: boolean
bootable: boolean
device: string | null
id: Branded<'VBD'>
is_cd_drive: boolean
position: string
read_only: boolean
type: 'VBD'
VDI: XoVdi['id']
VM: XoVm['id']
}
type BaseXoVdi = BaseXapiXo & {
$SR: XoSr['id']
$VBDs: XoVbd['id'][]
VDI_type: VDI_TYPE
cbt_enabled?: boolean
current_operations: Record<string, VDI_OPERATIONS>
missing: boolean
name_description: string
name_label: string
other_config: Record<string, string>
parent?: XoVdiUnmanaged['id']
size: number
snapshots: XoVdiSnapshot['id'][]
tags: string[]
usage: number
}
export type XoVdi = BaseXoVdi & {
id: Branded<'VDI'>
type: 'VDI'
}
export type XoVdiSnapshot = BaseXoVdi & {
id: Branded<'VDI-snapshot'>
snapshot_time: number
$snapshot_of?: XoVdi['id']
type: 'VDI-snapshot'
}
export type XoVdiUnmanaged = BaseXoVdi & {
id: Branded<'VDI-unmanaged'>
type: 'VDI-unmanaged'
}
export type XoVgpu = BaseXapiXo & {
id: Branded<'VGPU'>
type: 'VGPU'
}
export type XoVif = BaseXapiXo & {
$VM: XoVm['id']
$network: XoNetwork['id']
allowedIpv4Addresses: string[]
allowedIpv6Addresses: string[]
attached: boolean
device: string
id: Branded<'VIF'>
lockingMode: VIF_LOCKING_MODE
MAC: string
MTU: number
other_config: Record<string, string>
/**
* In kB/s
*/
rateLimit?: number
txChecksumming: boolean
type: 'VIF'
}
export type XoVm = BaseXoVm & {
id: Branded<'VM'>
type: 'VM'
}
export type XoVmController = BaseXoVm & {
id: Branded<'VM-controller'>
type: 'VM-controller'
}
export type XoVmSnapshot = BaseXoVm & {
$snapshot_of: XoVm['id']
id: Branded<'VM-snapshot'>
snapshot_time: number
suspendVdi?: XoVdi['id']
type: 'VM-snapshot'
}
export type XoVmTemplate = BaseXoVm & {
id: Branded<'VM-template'>
isDefaultTemplate: boolean
template_info: {
arch?: string
disks: {
bootable: true
size: number
SR: string
type: string
}[]
install_methods: string[]
install_repository?: string
}
type: 'VM-template'
}
export type XoVtpm = BaseXapiXo & {
id: Branded<'VTPM'>
type: 'VTPM'
}
export type XapiXoRecord =
| XoAlarm
| XoHost
| XoMessage
| XoNetwork
| XoPool
| XoSr
| XoVbd
| XoVdi
| XoVdiSnapshot
| XoVdiUnmanaged
| XoVgpu
| XoVif
| XoVm
| XoVmController
| XoVmSnapshot
| XoVmTemplate
| XoVtpm
export type NonXapiXoRecord = XoGroup | XoJob | XoSchedule | XoServer | XoUser
export type XoRecord = XapiXoRecord | NonXapiXoRecord

View File

@@ -0,0 +1,12 @@
{
"compilerOptions": {
"outDir": "./dist",
"declaration": true,
"strict": true,
"module": "ESNext",
"target": "ES2022",
"skipLibCheck": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}

View File

@@ -98,6 +98,17 @@ class AuditCore {
return record
}
async _importRecord(record) {
if (!record.id || !record.previousId) {
throw new Error('Invalid record')
}
await this._storage.put(record)
return {
id: record.id,
isValid: record.id === createHash(record),
}
}
async checkIntegrity(oldest, newest) {
const storage = this._storage

View File

@@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"version": "0.3.1",
"version": "0.4.0",
"engines": {
"node": ">=14"
},

View File

@@ -7,8 +7,8 @@
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"dependencies": {
"@xen-orchestra/async-map": "^0.1.2",
"@xen-orchestra/backups": "^0.56.0",
"@xen-orchestra/fs": "^4.3.0",
"@xen-orchestra/backups": "^0.59.0",
"@xen-orchestra/fs": "^4.5.0",
"filenamify": "^6.0.0",
"getopts": "^2.2.5",
"lodash": "^4.17.15",
@@ -27,7 +27,7 @@
"scripts": {
"postversion": "npm publish --access public"
},
"version": "1.0.27",
"version": "1.0.30",
"license": "AGPL-3.0-or-later",
"author": {
"name": "Vates SAS",

View File

@@ -0,0 +1,10 @@
## Changing the default backup configuration
This library receives a backup configuration from `xo-server` or `xo-proxy`. This configuration is split between multiple properties:
- `config` contains values related to the general backup configuration
- `config.defaultSettings`, `config.vm.defaultSettings` and `config.metadata.defaultSettings` contain values related to backup jobs default settings:
- `config.vm.defaultSettings` is related to VM backup jobs (see [DEFAULT_XAPI_VM_SETTINGS](https://github.com/vatesfr/xen-orchestra/blob/568e14f7eec7c3ddf685d324ad4733a3ef577995/%40xen-orchestra/backups/_runners/VmsRemote.mjs#L15))
- `config.metadata.defaultSettings` is related to metadata backup jobs (see [DEFAULT_METADATA_SETTINGS](https://github.com/vatesfr/xen-orchestra/blob/568e14f7eec7c3ddf685d324ad4733a3ef577995/%40xen-orchestra/backups/_runners/Metadata.mjs#L12))
- `config.defaultSettings` is related to all backup jobs (see [DEFAULT_SETTINGS](https://github.com/vatesfr/xen-orchestra/blob/568e14f7eec7c3ddf685d324ad4733a3ef577995/%40xen-orchestra/backups/_runners/_Abstract.mjs#L7))
- in case of duplicate value, `config.vm.defaultSettings` and `config.metadata.defaultSettings` will prevail over `config.defaultSettings`, and a defined job setting will prevail over any `defaultSettings`

View File

@@ -257,7 +257,14 @@ export class ImportVmBackup {
: await importIncrementalVm(backup, await xapi.getRecord('SR', srRef), {
newMacAddresses,
})
const remoteName = adapter._handler._remote.name
let desc = `Restored on ${formatFilenameDate(+new Date())}`
if (remoteName !== undefined) {
desc += ` from ${remoteName}`
}
if (metadata.vm.name_description) {
desc += ` - ${metadata.vm.name_description}`
}
await Promise.all([
xapi.call('VM.add_tags', vmRef, 'restored from backup'),
xapi.call(
@@ -265,13 +272,7 @@ export class ImportVmBackup {
vmRef,
`${metadata.vm.name_label} (${formatFilenameDate(metadata.timestamp)})`
),
xapi.call(
'VM.set_name_description',
vmRef,
`Restored on ${formatFilenameDate(+new Date())} from ${adapter._handler._remote.name} -
${metadata.vm.name_description}
`
),
xapi.call('VM.set_name_description', vmRef, desc),
])
return {

View File

@@ -12,6 +12,19 @@ Installation of the [npm package](https://npmjs.org/package/@xen-orchestra/backu
npm install --save @xen-orchestra/backups
```
## Usage
## Changing the default backup configuration
This library receives a backup configuration from `xo-server` or `xo-proxy`. This configuration is split between multiple properties:
- `config` contains values related to the general backup configuration
- `config.defaultSettings`, `config.vm.defaultSettings` and `config.metadata.defaultSettings` contain values related to backup jobs default settings:
- `config.vm.defaultSettings` is related to VM backup jobs (see [DEFAULT_XAPI_VM_SETTINGS](https://github.com/vatesfr/xen-orchestra/blob/568e14f7eec7c3ddf685d324ad4733a3ef577995/%40xen-orchestra/backups/_runners/VmsRemote.mjs#L15))
- `config.metadata.defaultSettings` is related to metadata backup jobs (see [DEFAULT_METADATA_SETTINGS](https://github.com/vatesfr/xen-orchestra/blob/568e14f7eec7c3ddf685d324ad4733a3ef577995/%40xen-orchestra/backups/_runners/Metadata.mjs#L12))
- `config.defaultSettings` is related to all backup jobs (see [DEFAULT_SETTINGS](https://github.com/vatesfr/xen-orchestra/blob/568e14f7eec7c3ddf685d324ad4733a3ef577995/%40xen-orchestra/backups/_runners/_Abstract.mjs#L7))
- in case of duplicate value, `config.vm.defaultSettings` and `config.metadata.defaultSettings` will prevail over `config.defaultSettings`, and a defined job setting will prevail over any `defaultSettings`
## Contributions
Contributions are _very_ welcomed, either on the documentation or on

View File

@@ -423,12 +423,20 @@ export class RemoteAdapter {
async listAllVms() {
const handler = this._handler
const vmsUuids = []
await asyncEach(await handler.list(BACKUP_DIR), async entry => {
// ignore hidden and lock files
if (entry[0] !== '.' && !entry.endsWith('.lock')) {
vmsUuids.push(entry)
try {
await asyncEach(await handler.list(BACKUP_DIR), async entry => {
// ignore hidden and lock files
if (entry[0] !== '.' && !entry.endsWith('.lock')) {
vmsUuids.push(entry)
}
})
} catch (error) {
// remote without any VM backup are ok
if (error.code !== 'ENOENT') {
throw error
}
})
}
return vmsUuids
}
@@ -700,7 +708,11 @@ export class RemoteAdapter {
}
}
async outputStream(path, input, { checksum = true, maxStreamLength, streamLength, validator = noop } = {}) {
async outputStream(
path,
input,
{ checksum = !this._handler.isEncrypted, maxStreamLength, streamLength, validator = noop } = {}
) {
const container = watchStreamSize(input)
await this._handler.outputStream(path, input, {
checksum,

View File

@@ -288,8 +288,7 @@ test('it finish unterminated merge ', async () => {
// each of the vhd can be a file, a directory, an alias to a file or an alias to a directory
// the message an resulting files should be identical to the output with vhd files which is tested independantly
describe('tests multiple combination ', () => {
describe('tests multiple combination ', { concurrency: 1 }, () => {
for (const useAlias of [true, false]) {
for (const vhdMode of ['file', 'directory']) {
test(`alias : ${useAlias}, mode: ${vhdMode}`, async () => {
@@ -431,7 +430,6 @@ describe('tests multiple combination ', () => {
}
}
})
test('it cleans orphan merge states ', async () => {
await handler.writeFile(`${basePath}/.orphan.vhd.merge.json`, '')

View File

@@ -129,10 +129,29 @@ export async function checkAliases(
logWarn('missing target of alias', { alias })
if (remove) {
logInfo('removing alias and non VHD target', { alias, target })
await handler.unlink(target)
await handler.unlink(alias)
}
continue
}
if (err.code === 'EISDIR') {
logWarn('alias is a vhd directory', { alias })
if (remove) {
logInfo('removing vhd directory named as alias', { alias, target })
await VhdAbstract.unlink(handler, alias)
}
continue
}
logWarn('unhandled error while checking alias', { alias, err })
continue
}
if (target === '') {
logWarn('empty target for alias ', { alias })
if (remove) {
logInfo('removing alias and non VHD target', { alias, target })
await handler.unlink(alias)
}
continue
}
if (!isVhdFile(target)) {
@@ -575,7 +594,7 @@ export async function cleanVm(
if (mergedSize) {
// all disks are now key disk
metadata.isVhdDifferencing = {}
for (const id of Object.values(metadata.vdis ?? {})) {
for (const id of Object.keys(metadata.vdis ?? {})) {
metadata.isVhdDifferencing[`${id}.vhd`] = false
}
}

View File

@@ -27,7 +27,7 @@ const LTR_DEFINITIONS = {
copy.date(date.date() - firstDayOfWeek)
// warning, the year in term of week may different from YYYY
// since the computation of the first week of a year is timezone dependant
return copy.format('gggg-WW')
return copy.format('gggg-ww')
}
},
ancestor: 'daily',

View File

@@ -11,7 +11,6 @@ import { MixinXapiWriter } from './_MixinXapiWriter.mjs'
import { listReplicatedVms } from './_listReplicatedVms.mjs'
import { COPY_OF, setVmOtherConfig, BASE_DELTA_VDI } from '../../_otherConfig.mjs'
import assert from 'node:assert'
export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWriter) {
async checkBaseVdis(baseUuidToSrcVdi) {
const sr = this._sr
@@ -118,9 +117,10 @@ export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWr
const baseReplicatedTo = replicatedVdis.find(
replicatedVdi => replicatedVdi.other_config[COPY_OF] === vdi.other_config[BASE_DELTA_VDI]
)
assert.notStrictEqual(baseReplicatedTo, undefined)
// baseReplicatedTo can be undefined if a new disk is added and other are already replicated
vdi.baseVdi = baseReplicatedTo
} else {
// first replication of this disk
vdi.baseVdi = undefined
}
// ensure the VDI are created on the target SR

View File

@@ -29,7 +29,7 @@
│ └─ <YYYYMMDD>T<HHmmss>.vhd
├─ <YYYYMMDD>T<HHmmss>.json // backup metadata
├─ <YYYYMMDD>T<HHmmss>.xva
└─ <YYYYMMDD>T<HHmmss>.xva.checksum
└─ <YYYYMMDD>T<HHmmss>.xva.checksum // only on backup before 01/02/2025 or non encrypted
```
### with vhd directories

View File

@@ -8,7 +8,7 @@
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"version": "0.56.0",
"version": "0.59.0",
"engines": {
"node": ">=14.18"
},
@@ -28,7 +28,7 @@
"@vates/nbd-client": "^3.1.2",
"@vates/parse-duration": "^0.1.1",
"@xen-orchestra/async-map": "^0.1.2",
"@xen-orchestra/fs": "^4.3.0",
"@xen-orchestra/fs": "^4.5.0",
"@xen-orchestra/log": "^0.7.1",
"@xen-orchestra/template": "^0.1.0",
"app-conf": "^3.0.0",
@@ -48,8 +48,8 @@
"tar": "^6.1.15",
"uuid": "^9.0.0",
"value-matcher": "^0.2.0",
"vhd-lib": "^4.11.2",
"xen-api": "^4.6.0",
"vhd-lib": "^4.11.3",
"xen-api": "^4.7.1",
"yazl": "^2.5.1"
},
"devDependencies": {
@@ -59,7 +59,7 @@
"tmp": "^0.2.1"
},
"peerDependencies": {
"@xen-orchestra/xapi": "^7.8.1"
"@xen-orchestra/xapi": "^8.1.1"
},
"license": "AGPL-3.0-or-later",
"author": {

View File

@@ -4,10 +4,22 @@ import { fork } from 'child_process'
const { warn } = createLogger('xo:backups:backupWorker')
const PATH = new URL('_backupWorker.mjs', import.meta.url).pathname
const DEFAULT_INSPECTOR_PORT = 9229
export function runBackupWorker(params, onLog) {
return new Promise((resolve, reject) => {
const worker = fork(PATH)
// run Node inspector on port+1 if --inspect or --inspect-brk
const inspectArg = process.execArgv.find(arg => arg.startsWith('--inspect') || arg.startsWith('--inspect-brk'))
const execArgv = inspectArg
? [
inspectArg.replace(/^(--inspect(-brk)?)(=([^:]+:)?(\d+))?$/, (_, prefix, brk, _fullMatch, host, port) => {
const basePort = port ? parseInt(port) : DEFAULT_INSPECTOR_PORT
return `${prefix}=${host || ''}${basePort + 1}`
}),
]
: []
const worker = fork(PATH, [], { execArgv })
worker.on('exit', (code, signal) => reject(new Error(`worker exited with code ${code} and signal ${signal}`)))
worker.on('error', reject)

View File

@@ -18,7 +18,7 @@
"preferGlobal": true,
"dependencies": {
"golike-defer": "^0.5.1",
"xen-api": "^4.6.0"
"xen-api": "^4.7.1"
},
"scripts": {
"postversion": "npm publish"

View File

@@ -1,7 +1,7 @@
{
"private": false,
"name": "@xen-orchestra/fs",
"version": "4.3.0",
"version": "4.5.0",
"license": "AGPL-3.0-or-later",
"description": "The File System for Xen Orchestra backups.",
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/fs",

View File

@@ -2,8 +2,11 @@ const { pipeline } = require('node:stream')
const { readChunk } = require('@vates/read-chunk')
const crypto = require('crypto')
export const DEFAULT_ENCRYPTION_ALGORITHM = 'aes-256-gcm'
const CHACHA20 = 'chacha20-poly1305'
const AES256 = 'aes-256-gcm'
export const DEFAULT_ENCRYPTION_ALGORITHM = CHACHA20
export const UNENCRYPTED_ALGORITHM = 'none'
export const SUPPORTED_ALGORITHM = new Set([UNENCRYPTED_ALGORITHM, AES256, CHACHA20, DEFAULT_ENCRYPTION_ALGORITHM])
export function isLegacyEncryptionAlgorithm(algorithm) {
return algorithm !== UNENCRYPTED_ALGORITHM && algorithm !== DEFAULT_ENCRYPTION_ALGORITHM
@@ -33,7 +36,7 @@ function getEncryptor(algorithm = DEFAULT_ENCRYPTION_ALGORITHM, key) {
throw error
}
const { ivLength, mode } = info
const authTagLength = ['gcm', 'ccm', 'ocb'].includes(mode) ? 16 : 0
const authTagLength = ['gcm', 'ccm', 'ocb'].includes(mode) || algorithm === CHACHA20 ? 16 : 0
function encryptStream(input) {
return pipeline(

View File

@@ -638,7 +638,13 @@ export default class RemoteHandlerAbstract {
// Unlink dir behavior is not consistent across platforms
// https://github.com/nodejs/node-v0.x-archive/issues/5791
if (error.code === 'EISDIR' || error.code === 'EPERM') {
return this._rmtree(`${dir}/${file}`)
return this._rmtree(`${dir}/${file}`).catch(rmTreeError => {
if (rmTreeError.code === 'ENOTDIR') {
// this was realy a EPERM error, maybe with immutable backups
throw error
}
throw rmTreeError
})
}
throw error
},

View File

@@ -72,6 +72,10 @@ export default class S3Handler extends RemoteHandlerAbstract {
keepAlive: true,
}),
}),
// from https://github.com/aws/aws-sdk-js-v3/issues/6810
// some non AWS services like backblaze or cloudflare don't expect the new headers
requestChecksumCalculation: 'WHEN_REQUIRED',
responseChecksumValidation: 'WHEN_REQUIRED',
})
const parts = split(path)

View File

@@ -17,19 +17,19 @@
"xo-lift-remote-immutability": "./liftProtection.mjs"
},
"license": "AGPL-3.0-or-later",
"version": "1.0.15",
"version": "1.0.19",
"engines": {
"node": ">=14.0.0"
},
"dependencies": {
"@vates/async-each": "^1.0.0",
"@xen-orchestra/backups": "^0.56.0",
"@xen-orchestra/backups": "^0.59.0",
"@xen-orchestra/log": "^0.7.1",
"app-conf": "^3.0.0",
"chokidar": "^3.5.3",
"chokidar": "^3.6.0",
"execa": "^5.0.0",
"ms": "^2.1.3",
"vhd-lib": "^4.11.2"
"vhd-lib": "^4.11.3"
},
"devDependencies": {
"rimraf": "^5.0.5",

View File

@@ -2,7 +2,40 @@
## **next**
- [Host/Header] Add master host icon on host header (PR [#8512](https://github.com/vatesfr/xen-orchestra/pull/8512))
- [Host] Add dashboard view (PR [#8504](https://github.com/vatesfr/xen-orchestra/pull/8504))
- [VM/New] Add topology field in VM creation (PR [#8491](https://github.com/vatesfr/xen-orchestra/pull/8491))
## **0.9.1** (2025-04-02)
- Fix blank page in production mode (PR [#8471](https://github.com/vatesfr/xen-orchestra/pull/8471))
## **0.9.0** (2025-03-31)
- [VM/New]: Add VM creation page and form (PR [#8317](https://github.com/vatesfr/xen-orchestra/pull/8317))
- [VM/Network]: Display vifs list in vm view and vifs information in side panel (PR [#8441](https://github.com/vatesfr/xen-orchestra/pull/8441))
## **0.8.0** (2025-02-27)
- [i18n] Add Swedish, update Czech and Spanish translations (contributions made by [@xiscoj](https://github.com/xiscoj), [@p-bo](https://github.com/p-bo) and [Jonas](https://translate.vates.tech/user/Jonas/)) (PR [#8294](https://github.com/vatesfr/xen-orchestra/pull/8294))
- [i18n] Merge XO Lite translations files into one file in web-core ([PR #8380](https://github.com/vatesfr/xen-orchestra/pull/8380))
- [Pool/Network]: Display networks and host internal networks information in side panel (PR [#8150](https://github.com/vatesfr/xen-orchestra/pull/8150))
- [Host/Network]: Display pifs information in side panel (PR [#8186](https://github.com/vatesfr/xen-orchestra/pull/8186))
## **0.7.1** (2025-02-04)
- [Host/Console] Fix console sometimes not correctly displayed (PR [#8305](https://github.com/vatesfr/xen-orchestra/pull/8305))
## **0.7.0** (2025-01-30)
- Fix persistent scrollbar on the right (PR [#8191](https://github.com/vatesfr/xen-orchestra/pull/8191))
- [Console]: Displays a loader when the console is loading (PR [#8226](https://github.com/vatesfr/xen-orchestra/pull/8226))
- [i18n] Add Spanish translation (contribution made by [@DSJ2](https://github.com/DSJ2)) (PR [#8220](https://github.com/vatesfr/xen-orchestra/pull/8220))
- [Console]: Adding a border when console is focused (PR [#8235](https://github.com/vatesfr/xen-orchestra/pull/8235))
- [Pool/Network]: Display networks and host internal networks lists in pool view (PR [#8147](https://github.com/vatesfr/xen-orchestra/pull/8147))
- [Host/Network]: Display pifs list in host view (PR [#8180](https://github.com/vatesfr/xen-orchestra/pull/8180))
- [Host/Network]: Fix issue with wording in host pif table (PR [8285](https://github.com/vatesfr/xen-orchestra/pull/8285))
- [Pool/Network]: Fix issue with network status (PR [#8284](https://github.com/vatesfr/xen-orchestra/pull/8284))
## **0.6.0** (2024-11-29)

View File

@@ -1,6 +1,6 @@
{
"name": "@xen-orchestra/lite",
"version": "0.6.0",
"version": "0.9.1",
"type": "module",
"scripts": {
"dev": "GIT_HEAD=$(git rev-parse HEAD) vite",
@@ -14,31 +14,33 @@
"type-check": "vue-tsc --build --force tsconfig.type-check.json"
},
"devDependencies": {
"@csstools/postcss-global-data": "^2.1.1",
"@floating-ui/vue": "^1.1.5",
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-regular-svg-icons": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/vue-fontawesome": "^3.0.5",
"@intlify/unplugin-vue-i18n": "^2.0.0",
"@novnc/novnc": "^1.4.0",
"@tsconfig/node18": "^18.2.2",
"@csstools/postcss-global-data": "^3.0.0",
"@floating-ui/vue": "^1.1.6",
"@fontsource/poppins": "^5.2.5",
"@fortawesome/fontawesome-svg-core": "^6.7.2",
"@fortawesome/free-regular-svg-icons": "^6.7.2",
"@fortawesome/free-solid-svg-icons": "^6.7.2",
"@fortawesome/vue-fontawesome": "^3.0.8",
"@intlify/unplugin-vue-i18n": "^6.0.3",
"@novnc/novnc": "~1.5.0",
"@tsconfig/node18": "^18.2.4",
"@types/d3-time-format": "^4.0.3",
"@types/file-saver": "^2.0.7",
"@types/lodash-es": "^4.17.12",
"@types/node": "^18.19.7",
"@vitejs/plugin-vue": "^5.1.4",
"@vue/tsconfig": "^0.5.1",
"@vueuse/core": "^10.7.1",
"@vueuse/math": "^10.7.1",
"@vueuse/shared": "^10.7.1",
"@xen-orchestra/web-core": "^0.8.0",
"@types/node": "^18.19.80",
"@vates/types": "^1.2.0",
"@vitejs/plugin-vue": "^5.2.1",
"@vue/tsconfig": "^0.7.0",
"@vueuse/core": "^13.0.0",
"@vueuse/math": "^13.0.0",
"@vueuse/shared": "^13.0.0",
"@xen-orchestra/web-core": "^0.19.0",
"complex-matcher": "^0.7.1",
"d3-time-format": "^4.1.0",
"decorator-synchronized": "^0.6.0",
"echarts": "^5.4.3",
"file-saver": "^2.0.5",
"highlight.js": "^11.9.0",
"golike-defer": "^0.5.1",
"highlight.js": "^11.11.1",
"human-format": "^1.2.1",
"iterable-backoff": "^0.1.0",
"json-rpc-2.0": "^1.7.0",
@@ -46,22 +48,21 @@
"limit-concurrency-decorator": "^0.6.0",
"lodash-es": "^4.17.21",
"make-error": "^1.3.6",
"marked": "^9.1.5",
"marked": "^15.0.7",
"minimist": "^1.2.8",
"npm-run-all": "^4.1.5",
"pinia": "^2.2.6",
"pinia": "^3.0.1",
"placement.js": "^1.0.0-beta.5",
"postcss": "^8.4.33",
"postcss": "^8.5.3",
"postcss-color-function": "^4.1.0",
"postcss-custom-media": "^10.0.2",
"postcss-nested": "^6.0.1",
"typescript": "~5.6.3",
"vite": "^5.4.10",
"vue": "~3.5.12",
"vue-echarts": "^6.6.8",
"vue-i18n": "^9.9.0",
"vue-router": "^4.4.0",
"vue-tsc": "^2.1.10",
"postcss-custom-media": "^11.0.5",
"postcss-nested": "^7.0.2",
"typescript": "~5.8.2",
"vite": "^6.2.1",
"vue": "~3.5.13",
"vue-i18n": "^11.1.2",
"vue-router": "^4.5.0",
"vue-tsc": "~2.2.8",
"zx": "^7.2.3"
},
"private": true,

View File

@@ -138,6 +138,17 @@ const ghApiUploadReleaseAsset = async (releaseId, assetName, file) => {
return JSON.parse(await res.text())
}
const getChangelogForVersion = async (version, changelogPath = './CHANGELOG.md') => {
const changelog = await fs.readFile(changelogPath, 'utf8')
const escapeRegex = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
const escapedVersion = escapeRegex(version)
const versionRegex = new RegExp(`## \\*\\*${escapedVersion}\\*\\*.*?(?=\\n## \\*\\*|$)`, 's')
const match = changelog.match(versionRegex)
return match ? match[0].trim() : undefined
}
// Validate args and assign defaults -------------------------------------------
const headSha = (await $`git rev-parse HEAD`).stdout.trim()
@@ -331,22 +342,31 @@ if (ghRelease) {
let release = (await ghApiCall('/releases')).find(release => release.tag_name === tag)
if (release !== undefined) {
if (
release !== undefined &&
(await no(
`Release with tag ${tag} already exists on GitHub (${chalk.blue(
release.html_url
)}). Skip and proceed with upload?`
))
) {
stop()
}
if (release === undefined) {
const releaseNotes = await getChangelogForVersion(version)
if (
await no(
`Release with tag ${tag} already exists on GitHub (${chalk.blue(
release.html_url
)}). Skip and proceed with upload?`
)
releaseNotes === undefined &&
(await no(`Could not find changelog for version ${version}. Create release without changelog?`))
) {
stop()
}
} else {
release = await ghApiCall('/releases', 'POST', {
tag_name: tag,
target_commitish: headSha,
name: tag,
draft: true,
body: releaseNotes,
})
console.log(`Created GitHub release ${tag}: ${chalk.blue(release.html_url)}`)

View File

@@ -20,14 +20,15 @@ import AppHeader from '@/components/AppHeader.vue'
import AppLogin from '@/components/AppLogin.vue'
import AppNavigation from '@/components/AppNavigation.vue'
import ModalList from '@/components/ui/modals/ModalList.vue'
import { useChartTheme } from '@/composables/chart-theme.composable'
import { useUnreachableHosts } from '@/composables/unreachable-hosts.composable'
import { usePoolStore } from '@/stores/xen-api/pool.store'
import { useXenApiStore } from '@/stores/xen-api.store'
import VtsTooltipList from '@core/components/tooltip-list/VtsTooltipList.vue'
import { useChartTheme } from '@core/composables/chart-theme.composable'
import { useUiStore } from '@core/stores/ui.store'
import { useActiveElement, useMagicKeys, whenever } from '@vueuse/core'
import { logicAnd } from '@vueuse/math'
import { getActivePinia } from 'pinia'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRoute } from 'vue-router'
@@ -38,8 +39,13 @@ const xenApiStore = useXenApiStore()
const { pool } = usePoolStore().subscribe()
useChartTheme()
const uiStore = useUiStore()
// workaround
// since this commit https://github.com/vatesfr/xen-orchestra/commit/ac2f4e9f32beee27ce4d14ad0d4ce7d9c51a1d82
// useUiStore is unable to find the pinia instance itself.
const pinia = getActivePinia()
const uiStore = useUiStore(pinia)
useChartTheme(pinia)
// end workaround
if (import.meta.env.DEV) {
const { locale } = useI18n()

View File

@@ -1,14 +1,14 @@
<template>
<header class="app-header">
<UiIcon v-if="isMobile" ref="navigationTrigger" :icon="faBars" class="toggle-navigation" />
<UiIcon v-if="uiStore.isMobile" ref="navigationTrigger" :icon="faBars" class="toggle-navigation" />
<RouterLink :to="{ name: 'home' }">
<img v-if="isMobile" alt="XO Lite" src="../assets/logo.svg" />
<img v-if="uiStore.isMobile" alt="XO Lite" src="../assets/logo.svg" />
<TextLogo v-else />
</RouterLink>
<slot />
<div class="right">
<PoolOverrideWarning as-tooltip />
<XoaButton v-if="isDesktop" />
<XoaButton v-if="uiStore.isDesktop" />
<AccountMenu />
</div>
</header>
@@ -26,7 +26,6 @@ import { faBars } from '@fortawesome/free-solid-svg-icons'
import { storeToRefs } from 'pinia'
const uiStore = useUiStore()
const { isMobile, isDesktop } = storeToRefs(uiStore)
const navigationStore = useNavigationStore()
const { trigger: navigationTrigger } = storeToRefs(navigationStore)

View File

@@ -27,7 +27,7 @@
<FormCheckbox v-model="rememberMe" />
{{ $t('keep-me-logged') }}
</label>
<UiButton size="medium" accent="info" variant="primary" type="submit" :busy="isConnecting">
<UiButton size="medium" accent="brand" variant="primary" type="submit" :busy="isConnecting">
{{ $t('login') }}
</UiButton>
</template>

View File

@@ -1,6 +1,11 @@
<template>
<Transition name="slide">
<nav v-if="isDesktop || isOpen" ref="navElement" :class="{ collapsible: isMobile }" class="app-navigation">
<nav
v-if="uiStore.isDesktop || isOpen"
ref="navElement"
:class="{ collapsible: uiStore.isMobile }"
class="app-navigation"
>
<StoryMenu v-if="route.meta.hasStoryNav" />
<InfraPoolList v-else />
</nav>
@@ -20,7 +25,6 @@ import { useRoute } from 'vue-router'
const route = useRoute()
const uiStore = useUiStore()
const { isMobile, isDesktop } = storeToRefs(uiStore)
const navigationStore = useNavigationStore()
const { isOpen, trigger } = storeToRefs(navigationStore)
@@ -36,6 +40,7 @@ whenever(isOpen, () => {
},
{
ignore: [trigger],
controls: false,
}
)
})

View File

@@ -68,7 +68,7 @@ const isIcon = (maybeIcon: any): maybeIcon is IconDefinition => typeof maybeIcon
gap: 0.1rem;
&:focus-within {
outline: 1px solid var(--color-info-item-active);
outline: 1px solid var(--color-brand-item-active);
}
}
@@ -78,7 +78,7 @@ const isIcon = (maybeIcon: any): maybeIcon is IconDefinition => typeof maybeIcon
}
.form-widget:hover .widget {
border-color: var(--color-info-item-hover);
border-color: var(--color-brand-item-hover);
}
.element {

View File

@@ -1,5 +1,5 @@
<template>
<div v-if="error !== undefined" class="error typo p2-regular">
<div v-if="error !== undefined" class="error typo-body-regular-small">
<UiIcon :icon="faExclamationCircle" />
<span v-if="error.message === 'SESSION_AUTHENTICATION_FAILED'">
{{ $t('password-invalid') }}

View File

@@ -1,7 +1,7 @@
<template>
<div class="no-data">
<img alt="" class="img" src="@/assets/undraw-bug-fixing.svg" />
<p class="text-error typo h4-medium">{{ $t('error-no-data') }}</p>
<p class="text-error typo-h4">{{ $t('error-no-data') }}</p>
</div>
</template>
@@ -18,6 +18,7 @@
width: 17em;
height: 13em;
}
.text-error {
margin: auto;
width: 8em;

View File

@@ -27,6 +27,6 @@
font-weight: 500;
font-size: 2rem;
line-height: 150%;
color: var(--color-info-txt-base);
color: var(--color-brand-txt-base);
}
</style>

View File

@@ -33,7 +33,7 @@ const isRecordNotFound = computed(() => props.isReady && !props.uuidChecker(id.v
}
.spinner {
color: var(--color-info-txt-base);
color: var(--color-brand-txt-base);
display: flex;
margin: auto;
width: 10rem;

View File

@@ -4,7 +4,7 @@
:subtitle="$t('new-features-are-coming')"
:title="$t('xo-lite-under-construction')"
>
<p class="contact typo p1-regular">
<p class="contact typo-body-regular">
{{ $t('do-you-have-needs') }}
<a
href="https://xcp-ng.org/forum/topic/5018/xo-lite-building-an-embedded-ui-in-xcp-ng"

View File

@@ -26,7 +26,7 @@ const className = computed(() => `state-${props.state.toLocaleLowerCase()}`)
<style lang="postcss" scoped>
.power-state-icon {
color: var(--color-info-txt-item);
color: var(--color-brand-txt-item);
&.state-running {
color: var(--color-success-item-base);
@@ -37,7 +37,7 @@ const className = computed(() => `state-${props.state.toLocaleLowerCase()}`)
}
&.state-suspended {
color: var(--color-info-txt-hover);
color: var(--color-brand-txt-hover);
}
&.state-halted {

View File

@@ -3,8 +3,8 @@
</template>
<script lang="ts" setup>
import useRelativeTime from '@/composables/relative-time.composable'
import { parseDateTime } from '@/libs/utils'
import useRelativeTime from '@core/composables/relative-time.composable'
import { useNow } from '@vueuse/core'
import { computed } from 'vue'

View File

@@ -1,125 +0,0 @@
<template>
<div ref="vmConsoleContainer" class="vm-console" />
</template>
<script lang="ts" setup>
import { useXenApiStore } from '@/stores/xen-api.store'
import VncClient from '@novnc/novnc/lib/rfb'
import { promiseTimeout } from '@vueuse/shared'
import { fibonacci } from 'iterable-backoff'
import { computed, onBeforeUnmount, ref, watchEffect } from 'vue'
const props = defineProps<{
location: string
isConsoleAvailable: boolean
}>()
const N_TOTAL_TRIES = 8
const FIBONACCI_MS_ARRAY: number[] = Array.from(fibonacci().toMs().take(N_TOTAL_TRIES))
const vmConsoleContainer = ref<HTMLDivElement>()
const xenApiStore = useXenApiStore()
const url = computed(() => {
if (xenApiStore.currentSessionId == null) {
return
}
const _url = new URL(props.location)
_url.protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
_url.searchParams.set('session_id', xenApiStore.currentSessionId)
return _url
})
let vncClient: VncClient | undefined
let nConnectionAttempts = 0
function handleDisconnectionEvent() {
clearVncClient()
if (props.isConsoleAvailable) {
nConnectionAttempts++
if (nConnectionAttempts > N_TOTAL_TRIES) {
console.error('The number of reconnection attempts has been exceeded for:', props.location)
return
}
console.error(
`Connection lost for the remote console: ${props.location}. New attempt in ${
FIBONACCI_MS_ARRAY[nConnectionAttempts - 1]
}ms`
)
createVncConnection()
}
}
function handleConnectionEvent() {
nConnectionAttempts = 0
}
function clearVncClient() {
if (vncClient === undefined) {
return
}
vncClient.removeEventListener('disconnect', handleDisconnectionEvent)
vncClient.removeEventListener('connect', handleConnectionEvent)
vncClient.disconnect()
vncClient = undefined
}
async function createVncConnection() {
if (nConnectionAttempts !== 0) {
await promiseTimeout(FIBONACCI_MS_ARRAY[nConnectionAttempts - 1])
if (vncClient !== undefined) {
// New VNC Client may have been created in the meantime
return
}
}
vncClient = new VncClient(vmConsoleContainer.value!, url.value!.toString(), {
wsProtocols: ['binary'],
})
vncClient.scaleViewport = true
vncClient.addEventListener('disconnect', handleDisconnectionEvent)
vncClient.addEventListener('connect', handleConnectionEvent)
}
watchEffect(() => {
if (url.value === undefined || vmConsoleContainer.value === undefined || !props.isConsoleAvailable) {
return
}
nConnectionAttempts = 0
clearVncClient()
createVncConnection()
})
onBeforeUnmount(() => {
clearVncClient()
})
defineExpose({
sendCtrlAltDel: () => vncClient?.sendCtrlAltDel(),
})
</script>
<style lang="postcss" scoped>
.vm-console {
flex: 1;
max-width: 100%;
& > :deep(div) {
background-color: transparent !important;
}
/* Required because the library adds "margin: auto" to the canvas which makes the canvas centered in space and not aligned to the rest of the layout */
:deep(canvas) {
margin: 0 auto !important;
}
}
</style>

View File

@@ -13,17 +13,13 @@
<script lang="ts" setup>
import TabItem from '@core/components/tab/TabItem.vue'
import { useContext } from '@core/composables/context.composable'
import { DisabledContext } from '@core/context'
import { useDisabled } from '@core/composables/disabled.composable'
import type { RouteLocationRaw } from 'vue-router'
const props = withDefaults(
defineProps<{
to: RouteLocationRaw
disabled?: boolean
}>(),
{ disabled: undefined }
)
const props = defineProps<{
to: RouteLocationRaw
disabled?: boolean
}>()
const isDisabled = useContext(DisabledContext, () => props.disabled)
const isDisabled = useDisabled(() => props.disabled)
</script>

View File

@@ -1,7 +1,7 @@
<template>
<div class="title-bar">
<UiIcon :icon class="icon" />
<div class="title typo h4-medium">
<div class="title typo-h4">
<slot />
</div>
<div class="actions">
@@ -36,7 +36,7 @@ defineProps<{
.icon {
font-size: 2.5rem;
color: var(--color-info-txt-base);
color: var(--color-brand-txt-base);
}
.title {

View File

@@ -60,20 +60,20 @@ const computedData = computed(() => {
}
.progress-item:nth-child(1) {
--progress-bar-color: var(--color-info-txt-item);
--progress-bar-color: var(--color-brand-txt-item);
}
.progress-item:nth-child(2) {
--progress-bar-color: var(--color-info-txt-active);
--progress-bar-color: var(--color-brand-txt-active);
}
.progress-item:nth-child(3) {
--progress-bar-color: var(--color-info-txt-hover);
--progress-bar-color: var(--color-brand-txt-hover);
}
.progress-item {
--progress-bar-height: 1.2rem;
--progress-bar-color: var(--color-info-item-hover);
--progress-bar-color: var(--color-brand-item-hover);
--progress-bar-background-color: var(--color-neutral-background-disabled);
&.warning {

View File

@@ -2,7 +2,7 @@
<UiButton
v-if="xoaFound"
size="medium"
accent="info"
accent="brand"
variant="primary"
:left-icon="faArrowUpRightFromSquare"
class="xoa-button"
@@ -13,7 +13,7 @@
<UiButton
v-else
size="medium"
accent="info"
accent="brand"
variant="primary"
:left-icon="faDownload"
class="xoa-button"

View File

@@ -1,5 +1,5 @@
<template>
<MenuList placement="bottom-end" border>
<MenuList placement="bottom-end">
<template #trigger="{ open, isOpen }">
<UiAccountMenuButton
v-tooltip="isOpen ? false : { content: $t('settings'), placement: 'left' }"

View File

@@ -13,7 +13,7 @@
</TabItem>
<TabItem v-bind="tab(TAB.SLOTS, slotParams)">Slots</TabItem>
<TabItem v-bind="tab(TAB.SETTINGS, settingParams)">Settings</TabItem>
<MenuList placement="bottom" border>
<MenuList placement="bottom">
<template #trigger="{ open, isOpen }">
<TabItem :active="isOpen" :disabled="presets === undefined" class="preset-tab" @click="open">
<UiIcon :icon="faSliders" />
@@ -44,7 +44,7 @@
<UiButton
v-if="eventsLog.length > 0"
size="medium"
accent="info"
accent="brand"
variant="tertiary"
@click="eventsLog = []"
>

View File

@@ -3,13 +3,13 @@
<li v-for="[key, node] in tree" :key="key">
<span
v-if="node.children.size > 0"
class="directory typo p1-medium"
class="directory typo-body-bold"
@click="emit('toggleDirectory', node.directory)"
>
<UiIcon :icon="isOpen(node.directory) ? faFolderOpen : faFolderClosed" />
{{ formatName(key) }}
</span>
<RouterLink v-else :to="node.path" class="link typo p1-regular">
<RouterLink v-else :to="node.path" class="link typo-body-regular">
<UiIcon :icon="faFile" />
{{ formatName(key) }}
</RouterLink>

View File

@@ -1,5 +1,5 @@
<template>
<table class="story-params-table typo p2-regular">
<table class="story-params-table typo-body-regular-small">
<slot />
</table>
</template>
@@ -27,7 +27,7 @@
}
&:nth-child(odd) {
background-color: var(--color-info-background-selected);
background-color: var(--color-brand-background-selected);
}
}

View File

@@ -3,7 +3,7 @@
v-if="isSelectWidget(widget)"
v-model="model"
:wrapper-attrs="{ class: 'full-width' }"
class="typo p2-regular"
class="typo-body-regular-small"
>
<option v-if="!required && model === undefined" :value="undefined" />
<option v-for="choice in widget.choices" :key="choice.label" :value="choice.value">
@@ -19,9 +19,9 @@
<div v-else-if="isBooleanWidget(widget)">
<FormCheckbox v-model="model" />
</div>
<FormInput v-else-if="isNumberWidget(widget)" v-model.number="model" type="number" class="typo p2-regular" />
<FormInput v-else-if="isTextWidget(widget)" v-model="model" class="typo p2-regular" />
<FormJson v-else-if="isObjectWidget(widget)" v-model="model" class="typo p2-regular" />
<FormInput v-else-if="isNumberWidget(widget)" v-model.number="model" type="number" class="typo-body-regular-small" />
<FormInput v-else-if="isTextWidget(widget)" v-model="model" class="typo-body-regular-small" />
<FormJson v-else-if="isObjectWidget(widget)" v-model="model" class="typo-body-regular-small" />
</template>
<script lang="ts" setup>

View File

@@ -16,23 +16,19 @@
<script lang="ts" setup>
import UiIcon from '@/components/ui/icon/UiIcon.vue'
import { useContext } from '@/composables/context.composable'
import { DisabledContext } from '@/context'
import { IK_CHECKBOX_TYPE, IK_FORM_HAS_LABEL } from '@/types/injection-keys'
import { useDisabled } from '@core/composables/disabled.composable'
import { faCheck, faCircle, faMinus } from '@fortawesome/free-solid-svg-icons'
import { useVModel } from '@vueuse/core'
import { computed, type HTMLAttributes, inject, useAttrs } from 'vue'
defineOptions({ inheritAttrs: false })
const props = withDefaults(
defineProps<{
modelValue?: unknown
disabled?: boolean
wrapperAttrs?: HTMLAttributes
}>(),
{ disabled: undefined }
)
const props = defineProps<{
modelValue?: unknown
disabled?: boolean
wrapperAttrs?: HTMLAttributes
}>()
const emit = defineEmits<{
'update:modelValue': [value: boolean]
@@ -46,7 +42,7 @@ const hasLabel = inject(
IK_FORM_HAS_LABEL,
computed(() => false)
)
const isDisabled = useContext(DisabledContext, () => props.disabled)
const isDisabled = useDisabled(() => props.disabled)
const icon = computed(() => {
if (type !== 'checkbox') {
return faCircle
@@ -83,7 +79,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
.input.indeterminate + .fake-checkbox > .icon {
opacity: 1;
color: var(--color-info-txt-item);
color: var(--color-brand-txt-item);
}
}
@@ -145,7 +141,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
.icon {
font-size: var(--checkbox-icon-size);
position: absolute;
color: var(--color-info-txt-item);
color: var(--color-brand-txt-item);
filter: drop-shadow(0 0.0625em 0.5em rgba(0, 0, 0, 0.1)) drop-shadow(0 0.1875em 0.1875em rgba(0, 0, 0, 0.06))
drop-shadow(0 0.1875em 0.25em rgba(0, 0, 0, 0.08));
@@ -164,7 +160,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
background-color: var(--background-color);
box-shadow: var(--shadow-100);
--border-color: var(--color-info-item-base);
--border-color: var(--color-brand-item-base);
}
.input:disabled {
@@ -175,32 +171,32 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
&:checked + .fake-checkbox {
--border-color: transparent;
--background-color: var(--color-info-item-disabled);
--background-color: var(--color-brand-item-disabled);
}
}
.input:not(:disabled) {
&:hover + .fake-checkbox,
&:focus + .fake-checkbox {
--border-color: var(--color-info-item-hover);
--border-color: var(--color-brand-item-hover);
}
&:active + .fake-checkbox {
--border-color: var(--color-info-item-active);
--border-color: var(--color-brand-item-active);
}
&:checked + .fake-checkbox {
--border-color: transparent;
--background-color: var(--color-info-item-base);
--background-color: var(--color-brand-item-base);
}
&:checked:hover + .fake-checkbox,
&:checked:focus + .fake-checkbox {
--background-color: var(--color-info-item-hover);
--background-color: var(--color-brand-item-hover);
}
&:checked:active + .fake-checkbox {
--background-color: var(--color-info-item-active);
--background-color: var(--color-brand-item-active);
}
}
</style>

View File

@@ -53,9 +53,10 @@
<script lang="ts" setup>
import UiIcon from '@/components/ui/icon/UiIcon.vue'
import { useContext } from '@/composables/context.composable'
import { ColorContext, DisabledContext } from '@/context'
import { ColorContext } from '@/context'
import type { Color } from '@/types'
import { IK_INPUT_ID, IK_INPUT_TYPE } from '@/types/injection-keys'
import { useDisabled } from '@core/composables/disabled.composable'
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
import { faAngleDown } from '@fortawesome/free-solid-svg-icons'
import { useTextareaAutosize, useVModel } from '@vueuse/core'
@@ -63,22 +64,19 @@ import { computed, type HTMLAttributes, inject, nextTick, ref, useAttrs, watch }
defineOptions({ inheritAttrs: false })
const props = withDefaults(
defineProps<{
id?: string
modelValue?: any
color?: Color
before?: IconDefinition | string
after?: IconDefinition | string
beforeWidth?: string
afterWidth?: string
disabled?: boolean
required?: boolean
right?: boolean
wrapperAttrs?: HTMLAttributes
}>(),
{ disabled: undefined }
)
const props = defineProps<{
id?: string
modelValue?: any
color?: Color
before?: IconDefinition | string
after?: IconDefinition | string
beforeWidth?: string
afterWidth?: string
disabled?: boolean
required?: boolean
right?: boolean
wrapperAttrs?: HTMLAttributes
}>()
const emit = defineEmits<{
'update:modelValue': [value: any]
@@ -94,7 +92,7 @@ const value = useVModel(props, 'modelValue', emit)
const isEmpty = computed(() => props.modelValue == null || String(props.modelValue).trim() === '')
const inputType = inject(IK_INPUT_TYPE, 'input')
const isDisabled = useContext(DisabledContext, () => props.disabled)
const isDisabled = useDisabled(() => props.disabled)
const wrapperClass = computed(() => [
`form-${inputType}`,
@@ -175,11 +173,11 @@ defineExpose({
.select {
font-size: 1em;
width: 100%;
height: 3em;
height: 4rem;
margin: 0;
color: var(--text-color);
border: 0.05em solid var(--border-color);
border-radius: 0.4em;
border: 0.1rem solid var(--border-color);
border-radius: 0.4rem;
outline: none;
background-color: var(--background-color);
box-shadow: var(--shadow-100);
@@ -201,15 +199,15 @@ defineExpose({
&:not(:disabled) {
&.info {
&:hover {
--border-color: var(--color-info-item-hover);
--border-color: var(--color-brand-item-hover);
}
&:active {
--border-color: var(--color-info-item-active);
--border-color: var(--color-brand-item-active);
}
&:focus {
--border-color: var(--color-info-item-base);
--border-color: var(--color-brand-item-base);
}
}

View File

@@ -1,7 +1,7 @@
<template>
<div class="form-input-wrapper">
<div v-if="label !== undefined || learnMoreUrl !== undefined" class="label-container">
<label :class="[light ? 'p1-regular light' : 'h7-semi-bold']" :for="id" class="label typo">
<label :class="[light ? 'typo-body-regular light' : 'typo-body-bold-small']" :for="id" class="label">
<UiIcon :icon />
{{ label }}
</label>
@@ -36,30 +36,26 @@
<script lang="ts" setup>
import UiIcon from '@/components/ui/icon/UiIcon.vue'
import { useContext } from '@/composables/context.composable'
import { ColorContext, DisabledContext } from '@/context'
import { ColorContext } from '@/context'
import type { Color } from '@/types'
import { IK_FORM_HAS_LABEL, IK_INPUT_ID } from '@/types/injection-keys'
import { useDisabled } from '@core/composables/disabled.composable'
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons'
import { uniqueId } from 'lodash-es'
import { computed, provide, useSlots } from 'vue'
import { computed, provide } from 'vue'
const props = withDefaults(
defineProps<{
label?: string
id?: string
icon?: IconDefinition
learnMoreUrl?: string
warning?: string
error?: string
help?: string
disabled?: boolean
light?: boolean
}>(),
{ disabled: undefined }
)
const slots = useSlots()
const props = defineProps<{
label?: string
id?: string
icon?: IconDefinition
learnMoreUrl?: string
warning?: string
error?: string
help?: string
disabled?: boolean
light?: boolean
}>()
const id = computed(() => props.id ?? uniqueId('form-input-'))
provide(IK_INPUT_ID, id)
@@ -78,11 +74,11 @@ const color = computed<Color | undefined>(() => {
provide(
IK_FORM_HAS_LABEL,
computed(() => slots.label !== undefined)
computed(() => props.label !== undefined)
)
useContext(ColorContext, color)
useContext(DisabledContext, () => props.disabled)
useDisabled(() => props.disabled)
</script>
<style lang="postcss" scoped>
@@ -128,7 +124,7 @@ useContext(DisabledContext, () => props.disabled)
align-items: center;
gap: 0.5rem;
text-decoration: none;
color: var(--color-info-txt-base);
color: var(--color-brand-txt-base);
& > span {
text-decoration: underline;

View File

@@ -1,7 +1,7 @@
<template>
<div :class="{ collapsible }" class="form-section">
<fieldset class="fieldset">
<legend class="legend typo h4-medium" @click="toggleCollapse">
<legend class="legend typo-h4" @click="toggleCollapse">
{{ label }}
<UiIcon :icon class="collapse-icon" />
</legend>
@@ -53,7 +53,7 @@ whenever(
<style lang="postcss" scoped>
.collapsible {
padding: 1rem 1.5rem;
background-color: var(--color-info-background-selected);
background-color: var(--color-brand-background-selected);
border-radius: 0.8rem;
}
@@ -67,9 +67,9 @@ whenever(
display: flex;
align-items: center;
justify-content: space-between;
color: var(--color-info-txt-base);
color: var(--color-brand-txt-base);
border: none;
border-bottom: 1px solid var(--color-info-txt-base);
border-bottom: 1px solid var(--color-brand-txt-base);
width: 100%;
padding-bottom: 1rem;
@@ -85,6 +85,6 @@ whenever(
}
.collapse-icon {
color: var(--color-info-txt-base);
color: var(--color-brand-txt-base);
}
</style>

View File

@@ -1,27 +1,35 @@
<template>
<UiHeadBar>
<template #icon>
<UiObjectIcon size="medium" type="host" :state="getHostPowerState as HostState" />
<UiObjectIcon size="medium" type="host" :state="powerState as HostState" />
</template>
{{ host.name_label }}
<template v-if="isMaster" #status>
<VtsIcon v-tooltip="$t('master')" accent="info" :icon="faCircle" :overlay-icon="faStar" />
</template>
</UiHeadBar>
</template>
<script lang="ts" setup>
import type { XenApiHost } from '@/libs/xen-api/xen-api.types'
import { useHostStore } from '@/stores/xen-api/host.store'
import { useHostMetricsStore } from '@/stores/xen-api/host-metrics.store'
import { usePoolStore } from '@/stores/xen-api/pool.store'
import type { HostState } from '@core/types/object-icon.type'
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import UiHeadBar from '@core/components/ui/head-bar/UiHeadBar.vue'
import UiObjectIcon from '@core/components/ui/object-icon/UiObjectIcon.vue'
import { vTooltip } from '@core/directives/tooltip.directive'
import { faCircle, faStar } from '@fortawesome/free-solid-svg-icons'
import { computed } from 'vue'
const props = defineProps<{
const { host } = defineProps<{
host: XenApiHost
}>()
const { runningHosts } = useHostStore().subscribe()
const getHostPowerState = computed(() => {
const isHostRunning = runningHosts.value.some(runningHost => runningHost.uuid === props.host.uuid)
return isHostRunning ? 'running' : 'halted'
})
const { isHostRunning } = useHostMetricsStore().subscribe()
const powerState = computed(() => (isHostRunning(host) ? 'running' : 'halted'))
const { isMasterHost } = usePoolStore().subscribe()
const isMaster = computed(() => isMasterHost(host.$ref))
</script>

View File

@@ -1,12 +1,12 @@
<template>
<TabList>
<RouterTab :to="{ name: 'host.dashboard', params: { uuid } }" disabled>
<RouterTab :to="{ name: 'host.dashboard', params: { uuid } }">
{{ $t('dashboard') }}
</RouterTab>
<RouterTab :to="{ name: 'host.console', params: { uuid } }">
{{ $t('console') }}
</RouterTab>
<RouterTab :to="{ name: 'host.network', params: { uuid } }" disabled>
<RouterTab :to="{ name: 'host.network', params: { uuid } }">
{{ $t('network') }}
</RouterTab>
<RouterTab :to="{ name: 'host.tasks', params: { uuid } }" disabled>

View File

@@ -0,0 +1,58 @@
<template>
<UiCard class="host-dashboard-cpu-provisioning">
<UiCardTitle>{{ $t('cpu-provisioning') }}</UiCardTitle>
<VtsLoadingHero v-if="!isReady" type="card" />
<template v-else>
<UiProgressBar :value="vCpusCount" :max="cpusCount" :legend="$t('vcpus')" />
<div class="total">
<UiCardNumbers :label="$t('vcpus-assigned')" :value="vCpusCount" size="medium" />
<UiCardNumbers :label="$t('total-cpus')" :value="cpusCount" size="medium" />
</div>
</template>
</UiCard>
</template>
<script lang="ts" setup>
import type { XenApiHost } from '@/libs/xen-api/xen-api.types.ts'
import { useHostStore } from '@/stores/xen-api/host.store.ts'
import { useVmMetricsStore } from '@/stores/xen-api/vm-metrics.store.ts'
import { useVmStore } from '@/stores/xen-api/vm.store.ts'
import VtsLoadingHero from '@core/components/state-hero/VtsLoadingHero.vue'
import UiCard from '@core/components/ui/card/UiCard.vue'
import UiCardNumbers from '@core/components/ui/card-numbers/UiCardNumbers.vue'
import UiCardTitle from '@core/components/ui/card-title/UiCardTitle.vue'
import UiProgressBar from '@core/components/ui/progress-bar/UiProgressBar.vue'
import { and } from '@vueuse/math'
import { useArrayReduce } from '@vueuse/shared'
import { computed } from 'vue'
const { host } = defineProps<{
host: XenApiHost
}>()
const { isReady: isHostReady } = useHostStore().subscribe()
const { recordsByHostRef, isReady: areVmsReady } = useVmStore().subscribe()
const { getByOpaqueRef: getVmMetricsByOpaqueRef } = useVmMetricsStore().subscribe()
const isReady = and(isHostReady, areVmsReady)
const hostVms = computed(() => recordsByHostRef.value.get(host.$ref) ?? [])
const cpusCount = computed(() => Number(host.cpu_info.cpu_count))
const vCpusCount = useArrayReduce(
hostVms,
(total, vm) => total + (getVmMetricsByOpaqueRef(vm.metrics)?.VCPUs_number ?? 0),
0
)
</script>
<style lang="postcss" scoped>
.host-dashboard-cpu-provisioning {
.total {
display: grid;
grid-template-columns: 1fr 1fr;
margin-block-start: auto;
}
}
</style>

View File

@@ -0,0 +1,73 @@
<template>
<UiCard>
<UiCardTitle>
{{ $t('cpu-usage') }}
<template #description>{{ $t('last-week') }}</template>
</UiCardTitle>
<VtsLoadingHero v-if="loading || data.stats === undefined" type="card" />
<VtsErrorNoDataHero v-else-if="error" type="card" />
<VtsLinearChart v-else :data="cpuUsage" :max-value :value-formatter class="chart" />
</UiCard>
</template>
<script lang="ts" setup>
import { type HostStats, RRD_STEP_FROM_STRING } from '@/libs/xapi-stats.ts'
import type { LinearChartData, ValueFormatter } from '@core/types/chart.ts'
import VtsErrorNoDataHero from '@core/components/state-hero/VtsErrorNoDataHero.vue'
import VtsLoadingHero from '@core/components/state-hero/VtsLoadingHero.vue'
import UiCard from '@core/components/ui/card/UiCard.vue'
import UiCardTitle from '@core/components/ui/card-title/UiCardTitle.vue'
import { computed, defineAsyncComponent } from 'vue'
import { useI18n } from 'vue-i18n'
const { data } = defineProps<{
data: {
stats: HostStats | undefined
timestampStart: number
}
loading: boolean
error?: string
}>()
const VtsLinearChart = defineAsyncComponent(() => import('@core/components/linear-chart/VtsLinearChart.vue'))
const { t, n } = useI18n()
const cpuUsage = computed<LinearChartData>(() => {
const stats = data.stats
const timestampStart = data.timestampStart
if (stats === undefined) {
return []
}
const cpus = Object.values(stats.cpus)
const result = cpus[0].map((_, hourIndex) => {
const timestamp = (timestampStart + hourIndex * RRD_STEP_FROM_STRING.hours) * 1000
const value = Math.round(cpus.reduce((total, cpu) => total + cpu[hourIndex], 0) / cpus.length)
return { timestamp, value }
})
return [
{
label: t('stacked-cpu-usage'),
data: result,
},
]
})
const maxValue = computed(() => {
const values = cpuUsage.value[0]?.data.map(item => item.value) ?? []
if (values.length === 0) {
return 100
}
const maxCpuUsage = Math.max(...values)
return Math.ceil(maxCpuUsage / 100) * 100
})
const valueFormatter: ValueFormatter = value => n(value / 100, 'percent')
</script>

View File

@@ -0,0 +1,67 @@
<template>
<UiCard>
<UiCardTitle>
{{ $t('load-average') }}
<template #description>{{ $t('last-week') }}</template>
</UiCardTitle>
<VtsLoadingHero v-if="loading || data.stats === undefined" type="card" />
<VtsErrorNoDataHero v-else-if="error" type="card" />
<VtsLinearChart v-else :data="loadAverage" :max-value />
</UiCard>
</template>
<script lang="ts" setup>
import { type HostStats, RRD_STEP_FROM_STRING } from '@/libs/xapi-stats.ts'
import type { LinearChartData } from '@core/types/chart.ts'
import VtsErrorNoDataHero from '@core/components/state-hero/VtsErrorNoDataHero.vue'
import VtsLoadingHero from '@core/components/state-hero/VtsLoadingHero.vue'
import UiCard from '@core/components/ui/card/UiCard.vue'
import UiCardTitle from '@core/components/ui/card-title/UiCardTitle.vue'
import { computed, defineAsyncComponent } from 'vue'
import { useI18n } from 'vue-i18n'
const { data } = defineProps<{
data: {
stats: HostStats | undefined
timestampStart: number
}
loading: boolean
error?: string
}>()
const VtsLinearChart = defineAsyncComponent(() => import('@core/components/linear-chart/VtsLinearChart.vue'))
const { t } = useI18n()
const loadAverage = computed<LinearChartData>(() => {
const { stats, timestampStart } = data
const { load } = stats ?? {}
if (!load?.length) {
return []
}
const result = load.map((value, index) => ({
timestamp: (timestampStart + index * RRD_STEP_FROM_STRING.hours) * 1000,
value: Number(value.toFixed(2)),
}))
return [
{
label: t('load-average'),
data: result,
},
]
})
const maxValue = computed(() => {
const values = loadAverage.value[0]?.data.map(item => item.value) ?? []
if (values.length === 0) {
return 10
}
const maxLoad = Math.max(...values)
return Math.ceil(maxLoad / 5) * 5
})
</script>

View File

@@ -0,0 +1,80 @@
<template>
<UiCard>
<UiCardTitle>
{{ $t('network-throughput') }}
<template #description>{{ $t('last-week') }}</template>
</UiCardTitle>
<VtsLoadingHero v-if="loading || data.stats === undefined" type="card" />
<VtsErrorNoDataHero v-else-if="error" type="card" />
<VtsLinearChart v-else :data="networkUsage" :max-value :value-formatter="byteFormatter" />
</UiCard>
</template>
<script lang="ts" setup>
import { type HostStats, RRD_STEP_FROM_STRING } from '@/libs/xapi-stats.ts'
import type { LinearChartData } from '@core/types/chart.ts'
import VtsErrorNoDataHero from '@core/components/state-hero/VtsErrorNoDataHero.vue'
import VtsLoadingHero from '@core/components/state-hero/VtsLoadingHero.vue'
import UiCard from '@core/components/ui/card/UiCard.vue'
import UiCardTitle from '@core/components/ui/card-title/UiCardTitle.vue'
import { formatSizeRaw } from '@core/utils/size.util.ts'
import { computed, defineAsyncComponent } from 'vue'
import { useI18n } from 'vue-i18n'
const { data } = defineProps<{
data: {
stats: HostStats | undefined
timestampStart: number
}
loading: boolean
error?: string
}>()
const VtsLinearChart = defineAsyncComponent(() => import('@core/components/linear-chart/VtsLinearChart.vue'))
const { t } = useI18n()
const networkUsage = computed<LinearChartData>(() => {
const { stats, timestampStart } = data
const { pifs } = stats ?? {}
if (pifs === undefined) {
return []
}
const addNetworkData = (type: 'rx' | 'tx') => ({
label: type === 'rx' ? t('network-upload') : t('network-download'),
data: Object.values(pifs[type])[0].map((_, index) => ({
timestamp:
(timestampStart -
RRD_STEP_FROM_STRING.hours * (Object.values(pifs[type])[0].length - 1) +
index * RRD_STEP_FROM_STRING.hours) *
1000,
value: Object.values(pifs[type]).reduce((sum, values) => sum + values[index], 0),
})),
})
return [addNetworkData('rx'), addNetworkData('tx')]
})
const maxValue = computed(() => {
const values = networkUsage.value.reduce(
(acc, series) => [...acc, ...series.data.map(item => item.value)],
[] as number[]
)
if (values.length === 0) {
return 100
}
const maxUsage = Math.max(...values)
return Math.ceil(maxUsage / 100) * 100
})
const byteFormatter = (value: number) => {
const result = formatSizeRaw(value, 1)
return `${result?.value}${result?.prefix}`
}
</script>

View File

@@ -0,0 +1,123 @@
<template>
<VtsQuickInfoCard class="host-dashboard-quick-info" :loading="!isReady">
<VtsQuickInfoColumn>
<VtsQuickInfoRow :label="$t('state')">
<template #value>
<VtsIcon :accent="powerState.accent" :icon="powerState.icon" />
{{ powerState.text }}
</template>
</VtsQuickInfoRow>
<VtsQuickInfoRow :label="$t('ip-address')" :value="host.address" />
<VtsQuickInfoRow :label="$t('started')" :value="relativeStartTime" />
<VtsQuickInfoRow>
<template #label>
{{ $t('master') }}
</template>
<template #value>
<template v-if="isMaster">
<VtsIcon v-tooltip="$t('master')" accent="info" :icon="faCircle" :overlay-icon="faStar" />
{{ $t('this-host') }}
</template>
<UiObjectLink v-else-if="masterHost !== undefined" :route="`/host/${masterHost.uuid}/dashboard`">
<template #icon>
<UiObjectIcon size="medium" :state="isHostRunning(masterHost) ? 'running' : 'halted'" type="host" />
</template>
{{ masterHost.name_label }}
</UiObjectLink>
</template>
</VtsQuickInfoRow>
</VtsQuickInfoColumn>
<VtsQuickInfoColumn>
<VtsQuickInfoRow :label="$t('id')" :value="host.uuid" />
<VtsQuickInfoRow :label="$t('description')" :value="host.name_description" />
<VtsQuickInfoRow :label="$t('version')" :value="host.software_version.product_version" />
<VtsQuickInfoRow :label="$t('hardware')">
<template #value>
{{ host.bios_strings['system-manufacturer'] }}
{{ `(${host.bios_strings['system-product-name']})` }}
</template>
</VtsQuickInfoRow>
</VtsQuickInfoColumn>
<VtsQuickInfoColumn>
<VtsQuickInfoRow :label="$t('cores-with-sockets')">
<template #value>{{ host.cpu_info.cpu_count }} {{ `(${host.cpu_info.socket_count})` }}</template>
</VtsQuickInfoRow>
<VtsQuickInfoRow :label="$t('ram')">
<template #value>{{ `${ram?.value} ${ram?.prefix}` }}</template>
</VtsQuickInfoRow>
<VtsQuickInfoRow :label="$t('tags')">
<template #value>
<UiTagsList v-if="host.tags.length">
<UiTag v-for="tag in host.tags" :key="tag" accent="neutral" variant="secondary">{{ tag }}</UiTag>
</UiTagsList>
</template>
</VtsQuickInfoRow>
</VtsQuickInfoColumn>
</VtsQuickInfoCard>
</template>
<script lang="ts" setup>
import type { XenApiHost } from '@/libs/xen-api/xen-api.types.ts'
import { useHostMetricsStore } from '@/stores/xen-api/host-metrics.store.ts'
import { useHostStore } from '@/stores/xen-api/host.store.ts'
import { usePoolStore } from '@/stores/xen-api/pool.store.ts'
import VtsIcon, { type IconAccent } from '@core/components/icon/VtsIcon.vue'
import VtsQuickInfoCard from '@core/components/quick-info-card/VtsQuickInfoCard.vue'
import VtsQuickInfoColumn from '@core/components/quick-info-column/VtsQuickInfoColumn.vue'
import VtsQuickInfoRow from '@core/components/quick-info-row/VtsQuickInfoRow.vue'
import UiObjectIcon from '@core/components/ui/object-icon/UiObjectIcon.vue'
import UiObjectLink from '@core/components/ui/object-link/UiObjectLink.vue'
import UiTag from '@core/components/ui/tag/UiTag.vue'
import UiTagsList from '@core/components/ui/tag/UiTagsList.vue'
import useRelativeTime from '@core/composables/relative-time.composable'
import { vTooltip } from '@core/directives/tooltip.directive'
import { formatSizeRaw } from '@core/utils/size.util'
import { parseDateTime } from '@core/utils/time.util'
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
import { faCircle, faPlay, faStar, faStop } from '@fortawesome/free-solid-svg-icons'
import { useNow } from '@vueuse/core'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { host } = defineProps<{
host: XenApiHost
}>()
const { t } = useI18n()
const { isMasterHost, masterHost } = usePoolStore().subscribe()
const { isReady } = useHostStore().subscribe()
const { isHostRunning, getHostMemory } = useHostMetricsStore().subscribe()
const powerStateConfig: Record<
string,
{
icon: IconDefinition | undefined
accent: IconAccent
}
> = {
running: { icon: faPlay, accent: 'success' },
halted: { icon: faStop, accent: 'danger' },
}
const powerState = computed(() => {
const isRunning = isHostRunning(host)
return {
text: t(`host-status.${isRunning ? 'running' : 'halted'}`),
...powerStateConfig[isRunning ? 'running' : 'halted'],
}
})
const date = computed(() => new Date(parseDateTime(Number(host.other_config.boot_time) * 1000)))
const now = useNow({ interval: 1000 })
const relativeStartTime = useRelativeTime(date, now)
const isMaster = computed(() => isMasterHost(host.$ref))
const ram = computed(() => {
const memory = getHostMemory(host)
return formatSizeRaw(memory?.size, 0)
})
</script>

View File

@@ -0,0 +1,66 @@
<template>
<UiCard class="host-dashboard-ram-provisioning">
<UiCardTitle>{{ $t('ram-provisioning') }}</UiCardTitle>
<VtsLoadingHero v-if="!isReady" type="card" />
<template v-else>
<UiProgressBar :value="memory?.usage ?? 0" :max="memory?.size" :legend="host.name_label" />
<div class="total">
<UiCardNumbers
:label="$t('total-assigned')"
:unit="ramUsage.used?.prefix"
:value="ramUsage.used?.value"
size="medium"
/>
<UiCardNumbers
:label="$t('total-free')"
:unit="ramUsage.free?.prefix"
:value="ramUsage.free?.value"
size="medium"
/>
</div>
</template>
</UiCard>
</template>
<script lang="ts" setup>
import type { XenApiHost } from '@/libs/xen-api/xen-api.types.ts'
import { useHostMetricsStore } from '@/stores/xen-api/host-metrics.store.ts'
import { useHostStore } from '@/stores/xen-api/host.store.ts'
import VtsLoadingHero from '@core/components/state-hero/VtsLoadingHero.vue'
import UiCard from '@core/components/ui/card/UiCard.vue'
import UiCardNumbers from '@core/components/ui/card-numbers/UiCardNumbers.vue'
import UiCardTitle from '@core/components/ui/card-title/UiCardTitle.vue'
import UiProgressBar from '@core/components/ui/progress-bar/UiProgressBar.vue'
import { formatSizeRaw } from '@core/utils/size.util'
import { computed } from 'vue'
const { host } = defineProps<{
host: XenApiHost
}>()
const { isReady } = useHostStore().subscribe()
const { getHostMemory } = useHostMetricsStore().subscribe()
const memory = computed(() => getHostMemory(host))
const ramUsage = computed(() => {
const total = memory.value?.size ?? 0
const used = memory.value?.usage ?? 0
return {
total: formatSizeRaw(total, 0),
used: formatSizeRaw(used, 0),
free: formatSizeRaw(total - used, 0),
}
})
</script>
<style lang="postcss" scoped>
.host-dashboard-ram-provisioning {
.total {
display: grid;
grid-template-columns: 1fr 1fr;
margin-block-start: auto;
}
}
</style>

View File

@@ -0,0 +1,73 @@
<template>
<UiCard>
<UiCardTitle>
{{ $t('ram-usage') }}
<template #description>{{ $t('last-week') }}</template>
</UiCardTitle>
<VtsLoadingHero v-if="loading || data.stats === undefined" type="card" />
<VtsErrorNoDataHero v-else-if="error" type="card" />
<VtsLinearChart v-else :data="memoryUsage" :max-value :value-formatter="byteFormatter" />
</UiCard>
</template>
<script lang="ts" setup>
import { type HostStats, RRD_STEP_FROM_STRING } from '@/libs/xapi-stats.ts'
import type { LinearChartData } from '@core/types/chart.ts'
import VtsErrorNoDataHero from '@core/components/state-hero/VtsErrorNoDataHero.vue'
import VtsLoadingHero from '@core/components/state-hero/VtsLoadingHero.vue'
import UiCard from '@core/components/ui/card/UiCard.vue'
import UiCardTitle from '@core/components/ui/card-title/UiCardTitle.vue'
import { formatSizeRaw } from '@core/utils/size.util.ts'
import { computed, defineAsyncComponent } from 'vue'
import { useI18n } from 'vue-i18n'
const { data } = defineProps<{
data: {
stats: HostStats | undefined
timestampStart: number
}
loading: boolean
error?: string
}>()
const VtsLinearChart = defineAsyncComponent(() => import('@core/components/linear-chart/VtsLinearChart.vue'))
const { t } = useI18n()
const memoryUsage = computed<LinearChartData>(() => {
const { stats, timestampStart } = data
const { memory: memoryTotal, memoryFree } = stats ?? {}
if (memoryTotal === undefined || memoryFree === undefined) {
return []
}
const result = memoryTotal.map((total, index) => ({
timestamp:
(timestampStart - RRD_STEP_FROM_STRING.hours * (memoryTotal.length - 1) + index * RRD_STEP_FROM_STRING.hours) *
1000,
value: total - memoryFree[index],
}))
return [
{
label: t('ram-usage'),
data: result,
},
]
})
const maxValue = computed(() => {
if (!data.stats?.memory?.length) {
return 1024 * 1024 * 1024 // 1 GB as fallback
}
return Math.max(...data.stats.memory, 0)
})
const byteFormatter = (value: number) => {
const result = formatSizeRaw(value, 1)
return `${result?.value}${result?.prefix}`
}
</script>

View File

@@ -0,0 +1,81 @@
<template>
<UiCard class="host-dashboard-vms-status">
<UiCardTitle>{{ $t('vms-status') }}</UiCardTitle>
<VtsLoadingHero v-if="!isReady" type="card" />
<template v-else>
<VtsDonutChartWithLegend :segments />
<UiCardNumbers class="total" :label="$t('total')" :value="total" size="small" />
</template>
</UiCard>
</template>
<script lang="ts" setup>
import type { XenApiHost } from '@/libs/xen-api/xen-api.types.ts'
import { useHostStore } from '@/stores/xen-api/host.store.ts'
import { useVmStore } from '@/stores/xen-api/vm.store.ts'
import VtsDonutChartWithLegend, {
type DonutChartWithLegendProps,
} from '@core/components/donut-chart-with-legend/VtsDonutChartWithLegend.vue'
import VtsLoadingHero from '@core/components/state-hero/VtsLoadingHero.vue'
import UiCard from '@core/components/ui/card/UiCard.vue'
import UiCardNumbers from '@core/components/ui/card-numbers/UiCardNumbers.vue'
import UiCardTitle from '@core/components/ui/card-title/UiCardTitle.vue'
import { useItemCounter } from '@core/composables/item-counter.composable'
import { VM_POWER_STATE } from '@vates/types'
import { useSum } from '@vueuse/math'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { host } = defineProps<{
host: XenApiHost
}>()
const { isReady: isHostReady } = useHostStore().subscribe()
const { isReady: areVmsReady, recordsByHostRef } = useVmStore().subscribe()
const isReady = computed(() => isHostReady.value && areVmsReady.value)
const hostVms = computed(() => recordsByHostRef.value.get(host.$ref) ?? [])
const { t } = useI18n()
const countByPowerState = useItemCounter(hostVms, {
running: vm => vm.power_state === VM_POWER_STATE.RUNNING,
paused: vm => vm.power_state === VM_POWER_STATE.PAUSED,
suspended: vm => vm.power_state === VM_POWER_STATE.SUSPENDED,
halted: vm => vm.power_state === VM_POWER_STATE.HALTED,
})
const total = useSum(() => Object.values(countByPowerState.value))
const segments = computed<DonutChartWithLegendProps['segments']>(() => [
{
label: t('vms-status.running'),
value: countByPowerState.value.running,
accent: 'success',
},
{
label: t('vms-status.paused'),
value: countByPowerState.value.paused,
accent: 'info',
},
{
label: t('vms-status.suspended'),
value: countByPowerState.value.suspended,
accent: 'muted',
},
{
label: t('vms-status.halted'),
value: countByPowerState.value.halted,
accent: 'danger',
},
])
</script>
<style lang="postcss" scoped>
.host-dashboard-vms-status {
.total {
margin-inline-start: auto;
}
}
</style>

View File

@@ -0,0 +1,459 @@
<template>
<UiPanel>
<template #header>
<UiButton
v-tooltip="$t('coming-soon')"
disabled
size="medium"
variant="tertiary"
accent="brand"
:left-icon="faEdit"
>
{{ $t('edit') }}
</UiButton>
<UiButton
v-tooltip="$t('coming-soon')"
disabled
size="medium"
variant="tertiary"
accent="danger"
:left-icon="faTrash"
>
{{ $t('delete') }}
</UiButton>
</template>
<template #default>
<!-- PIF -->
<UiCard class="card">
<UiCardTitle>{{ isBond ? $t('bond') : $t('pif') }}</UiCardTitle>
<div class="content">
<!-- UUID -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('uuid') }}
</template>
<template #value>
{{ pif.uuid }}
</template>
<template #addons>
<VtsIcon
v-if="pif.management"
v-tooltip="$t('management')"
accent="info"
:icon="faCircle"
:overlay-icon="faStar"
/>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(pif.uuid)"
/>
</template>
</VtsCardRowKeyValue>
<!-- NETWORK -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('network') }}
</template>
<template #value>
<div class="network">
<!-- TODO Remove the span when the link works and the icon is fixed -->
<!--
<UiComplexIcon size="medium">
<VtsIcon :icon="faNetworkWired" accent="current" />
<VtsIcon accent="success" :icon="faCircle" :overlay-icon="faCheck" />
</UiComplexIcon>
<a href="">{{ networkNameLabel }}</a>
-->
<span v-tooltip class="value text-ellipsis">{{ network?.name_label }}</span>
</div>
</template>
<template v-if="network?.name_label" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(network.name_label)"
/>
</template>
</VtsCardRowKeyValue>
<!-- DEVICE -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('device') }}
</template>
<template #value>
{{ pif.device }}
</template>
<template #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(pif.device)"
/>
</template>
</VtsCardRowKeyValue>
<!-- PIF STATUS -->
<VtsCardRowKeyValue>
<template #key>
{{ isBond ? $t('bond-status') : $t('pif-status') }}
</template>
<template #value>
<VtsConnectionStatus :status />
</template>
</VtsCardRowKeyValue>
<!-- PHYSICAL INTERFACE STATUS -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('physical-interface-status') }}
</template>
<template #value>
<VtsConnectionStatus :status="physicalInterfaceStatus" />
</template>
</VtsCardRowKeyValue>
<!-- VLAN -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('vlan') }}
</template>
<template #value>
{{ pif.VLAN === -1 ? $t('none') : pif.VLAN }}
</template>
<template v-if="pif.VLAN !== -1" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(String(pif.VLAN))"
/>
</template>
</VtsCardRowKeyValue>
<!-- TAGS -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('tags') }}
</template>
<template #value>
<UiTagsList class="tags value">
<UiTag v-for="tag in network?.tags" :key="tag" accent="info" variant="secondary">
{{ tag }}
</UiTag>
</UiTagsList>
</template>
</VtsCardRowKeyValue>
</div>
</UiCard>
<!-- NETWORK INFORMATION -->
<UiCard class="card">
<UiCardTitle>{{ $t('network-information') }}</UiCardTitle>
<div class="content">
<!-- IP ADDRESSES -->
<div v-if="ipAddresses.length">
<VtsCardRowKeyValue v-for="(ip, index) in ipAddresses" :key="ip">
<template #key>
<div v-if="index === 0">{{ $t('ip-addresses') }}</div>
</template>
<template #value>
<span v-tooltip class="text-ellipsis">{{ ip }}</span>
</template>
<template #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(ip)"
/>
<UiButtonIcon
v-if="index === 0 && ipAddresses.length > 1"
v-tooltip="$t('coming-soon')"
disabled
:icon="faEllipsis"
size="medium"
accent="brand"
/>
</template>
</VtsCardRowKeyValue>
</div>
<VtsCardRowKeyValue v-else>
<template #key>
{{ $t('ip-addresses') }}
</template>
<template #value>
<span class="value" />
</template>
</VtsCardRowKeyValue>
<!-- MAC ADDRESSES -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('mac-address') }}
</template>
<template #value>
{{ pif.MAC }}
</template>
<template #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(pif.MAC)"
/>
</template>
</VtsCardRowKeyValue>
<!-- NETMASK -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('netmask') }}
</template>
<template #value>
<span class="value">{{ pif.netmask }}</span>
</template>
<template v-if="pif.netmask" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(String(pif.netmask))"
/>
</template>
</VtsCardRowKeyValue>
<!-- DNS -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('dns') }}
</template>
<template #value>
<span class="value">
{{ pif.DNS }}
</span>
</template>
<template v-if="pif.DNS" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(String(pif.DNS))"
/>
</template>
</VtsCardRowKeyValue>
<!-- GATEWAY -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('gateway') }}
</template>
<template #value>
<span class="value">
{{ pif.gateway }}
</span>
</template>
<template v-if="pif.gateway" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(String(pif.gateway))"
/>
</template>
</VtsCardRowKeyValue>
<!-- IP CONFIGURATION MODE -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('ip-mode') }}
</template>
<template #value>
{{ ipConfigurationMode }}
</template>
</VtsCardRowKeyValue>
<!-- BOND DEVICES -->
<div>
<VtsCardRowKeyValue v-for="(device, index) in bondDevices" :key="device">
<template #key>
<div v-if="index === 0">{{ $t('bond-devices') }}</div>
</template>
<template #value>
<span v-tooltip class="text-ellipsis">{{ device }}</span>
</template>
<template #addons>
<UiButtonIcon
v-if="device"
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(device)"
/>
<UiButtonIcon
v-if="index === 0 && bondDevices.length > 1"
v-tooltip="$t('coming-soon')"
disabled
:icon="faEllipsis"
size="medium"
accent="brand"
/>
</template>
</VtsCardRowKeyValue>
</div>
</div>
</UiCard>
<!-- PROPERTIES -->
<UiCard class="card">
<UiCardTitle>{{ $t('properties') }}</UiCardTitle>
<div class="content">
<!-- MTU -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('mtu') }}
</template>
<template #value>
{{ pif.MTU === -1 ? $t('none') : pif.MTU }}
</template>
<template v-if="pif.MTU !== -1" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(String(pif.MTU))"
/>
</template>
</VtsCardRowKeyValue>
<!-- SPEED -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('speed') }}
</template>
<template #value>
{{ speed }}
</template>
</VtsCardRowKeyValue>
<!-- NETWORK BLOCK DEVICE -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('network-block-device') }}
</template>
<template #value>
{{ networkPurpose }}
</template>
<template #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(networkPurpose)"
/>
</template>
</VtsCardRowKeyValue>
</div>
</UiCard>
</template>
</UiPanel>
</template>
<script setup lang="ts">
import type { XenApiPif } from '@/libs/xen-api/xen-api.types'
import { useNetworkStore } from '@/stores/xen-api/network.store'
import { usePifMetricsStore } from '@/stores/xen-api/pif-metrics.store'
import { usePifStore } from '@/stores/xen-api/pif.store'
import VtsCardRowKeyValue from '@core/components/card/VtsCardRowKeyValue.vue'
import VtsConnectionStatus from '@core/components/connection-status/VtsConnectionStatus.vue'
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import UiButton from '@core/components/ui/button/UiButton.vue'
import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
import UiCard from '@core/components/ui/card/UiCard.vue'
import UiCardTitle from '@core/components/ui/card-title/UiCardTitle.vue'
import UiPanel from '@core/components/ui/panel/UiPanel.vue'
import UiTag from '@core/components/ui/tag/UiTag.vue'
import UiTagsList from '@core/components/ui/tag/UiTagsList.vue'
import { vTooltip } from '@core/directives/tooltip.directive'
import { faCircle, faCopy, faEdit, faEllipsis, faStar, faTrash } from '@fortawesome/free-solid-svg-icons'
import { useClipboard } from '@vueuse/core'
import humanFormat from 'human-format'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { pif } = defineProps<{
pif: XenApiPif
}>()
const { getByOpaqueRef: getPifMetricsByOpaqueRef, getPifCarrier } = usePifMetricsStore().subscribe()
const { getByOpaqueRef: getNetworkByOpaqueRef } = useNetworkStore().subscribe()
const { getBondsDevices, isBondMaster } = usePifStore().subscribe()
const { t } = useI18n()
const ipAddresses = computed(() => [pif.IP, ...pif.IPv6].filter(ip => ip))
const network = computed(() => getNetworkByOpaqueRef(pif.network))
const networkPurpose = computed(() => (network.value?.purpose?.[0] ? t('on') : t('off')))
const status = computed(() => (pif.currently_attached ? 'connected' : 'disconnected'))
const physicalInterfaceStatus = computed(() => (getPifCarrier(pif) ? 'connected' : 'physically-disconnected'))
const ipConfigurationMode = computed(() => {
switch (pif.ip_configuration_mode) {
case 'Static':
return t('static')
case 'DHCP':
return t('dhcp')
default:
return t('none')
}
})
const bondDevices = computed(() => getBondsDevices(pif))
const isBond = computed(() => isBondMaster(pif))
const speed = computed(() => {
const speed = getPifMetricsByOpaqueRef(pif.metrics)?.speed || 0
const speedInBytes = speed * 1000000
return humanFormat(speedInBytes, {
scale: 'SI',
unit: 'b/s',
maxDecimals: 2,
})
})
const { copy, copied } = useClipboard()
</script>
<style scoped lang="postcss">
.card {
gap: 1.6rem;
.content {
display: flex;
flex-direction: column;
gap: 0.8rem;
}
.network {
display: flex;
gap: 0.8rem;
}
.tags {
width: 100%;
display: flex;
gap: 0.8rem;
}
.value:empty::before {
content: '-';
}
}
</style>

View File

@@ -0,0 +1,296 @@
<template>
<div class="host-pif-table">
<UiTitle>
{{ $t('pifs') }}
<template #actions>
<UiButton
v-tooltip="$t('coming-soon')"
disabled
:left-icon="faPlus"
variant="secondary"
accent="brand"
size="medium"
>
{{ $t('scan-pifs') }}
</UiButton>
</template>
</UiTitle>
<div class="container">
<div class="table-actions">
<UiQuerySearchBar @search="(value: string) => (searchQuery = value)" />
<UiTableActions :title="$t('table-actions')">
<UiButton
v-tooltip="$t('coming-soon')"
disabled
:left-icon="faEdit"
variant="tertiary"
accent="brand"
size="medium"
>
{{ $t('edit') }}
</UiButton>
<UiButton
v-tooltip="$t('coming-soon')"
disabled
:left-icon="faTrash"
variant="tertiary"
accent="danger"
size="medium"
>
{{ $t('delete') }}
</UiButton>
</UiTableActions>
<UiTopBottomTable :selected-items="0" :total-items="0" />
</div>
<VtsDataTable :is-ready :has-error :no-data-message="pifs.length === 0 ? $t('no-pif-detected') : undefined">
<template #thead>
<tr>
<template v-for="column of visibleColumns" :key="column.id">
<th v-if="column.id === 'checkbox'" class="checkbox">
<div v-tooltip="$t('coming-soon')">
<UiCheckbox disabled :v-model="areAllSelected" accent="brand" />
</div>
</th>
<th v-else-if="column.id === 'more'" class="more">
<UiButtonIcon v-tooltip="$t('coming-soon')" :icon="faEllipsis" accent="brand" disabled size="small" />
</th>
<th v-else>
<div v-tooltip class="text-ellipsis">
<VtsIcon accent="brand" :icon="headerIcon[column.id]" />
{{ column.label }}
</div>
</th>
</template>
</tr>
</template>
<template #tbody>
<tr
v-for="row of rows"
:key="row.id"
:class="{ selected: selectedPifId === row.id }"
@click="selectedPifId = row.id"
>
<td
v-for="column of row.visibleColumns"
:key="column.id"
class="typo-body-regular-small"
:class="{ checkbox: column.id === 'checkbox' }"
>
<div v-if="column.id === 'checkbox'" v-tooltip="$t('coming-soon')">
<UiCheckbox v-model="selected" disabled accent="brand" :value="row.id" />
</div>
<UiButtonIcon
v-else-if="column.id === 'more'"
v-tooltip="$t('coming-soon')"
:icon="faEllipsis"
accent="brand"
disabled
size="small"
/>
<div v-else-if="column.id === 'status'" v-tooltip>
<VtsConnectionStatus :status="column.value" />
</div>
<div v-else-if="column.id === 'network'" class="network">
<!-- TODO Remove the span when the link works and the icon is fixed -->
<!--
<UiComplexIcon size="medium" class="icon">
<VtsIcon :icon="faNetworkWired" accent="current" />
<VtsIcon accent="success" :icon="faCircle" :overlay-icon="faCheck" />
</UiComplexIcon>
<a v-tooltip href="" class="text-ellipsis">{{ column.value.name }}</a>
-->
<span v-tooltip class="text-ellipsis">{{ column.value.name }}</span>
<VtsIcon
v-if="column.value.management"
v-tooltip="$t('management')"
accent="info"
:icon="faCircle"
:overlay-icon="faStar"
/>
</div>
<div v-else-if="column.id === 'IP'" class="ip-addresses">
<span v-tooltip class="text-ellipsis">{{ column.value[0] }}</span>
<span v-if="column.value.length > 1" class="typo-body-regular-small more-ips">
{{ `+${column.value.length - 1}` }}
</span>
</div>
<div v-else v-tooltip="{ placement: 'bottom-end' }" class="text-ellipsis">
{{ column.value }}
</div>
</td>
</tr>
</template>
</VtsDataTable>
<VtsStateHero v-if="searchQuery && filteredPifs.length === 0" type="table" image="no-result">
<div>{{ $t('no-result') }}</div>
</VtsStateHero>
<UiTopBottomTable :selected-items="0" :total-items="0" />
</div>
</div>
</template>
<script lang="ts" setup>
import useMultiSelect from '@/composables/multi-select.composable'
import type { XenApiNetwork, XenApiPif } from '@/libs/xen-api/xen-api.types'
import { useNetworkStore } from '@/stores/xen-api/network.store'
import { usePifStore } from '@/stores/xen-api/pif.store'
import VtsConnectionStatus from '@core/components/connection-status/VtsConnectionStatus.vue'
import VtsDataTable from '@core/components/data-table/VtsDataTable.vue'
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import VtsStateHero from '@core/components/state-hero/VtsStateHero.vue'
import UiButton from '@core/components/ui/button/UiButton.vue'
import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
import UiCheckbox from '@core/components/ui/checkbox/UiCheckbox.vue'
import UiQuerySearchBar from '@core/components/ui/query-search-bar/UiQuerySearchBar.vue'
import UiTableActions from '@core/components/ui/table-actions/UiTableActions.vue'
import UiTitle from '@core/components/ui/title/UiTitle.vue'
import UiTopBottomTable from '@core/components/ui/top-bottom-table/UiTopBottomTable.vue'
import { useRouteQuery } from '@core/composables/route-query.composable'
import { useTable } from '@core/composables/table.composable'
import { vTooltip } from '@core/directives/tooltip.directive'
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
import {
faAlignLeft,
faAt,
faCaretDown,
faCircle,
faEdit,
faEllipsis,
faPlus,
faPowerOff,
faStar,
faTrash,
} from '@fortawesome/free-solid-svg-icons'
import { noop } from '@vueuse/shared'
import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
const { pifs } = defineProps<{
pifs: XenApiPif[]
}>()
const { isReady, hasError } = usePifStore().subscribe()
const { getByOpaqueRef } = useNetworkStore().subscribe()
const { getPifStatus } = usePifStore().subscribe()
const { t } = useI18n()
const selectedPifId = useRouteQuery('id')
const pifsUuids = computed(() => pifs.map(pif => pif.uuid))
const { selected, areAllSelected } = useMultiSelect(pifsUuids)
const getNetworkName = (networkRef: XenApiNetwork['$ref']) => getByOpaqueRef(networkRef)?.name_label
const getVlanData = (vlan: number) => (vlan !== -1 ? vlan : t('none'))
const getIpAddresses = (pif: XenApiPif) => [pif.IP, ...pif.IPv6].filter(ip => ip)
const getIpConfigurationMode = (ipMode: string) => {
switch (ipMode) {
case 'Static':
return t('static')
case 'DHCP':
return t('dhcp')
default:
return t('none')
}
}
const searchQuery = ref('')
const filteredPifs = computed(() => {
const searchTerm = searchQuery.value.trim().toLocaleLowerCase()
if (!searchTerm) {
return pifs
}
return pifs.filter(pif =>
[...Object.values(pif), getNetworkName(pif.network)].some(value =>
String(value).toLocaleLowerCase().includes(searchTerm)
)
)
})
const { visibleColumns, rows } = useTable('pifs', filteredPifs, {
rowId: record => record.uuid,
columns: define => [
define('checkbox', noop, { label: '', isHideable: false }),
define(
'network',
record => ({
name: getNetworkName(record.network),
management: record.management,
}),
{ label: t('network') }
),
define('device', { label: t('device') }),
define('status', record => getPifStatus(record), { label: t('status') }),
define('VLAN', record => getVlanData(record.VLAN), { label: t('vlan') }),
define('IP', record => getIpAddresses(record), { label: t('ip-addresses') }),
define('MAC', { label: t('mac-addresses') }),
define('ip_configuration_mode', record => getIpConfigurationMode(record.ip_configuration_mode), {
label: t('ip-mode'),
}),
define('more', noop, { label: '', isHideable: false }),
],
})
type PifHeader = 'network' | 'device' | 'status' | 'VLAN' | 'IP' | 'MAC' | 'ip_configuration_mode'
const headerIcon: Record<PifHeader, IconDefinition> = {
network: faAlignLeft,
device: faAlignLeft,
status: faPowerOff,
VLAN: faAlignLeft,
IP: faAt,
MAC: faAt,
ip_configuration_mode: faCaretDown,
}
</script>
<style scoped lang="postcss">
.host-pif-table,
.table-actions,
.container {
display: flex;
flex-direction: column;
}
.host-pif-table {
gap: 2.4rem;
.container,
.table-actions {
gap: 0.8rem;
}
.network {
display: flex;
align-items: center;
gap: 1.8rem;
}
.ip-addresses {
display: flex;
justify-content: space-between;
align-items: center;
.more-ips {
color: var(--color-neutral-txt-secondary);
}
}
.checkbox,
.more {
width: 4.8rem;
}
.checkbox {
text-align: center;
line-height: 1;
}
}
</style>

View File

@@ -1,14 +1,18 @@
<template>
<VtsTreeItem v-if="host !== undefined" :expanded="isExpanded" class="infra-host-item">
<UiTreeItemLabel :icon="faServer" :route="{ name: 'host.console', params: { uuid: host.uuid } }" @toggle="toggle()">
<UiTreeItemLabel
:icon="faServer"
:route="{ name: 'host.dashboard', params: { uuid: host.uuid } }"
@toggle="toggle()"
>
{{ host.name_label || '(Host)' }}
<template #addons>
<UiIcon v-if="isPoolMaster" v-tooltip="$t('master')" :icon="faStar" accent="warning" />
<VtsIcon v-if="isPoolMaster" v-tooltip="$t('master')" accent="info" :icon="faCircle" :overlay-icon="faStar" />
<UiCounter
v-if="isReady"
v-tooltip="$t('running-vm', { count: vmCount })"
:value="vmCount"
accent="info"
accent="brand"
variant="secondary"
size="small"
/>
@@ -28,29 +32,29 @@ import type { XenApiHost } from '@/libs/xen-api/xen-api.types'
import { useHostStore } from '@/stores/xen-api/host.store'
import { usePoolStore } from '@/stores/xen-api/pool.store'
import { useVmStore } from '@/stores/xen-api/vm.store'
import UiIcon from '@core/components/icon/VtsIcon.vue'
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import VtsTreeItem from '@core/components/tree/VtsTreeItem.vue'
import VtsTreeList from '@core/components/tree/VtsTreeList.vue'
import UiCounter from '@core/components/ui/counter/UiCounter.vue'
import UiTreeItemLabel from '@core/components/ui/tree-item-label/UiTreeItemLabel.vue'
import { vTooltip } from '@core/directives/tooltip.directive'
import { faServer, faStar } from '@fortawesome/free-solid-svg-icons'
import { faCircle, faServer, faStar } from '@fortawesome/free-solid-svg-icons'
import { useToggle } from '@vueuse/shared'
import { computed } from 'vue'
const props = defineProps<{
const { hostOpaqueRef } = defineProps<{
hostOpaqueRef: XenApiHost['$ref']
}>()
const { getByOpaqueRef } = useHostStore().subscribe()
const host = computed(() => getByOpaqueRef(props.hostOpaqueRef))
const host = computed(() => getByOpaqueRef(hostOpaqueRef))
const { pool } = usePoolStore().subscribe()
const isPoolMaster = computed(() => pool.value?.master === props.hostOpaqueRef)
const isPoolMaster = computed(() => pool.value?.master === hostOpaqueRef)
const { recordsByHostRef, isReady } = useVmStore().subscribe()
const { runningVms, isReady } = useVmStore().subscribe()
const vmCount = computed(() => recordsByHostRef.value.get(props.hostOpaqueRef)?.length ?? 0)
const vmCount = computed(() => runningVms.value.filter(vm => vm.resident_on === hostOpaqueRef)?.length ?? 0)
const [isExpanded, toggle] = useToggle(true)
</script>

View File

@@ -14,7 +14,7 @@
<div v-if="newFilters.some(filter => filter.isAdvanced)" class="available-properties">
{{ $t('available-properties-for-advanced-filter') }}
<div class="properties typo p1-regular">
<div class="properties typo-body-regular">
<UiBadge v-for="(filter, property) in availableFilters" :key="property" :icon="getFilterIcon(filter)">
{{ property }}
</UiBadge>
@@ -23,7 +23,7 @@
</template>
<template #buttons>
<UiButton size="medium" accent="info" variant="tertiary" @click="addNewFilter()">
<UiButton size="medium" accent="brand" variant="tertiary" @click="addNewFilter()">
{{ $t('add-or') }}
</UiButton>
<ModalDeclineButton />

View File

@@ -6,7 +6,7 @@
</template>
<template #buttons>
<UiButton size="medium" accent="info" variant="tertiary" @click="formatJson()">
<UiButton size="medium" accent="brand" variant="tertiary" @click="formatJson()">
{{ $t('reformat') }}
</UiButton>
<ModalDeclineButton />

View File

@@ -0,0 +1,109 @@
<template>
<tr class="pif-row" :class="{ clickable: pifHost }" @click="pifHost?.redirect()">
<td v-tooltip class="typo-body-regular-small text-ellipsis host-container">
<div v-if="pifHost" class="host">
<UiObjectIcon :state="pifHost.powerState" type="host" size="small" />
<span v-tooltip class="typo-body-regular-small text-ellipsis host-name">
{{ pifHost.label }}
</span>
</div>
<div v-else>
<span>{{ $t('host-unknown') }}</span>
</div>
</td>
<td v-tooltip class="typo-body-regular-small text-ellipsis device">{{ pif.device }}</td>
<td v-tooltip class="typo-body-regular-small status">
<VtsConnectionStatus :status />
</td>
<td>
<UiButtonIcon size="small" accent="brand" :icon="faAngleRight" :disabled="!pifHost" />
</td>
</tr>
</template>
<script setup lang="ts">
import type { XenApiPif } from '@/libs/xen-api/xen-api.types'
import { useHostMetricsStore } from '@/stores/xen-api/host-metrics.store'
import { useHostStore } from '@/stores/xen-api/host.store'
import { usePifStore } from '@/stores/xen-api/pif.store'
import VtsConnectionStatus from '@core/components/connection-status/VtsConnectionStatus.vue'
import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
import UiObjectIcon from '@core/components/ui/object-icon/UiObjectIcon.vue'
import { vTooltip } from '@core/directives/tooltip.directive'
import { faAngleRight } from '@fortawesome/free-solid-svg-icons'
import { computed } from 'vue'
import { useRouter } from 'vue-router'
const { pif } = defineProps<{
pif: XenApiPif
}>()
const { getByOpaqueRef } = useHostStore().subscribe()
const { isHostRunning } = useHostMetricsStore().subscribe()
const { getPifStatus } = usePifStore().subscribe()
const router = useRouter()
const status = computed(() => getPifStatus(pif))
const pifHost = computed(() => {
const host = getByOpaqueRef(pif.host)
if (!host) {
return
}
return {
label: host.name_label,
powerState: isHostRunning(host) ? 'running' : 'halted',
redirect() {
router.push({
name: 'host.network',
params: { uuid: host.uuid },
query: { id: pif.uuid },
})
},
} as const
})
</script>
<style lang="postcss" scoped>
.pif-row {
&.clickable {
cursor: pointer;
&:hover {
background-color: var(--color-brand-background-hover);
}
}
td {
color: var(--color-neutral-txt-primary);
}
.host-container {
width: 14rem;
max-width: 14rem;
.host {
display: flex;
align-items: center;
gap: 0.8rem;
}
.host-name {
color: var(--color-brand-txt-base);
}
}
.device {
width: 8rem;
max-width: 8rem;
}
.status {
width: 11.5rem;
max-width: 11.5rem;
}
}
</style>

Some files were not shown because too many files have changed in this diff Show More