Compare commits

...

237 Commits

Author SHA1 Message Date
Pierre Donias
674ed4384a feat(xo-server): 5.28.0 2018-10-05 14:00:27 +02:00
Pierre Donias
1d7d83f8c6 feat(xo-acl-resolver): 0.3.0 2018-10-05 13:51:18 +02:00
Pierre Donias
f812cc2729 feat(xo-server-usage-report): 0.6.0 2018-10-05 13:49:36 +02:00
Pierre Donias
abc50a5e84 feat(xo-vmdk-to-vhd): 0.1.5 2018-10-05 13:47:44 +02:00
Pierre Donias
e94cae3044 feat(vhd-lib): 0.3.2 2018-10-05 13:45:06 +02:00
Pierre Donias
0b35a35576 feat(xo-server/vm.clone): add admin ACL and allocate Self resources (#3493)
Fixes #3139
2018-10-05 12:07:28 +02:00
badrAZ
0253c63db3 feat(acls): allow VM operators to create/delete snapshots (#3482)
Fixes #3443
2018-10-05 11:48:42 +02:00
Julien Fontanet
0d3b2bc814 fix(vhd-lib,xo-vmdk-to-vhd): add polyfill for Symbol.asyncIterator (#3492)
Fixes part of #3468.
Fixes tests on CI.
2018-10-05 10:44:03 +02:00
Julien Fontanet
65307e5bc7 fix(xo-server/xapi#exportVm): destroy snapshot on getResource failure 2018-10-05 09:51:48 +02:00
Julien Fontanet
90de47d708 chore(xo-server/xapi#exportVm): minor code improvement 2018-10-05 09:51:48 +02:00
Julien Fontanet
72a4179c03 chore(xo-server/xapi): add metadata to {export,import}Vm errors 2018-10-05 09:51:48 +02:00
badrAZ
4eee195d21 fix(CHANGELOG): add entries related to #3475 (#3489) 2018-10-04 16:56:17 +02:00
badrAZ
9488711406 feat(xo-server-usage-report): top 3 used SRs instead of big SRs (#3475)
Fixes #3307
2018-10-04 16:08:18 +02:00
Julien Fontanet
4cf04aca72 feat(cr-seed-cli): 0.2.0 2018-10-04 15:09:22 +02:00
Julien Fontanet
410d6762bf fix(cr-seed-cli): set xo:backup:exported on snapshot
Related to bdefd0bcd
2018-10-04 15:08:16 +02:00
Julien Fontanet
0a95426e63 fix(xo-server/delta NG): detection of removed disks
Related to eb9655125
2018-10-04 14:53:33 +02:00
Julien Fontanet
4ec4970d49 chore(async-map): build for tests 2018-10-03 21:27:56 +02:00
Julien Fontanet
e57ae0a8ce chore(xo-server): add support for ?? 2018-10-03 16:00:24 +02:00
badrAZ
1e7852369f feat(xo-server/xapi-stats): expose VM IOPS metric (#3454) 2018-10-03 15:50:35 +02:00
Julien Fontanet
bdefd0bcd8 feat(xo-server/delta NG): mark successfully exported snapshots (#3485)
Allows runs after failure/interruption to be deltas.
Also, allows some schedules to only do rolling snapshots without breaking the exports.

Thanks a lot to @Samuel-BF for PR #3466.
2018-10-03 15:36:08 +02:00
badrAZ
fa88e1789c fix(xo-web/backup-ng/new): fix retention default value (#3486) 2018-10-03 15:26:48 +02:00
Pierre Donias
df90094cae feat(xo-web/pool/patches): extra modal before bulk install (#3484)
Fixes #3252
2018-10-03 15:15:04 +02:00
Pierre Donias
efdbc18a0a feat(xo-web/home/pool): show # of *unique* available patches (#3483)
Fixes #3321
2018-10-03 09:17:35 +02:00
Julien Fontanet
fc1dd3ce09 chore(xo-cli): got → http-request-plus 2018-10-02 20:19:43 +02:00
Julien Fontanet
10aff53d2c chore(xo-server-cloud): superagent → http-request-plus 2018-10-02 19:57:27 +02:00
Pierre Donias
85c3d64c04 feat(xo-web/host/network): private networks (#3481)
Fixes #3387
2018-10-02 14:42:24 +02:00
badrAZ
5a71ab53be feat(xo-acl-resolver): allow ACLs on VM snapshots (#3480)
Related to #3443
2018-10-02 13:33:26 +02:00
Julien Fontanet
d022b40732 chore: update dependencies 2018-10-02 12:01:14 +02:00
Pierre Donias
e105c0aad1 feat(xo-web/host/networks): remove "Add network" button (#3478)
Fixes #3386
2018-10-02 11:38:28 +02:00
Julien Fontanet
eb9655125c fix(xo-server/delta NG): handle removed disks (#3479) 2018-10-02 11:31:11 +02:00
Julien Fontanet
a10fea2823 chore(xo-server/xapi/utils): remove NULL_REF in favor of xen-api 2018-10-02 11:07:19 +02:00
badrAZ
0c05d89d3f fix(xo-web/VM/snapshot): allow VM admin to access snapshot tab (#3477) 2018-10-02 10:52:36 +02:00
Pierre Donias
d600d4cc28 chore(CHANGELOG): 5.27.1 2018-09-28 17:08:42 +02:00
Pierre Donias
4f0e5317ed feat(xo-web): 5.27.1 2018-09-28 17:05:40 +02:00
Pierre Donias
fce7c7fd49 feat(xo-server): 5.27.2 2018-09-28 17:04:48 +02:00
Pierre Donias
929ca767ca feat(xo-vmdk-to-vhd): 0.1.4 2018-09-28 17:01:43 +02:00
Pierre Donias
342c1bc6fa feat(vhd-lib): 0.3.1 2018-09-28 16:58:46 +02:00
Pierre Donias
317e301067 feat(fs): 0.3.1 2018-09-28 16:56:01 +02:00
Julien Fontanet
ac5741a341 fix(xo-server/deleteVm): build disks list before deleting VM (#3465)
Otherwise there is a race condition and VBD records might have been removed from cache before listing the VM disks due to destroying the VM.
2018-09-28 16:48:21 +02:00
badrAZ
3f1fb7092b fix(xo-web/modal#form): prevent default behavior of submit (#3462) 2018-09-28 11:42:47 +02:00
Julien Fontanet
7298a8b8f0 fix(fs/NfsHandler): race conds on sync() (#3460)
Fixes #3380
2018-09-28 11:40:12 +02:00
Julien Fontanet
856924c970 chore(log): remove @babel-polyfill dep 2018-09-26 17:41:43 +02:00
Julien Fontanet
9a285d280f chore(fs/NfsHandler): merge _loadRealMounts and _matchesRealMount in _sync 2018-09-26 17:00:47 +02:00
Julien Fontanet
9c3fc56d4a chore(fs/NfsHandler#_umount): remove unused remote param 2018-09-26 17:00:47 +02:00
Julien Fontanet
aaaee45eeb chore(xo-server): remove @babel/polyfill (#3453)
Fixes #2580
Fixes #2820
2018-09-26 14:22:02 +02:00
Nicolas Raynaud
ac2ab21826 fix(vhd-lib): fix geometry computation for more than 2^28 sectors (#3451)
Fixes https://gitlab.com/vates/xoa-support/issues/942
It was a bug in the disk geometry computation.
2018-09-25 14:51:17 +02:00
badrAZ
b22514646e feat(xo-web/backup-ng/overview): display the schedule's name (#3445)
Fixes #3444
2018-09-24 13:43:49 +02:00
Julien Fontanet
c7ab1ddb0c chore: update dependencies 2018-09-24 13:39:31 +02:00
Pierre Donias
7ddc595a1c fix(xo-web/file-restore): incorrect line-through on similar filenames (#3447) 2018-09-24 11:09:45 +02:00
Pierre Donias
4147800266 fix(xo-web/file-restore): ensure folder path trailing slash (#3446) 2018-09-24 10:52:48 +02:00
Pierre Donias
99e6d54647 chore(CHANGELOG): 5.27.0 2018-09-24 10:01:39 +02:00
Julien Fontanet
dac5901c6b feat(xo-server): 5.27.1 2018-09-22 14:01:24 +02:00
Julien Fontanet
308928a7d4 feat(xen-api): 0.19.0 2018-09-22 14:00:55 +02:00
Julien Fontanet
e6e3d2cd52 chore: update http-request-plus to 0.6.0 2018-09-22 13:06:30 +02:00
Pierre Donias
2e01de7ff8 feat(xo-web): 5.27.0 2018-09-21 18:02:57 +02:00
Pierre Donias
90f94da4e4 feat(xo-server): 5.27.0 2018-09-21 18:01:27 +02:00
Pierre Donias
29b5acef3f chore(xo): packages should not be private 2018-09-21 17:50:49 +02:00
Pierre Donias
599b094b50 feat(xo-server-backup-reports): 0.14.0 2018-09-21 17:43:41 +02:00
Julien Fontanet
7c6e423d24 fix(Backup NG): remove all unnecessary snapshots (#3439)
Even those from other schedules.

Fixes #3132
2018-09-21 17:37:49 +02:00
badrAZ
82956af785 fix(xo-web/logs): fix @xen-orchestra/log import (#3441) 2018-09-21 15:36:54 +02:00
badrAZ
6ca09dc9fe feat(xo-web/vm/tab-advanced): ability to set the NIC type (#3440)
Fixes #3423
2018-09-21 15:30:23 +02:00
badrAZ
e0ecbab841 feat(xo-server/vm): ability to change NIC type (#3437)
See #3423
2018-09-21 14:42:43 +02:00
Julien Fontanet
83d1a5ff13 feat(defined): helpers to deal with undefined (#3436)
Extracted from xo-web.
2018-09-21 11:56:33 +02:00
badrAZ
a71740d49a feat(backup-ng): ability to restart all failed VMs (#3420)
Fixes #3339
2018-09-20 17:05:57 +02:00
Julien Fontanet
0215c19d1d feat(xo-server/proxy-console): work around missing host (#3435)
Fixes #3432
2018-09-20 14:47:39 +02:00
Julien Fontanet
ea1c3ab54a fix(xo-server/delta NG): dont start export before all targets ready (#3427)
Fixes #3424
2018-09-20 14:38:45 +02:00
badrAZ
b98b618be8 fix(xo-server-backup-reports): handle log not found (#3430) 2018-09-20 14:34:29 +02:00
Julien Fontanet
5e363761a2 fix(xo-server/proxy-console): pass hostname to net.connect 2018-09-20 10:25:47 +02:00
Julien Fontanet
62d48bd59d fix(async-map): apply → call 😖
Fixes #3431
2018-09-20 10:04:09 +02:00
badrAZ
a0049bae8d fix(xo-web/backup-ng): make log value dynamic in copy/report buttons (#3360)
Fixes #3273
2018-09-18 15:15:59 +02:00
Julien Fontanet
18660cb0e1 fix(async-map): accept objects as collection 2018-09-18 12:10:44 +02:00
Julien Fontanet
e3c6c1c1ca chore(async-map): use lodash/map import 2018-09-18 12:10:43 +02:00
badrAZ
56114a7d18 feat(xo-server-backup-report): ability to test the plugin (#3421) 2018-09-17 17:23:45 +02:00
Julien Fontanet
0fe70b1a91 feat(log): new lib to help logging (#3414)
Fixes #2414
Related to #1669
2018-09-17 17:02:27 +02:00
Julien Fontanet
527eb0b1e6 feat(async-map): better Promise.all + map (#3422) 2018-09-17 16:37:49 +02:00
Julien Fontanet
cfd6fd722a feat(mixin): split a class in independant parts (#3415) 2018-09-17 16:33:21 +02:00
badrAZ
42591bd4bd feat(xo-web/VM): display the PVHVM status (#3418)
Fixes #3014
2018-09-17 11:06:19 +02:00
Julien Fontanet
8689cff26b feat(emit-async): handle async listeners (#3416)
Extracted from xo-server.
2018-09-17 10:42:22 +02:00
badrAZ
b4e4d32255 feat(xo-web/backup-ng/overview): display transferred and merged data size (#3408) 2018-09-14 17:21:06 +02:00
Julien Fontanet
18c88ba770 feat(cr-seed-cli): CLI to help CR seeding (#3346) 2018-09-14 17:04:55 +02:00
badrAZ
d212168f59 feat(xo-web/backup-ng/new): use a modal for creating/editing a schedule (#3359)
Fixes #3138
2018-09-14 15:53:28 +02:00
Julien Fontanet
3625477187 fix(xo-web/xoa-updater): wait trial request before checking state (#3412)
Fixes #3407
2018-09-14 12:26:41 +02:00
Pierre Donias
9be8525439 await xoaState 2018-09-14 12:04:19 +02:00
Pierre Donias
6e013a0dc5 PR 2018-09-14 11:54:39 +02:00
Pierre Donias
06d555d4f9 fix(xo-web/xoa-updater): wait for trial request before checking trial state
Fixes #3407
2018-09-14 11:51:43 +02:00
Julien Fontanet
63fe0f2c88 fix(xo-server/importDeltaVm): dont fail on empty VBDs (#3410) 2018-09-14 10:37:09 +02:00
Julien Fontanet
2a276dfb99 changelog 2018-09-14 10:36:49 +02:00
Julien Fontanet
1f009ca954 fix(xo-server/importDeltaVm): dont fail on empty VBDs 2018-09-13 17:27:11 +02:00
badrAZ
5cf1ba41f3 feat(xo-web/modal#form): support an additional icon to the title (#3409) 2018-09-13 16:58:03 +02:00
badrAZ
1ef205cb74 feat(xo-web/backup-ng/new): tip for creating vms on a thin-provisioned storage (#3402)
Fixes #3334
2018-09-13 16:23:51 +02:00
Julien Fontanet
1e59af3ab2 fix(xo-server/deleteVm): dont delete VDIs/VIFs if destroy is blocked (#3406) 2018-09-13 11:44:17 +02:00
badrAZ
bb88b420c1 chore(xo-web/backup-ng/new): make "setSchedule" support multiple params (#3404) 2018-09-12 13:53:37 +02:00
badrAZ
e8475d144c chore(xo-web/backup-ng/new): improve new schedule implementation (#3348) 2018-09-12 13:43:02 +02:00
badrAZ
dedac62269 feat(xo-web): implementation of the modal dedicated to forms (#3358) 2018-09-11 17:31:20 +02:00
badrAZ
f8fdd888c4 fix(xo-web/remotes): error appears twice on testing (#3399) 2018-09-11 17:27:10 +02:00
Julien Fontanet
d8bd30e355 feat(xo-web/remotes): use WORKGROUP as default SMB domain (#3398) 2018-09-11 10:46:52 +02:00
badrAZ
4fec816274 feat(xo-web/settings/remotes): test on creation/edition (#3397)
See #3323
2018-09-11 10:09:16 +02:00
badrAZ
1211447e81 fix(xo-web/settings/remotes): rename connect(ed)/disconnect(ed) to enable(d)/disable(d) (#3396)
See #3323
2018-09-10 17:15:33 +02:00
Julien Fontanet
ed78f4c5ee fix(xo-server/backup NG): third time is the charm (sigh) 2018-09-10 10:59:56 +02:00
Julien Fontanet
4a2e9d4c88 fix(xo-server/backup NG): CancelToken.race → .source 2018-09-10 10:51:05 +02:00
Julien Fontanet
1807917204 fix(xo-server/backup NG): CancelToken#fork() no longer exists
Issue introduced in b3004a38a
2018-09-10 10:47:53 +02:00
Julien Fontanet
b3004a38aa chore: update promise-toolbox to v0.10 (#3392) 2018-09-07 14:34:47 +02:00
Pierre Donias
0ad6c073ee chore(CHANGELOG): 5.26.0 2018-09-07 11:39:26 +02:00
Pierre Donias
0abaadb391 feat(xo-web): 5.26.0 2018-09-07 11:37:12 +02:00
Pierre Donias
b43cf27479 feat(xo-server): 5.26.0 2018-09-07 11:36:20 +02:00
Julien Fontanet
bcab6bb584 fix(xo-server/listReplicatedVms): dont use snapshot_time (#3394)
It is not always set on VMs imported from snapshots, add a new metadata in `other_config` and use the timestamp in the name_label a fallback.

Fixes #3391
2018-09-07 11:31:57 +02:00
Pierre Donias
8213601df6 chore(xo-web/VM,host,pool,SR): better UUID display (#3390) 2018-09-05 16:44:18 +02:00
Pierre Donias
e7ad577661 feat(xo-server,xo-web/VM): start on specific host (#3389)
Fixes #3191
2018-09-05 16:39:12 +02:00
Julien Fontanet
070213dd7f fix(xo-server/collection/redis): ignore undefined values (#3388)
Fixes #3385
2018-09-05 15:18:47 +02:00
Julien Fontanet
395cbb33ef chore: update dependencies 2018-09-05 09:42:10 +02:00
Julien Fontanet
a429a7aa35 feat(babel-config): same targets for all builds 2018-09-04 16:43:42 +02:00
Julien Fontanet
b70e09937b fix(babel-config): dont ignore pkg.browserslist entry 2018-09-04 16:41:28 +02:00
Pierre Donias
109ff4a4da feat(xo-web/backupNg): support restoring directories (#3384)
Fixes #1924
See #3300
2018-09-04 16:00:42 +02:00
Pierre Donias
0e185ab92a fix(xo-web/Backup NG): remove unsupported TAR file restore option (#3383) 2018-09-03 16:50:36 +02:00
Julien Fontanet
aefb76a4f6 fix(xo-server/file restore): support trailing slashes 2018-09-03 16:40:35 +02:00
Julien Fontanet
fe653dc7dd feat(xo-server): add job name in replicated VMs (#3379)
See support#891
2018-09-03 14:05:32 +02:00
Julien Fontanet
8b5c0e706c chore(xo-server/collection#first): returns undefined instead of null (#3382)
Fixes an issue introduced in 1407fb7bab in
`Remotes#getRemote()`.
2018-09-03 12:03:50 +02:00
Pierre Donias
d25584edf9 feat(xo-web/tasks): show finished tasks (#3377)
Fixes #3266
2018-08-31 17:19:03 +02:00
Pierre Donias
496ca2c716 fix(xo-web/XoItem): link should not open in new tab by default (#3376) 2018-08-31 14:40:00 +02:00
Julien Fontanet
4a09074a40 chore: update yarn.lock 2018-08-31 14:30:59 +02:00
Julien Fontanet
385fd80bb9 chore(xo-server-transport-xmpp): use Babel 7 2018-08-31 14:30:59 +02:00
Julien Fontanet
b6818abd0d chore(xo-server-transport-slack): use Babel 7 2018-08-31 14:30:59 +02:00
Julien Fontanet
45b5d10f1b chore(xo-server-transport-nagios): use Babel 7 2018-08-31 14:30:59 +02:00
Julien Fontanet
7866a265fe chore(xo-server-transport-email): use Babel 7 2018-08-31 14:30:59 +02:00
Julien Fontanet
774c0d09b1 chore(xo-server-auth-saml): use Babel 7 2018-08-31 14:30:59 +02:00
Julien Fontanet
df0029db3b chore(xo-server-auth-google): use Babel 7 2018-08-31 14:30:59 +02:00
Julien Fontanet
c1a5364448 chore(xo-server-auth-github): use Babel 7 2018-08-31 14:30:58 +02:00
Julien Fontanet
557ba1a4bc chore(xo-lib): use Babel 7 2018-08-31 14:30:58 +02:00
Julien Fontanet
bf932aada1 chore(xo-common): use Babel 7 2018-08-31 14:30:58 +02:00
Pierre Donias
2304deab3f fix(xo-web/vm/disks): individual actions 2018-08-31 14:18:14 +02:00
Julien Fontanet
ea9c0cfb10 fix(xo-web): export/import from Starter Edition 2018-08-31 13:14:31 +02:00
Pierre Donias
2fd5a6501b feat(xo-web/menu): hide Tasks entry for self users (#3373)
Fixes #3311
2018-08-30 15:44:30 +02:00
Pierre Donias
0ca5a32142 feat(xo-web/backup ng/restore): sort backups in select (#3374)
Fixes #3294
2018-08-30 13:38:02 +02:00
Julien Fontanet
f55f812d30 fix(linting): use legacy decorators 2018-08-30 11:53:27 +02:00
Julien Fontanet
98bbd53c28 fix(xo-server/log.delete): delSync does not exist
Fixes #3372
2018-08-29 18:21:48 +02:00
Julien Fontanet
1f0bfe2518 chore: update dependencies 2018-08-29 15:06:11 +02:00
Julien Fontanet
c5eae6e498 chore(xo-vmdk-to-vhd): remove unnecessary Babel runtime 2018-08-29 15:06:11 +02:00
Julien Fontanet
bfcdd29f10 chore(xo-collection): remove unnecessary Babel runtime 2018-08-29 15:06:11 +02:00
Julien Fontanet
8db0b59fe1 chore(fs): remove unnecessary Babel runtime 2018-08-29 15:06:10 +02:00
Julien Fontanet
6bc4c03b4c chore(vhd-cli): remove unnecessary Babel runtime 2018-08-29 15:06:10 +02:00
Julien Fontanet
4d63f93390 chore(vhd-lib): remove unnecessary Babel runtime 2018-08-29 15:06:10 +02:00
Pierre Donias
9722f2a5bd fix(xo-web/createVms): dont noop confirm modal rejection (#3371)
Fixes #3268
2018-08-29 13:14:07 +02:00
Pierre Donias
ee9c6817d6 fix(xo-web/new XOSAN): ignore detached local SRs (#3370) 2018-08-29 10:57:39 +02:00
Jon Sands
58564306ca (docu) fix backup grammar (#3369)
* (docu) fix backup grammar
2018-08-28 20:35:46 +02:00
Julien Fontanet
17c6f1762d chore: update dependencies 2018-08-28 20:29:29 +02:00
Julien Fontanet
17f13307bb fix(xo-server/listVmBackupsNg): dont fail on problematic remote (#3367)
Fixes #3365
2018-08-28 17:04:32 +02:00
Pierre Donias
a43c141ddd fix(xo-server/self): synchronize allocate and release together (#3368) 2018-08-28 16:54:17 +02:00
Pierre Donias
1e6da359cc fix(CHANGELOG): wrong xo-server version 2018-08-27 16:37:59 +02:00
Pierre Donias
626a9a777f feat(xo-web): 5.25.1 2018-08-27 16:35:04 +02:00
Pierre Donias
2768ad9e3b feat(xo-server): 5.25.2 2018-08-27 16:33:52 +02:00
Pierre Donias
3eec8f1a55 chore(CHANGELOG): 5.25.1 2018-08-27 16:28:36 +02:00
badrAZ
6148daa8b8 fix(CHANGELOG): move fix to correct release (#3357) 2018-08-27 16:17:54 +02:00
Julien Fontanet
338de7985f chore(docs/troubleshooting): must restart after memory setting 2018-08-27 15:59:33 +02:00
Julien Fontanet
df99528445 chore(CHANGELOG): improve import/export VDI entry 2018-08-27 14:41:10 +02:00
Julien Fontanet
890901366d fix(xo-server/{export,import}Vm): dont pass host (#3364)
Relies on redirection handling in `xen-api`.
2018-08-27 14:33:14 +02:00
Julien Fontanet
13271aa196 fix(CHANGELOG): move fix in next release 2018-08-27 11:45:59 +02:00
badrAZ
71aea20c7d fix(xo-server/jobs): fix race condition between end log and consolidation (#3238)
Fixes #3018
2018-08-27 11:44:50 +02:00
Julien Fontanet
b09da76b04 fix(xo-server/{export,import}Vdi): dont pass host (#3355)
Relies on redirection handling in `xen-api`.

Fixes #3354
2018-08-27 11:03:08 +02:00
Pierre Donias
ce35bbaeb4 fix(xo-server,xo-web): NFS remotes mount options (#3363)
Fixes #3361
2018-08-27 10:39:35 +02:00
Julien Fontanet
0034f0a1d3 feat(xo-server): 5.25.1 2018-08-23 13:47:52 +02:00
Julien Fontanet
e3391fa81f fix(xo-server/file restore): await addDirectory() 2018-08-23 13:47:30 +02:00
Pierre Donias
bacdc63c70 feat(xo-web): 5.25.0 2018-08-23 12:37:53 +02:00
Pierre Donias
b0285799c6 feat(xo-server): 5.25.0 2018-08-23 12:36:43 +02:00
Pierre Donias
f8b34c5d64 feat(@xen-orchestra/fs): 0.3.0 2018-08-23 12:33:21 +02:00
Pierre Donias
40f4a66bda feat(xo-server-backup-reports): 0.13.0 2018-08-23 12:30:56 +02:00
Pierre Donias
6125dae158 chore(CHANGELOG): 5.25.0 2018-08-23 12:26:45 +02:00
Pierre Donias
dfe4a934e9 feat(remotes): allow setting NFS mount options (#3353)
Fixes #1793
2018-08-23 11:34:56 +02:00
badrAZ
ecc33f46ab fix(xo-web/backup-ng/new): fix selected SRs issues (#3352)
Issue introduced in ec869ffd
2018-08-23 11:32:30 +02:00
Julien Fontanet
00d1985cf9 feat(xo-server/jobs): add job name to logs (#3351)
Fixes #3272
2018-08-23 11:29:42 +02:00
badrAZ
138aed8ae1 feat(xo-web/backup-ng/new): set default retention to 1 (#3290)
Fixes #3134
2018-08-23 10:18:29 +02:00
badrAZ
def9f947b7 feat(xo-web/new-vm): show error when getting coreOS default template fails (#3343)
Fixes #3227
2018-08-23 10:15:45 +02:00
Julien Fontanet
20dc4af4a4 fix(xo-server/importVdiContent): HOST → host 2018-08-22 18:07:57 +02:00
Julien Fontanet
4d2909567c feat(xo-server/snapshotVm): tag xo-disable-quiesce (#3350) 2018-08-22 15:15:05 +02:00
Julien Fontanet
92a93e4393 chore(xo-server): use xen-api 0.18.0 2018-08-21 18:27:45 +02:00
Julien Fontanet
389967d40c feat(xen-api): 0.18.0 2018-08-21 18:24:04 +02:00
Julien Fontanet
d66e8f29b7 feat(xen-api): add methods to mutate fields
- `setField()`
- `setFieldEntry()`
- `unsetFieldEntry()`
- `setFieldEntries()`
2018-08-21 18:15:38 +02:00
Julien Fontanet
3e9425bf79 feat(xen-api): add getRecordByUuid() 2018-08-21 17:49:37 +02:00
Julien Fontanet
41506e785e feat(xen-api/getRecord): add $id, $type and $ref props 2018-08-21 17:48:58 +02:00
Julien Fontanet
32d7ccfea5 feat(xen-api): expose null reference 2018-08-21 17:46:59 +02:00
Julien Fontanet
8a9f952ada feat(xen-api): support encoded credentials in URL 2018-08-21 17:46:18 +02:00
badrAZ
d15efae43f fix(xo-web/backup-ng/new): always show compression when full mode (#3345)
Fixes #3236
2018-08-21 10:12:36 +02:00
Julien Fontanet
627c06f4a8 fix(xo-acl-resolver): minor fixes
Due to 563969f2
2018-08-20 17:59:26 +02:00
Julien Fontanet
3e6201e93a chore(xo-server-auth-ldap): use Babel 7 2018-08-20 17:17:26 +02:00
Julien Fontanet
b941a649b5 chore(xo-server-usage-report): use Babel 7 2018-08-20 17:14:14 +02:00
Julien Fontanet
7b2b9ca618 chore(xo-server-load-balancer): use Babel 7 2018-08-20 17:12:33 +02:00
Julien Fontanet
404cf2b7e6 chore(xo-server-backup-reports): use Babel 7 2018-08-20 17:10:43 +02:00
Julien Fontanet
42698293de chore(xo-server-cloud): use Babel 7 2018-08-20 17:04:30 +02:00
Julien Fontanet
563969f2e9 chore(xo-acl-resolver): remove build step 2018-08-20 16:56:32 +02:00
Julien Fontanet
887e21daa5 chore: drop Node 4 compat for XO pkgs 2018-08-20 16:49:27 +02:00
badrAZ
b75a2a8dca feat(xo-web/backup-ng/new): move VMs' selection to dedicated card (#3338)
See #2711
2018-08-20 16:32:28 +02:00
badrAZ
31f32ba23c fix(xo-web/backup-ng/new): rename Export Ret. to Backup Ret. and Copy Ret. to Replication Ret. (#3337)
See #2711
2018-08-20 16:29:55 +02:00
badrAZ
936a4068d5 feat(xo-web/backup-ng/new): ignore replicated VMs by default in smart mode (#3312)
Fixes #2338
2018-08-20 16:29:10 +02:00
Julien Fontanet
266f287774 chore(xen-api): use Babel 7 2018-08-20 15:51:07 +02:00
badrAZ
5808485812 fix(CHANGELOG): missing release of backup-reports (#3341) 2018-08-20 13:51:46 +02:00
Olivier Lambert
b6dd83e32b feat: add local ext SR creation (#3335)
Fixes #3332
2018-08-19 17:12:36 +02:00
Julien Fontanet
2236bd71c4 chore: format with Prettier 2018-08-19 16:46:34 +02:00
badrAZ
ec869ffdd3 feat(xo-web/backup-ng/new): tip when thick-provisioned SR (#3333)
Fixes #3291
2018-08-17 15:31:06 +02:00
badrAZ
1aa4966a92 feat(xo-web/SelectTag): allow non existing tags (#3316) 2018-08-17 10:05:20 +02:00
badrAZ
235da199f9 chore(xo-web/backup-ng): remove useless computed (#3317) 2018-08-16 16:17:02 +02:00
badrAZ
4cad820271 fix(xo-web/select-objects): adding or removing an item from a select make the missing objects disappear (#3315) 2018-08-16 16:11:18 +02:00
Rajaa.BARHTAOUI
4a0b29e1f2 fix(xo-server/migrateVm): take VDIs of snapshot into account (#3298)
See #2557
2018-08-16 15:00:45 +02:00
badrAZ
1db9ca9e31 fix(xo-server/scheduling): default name should be an empty string (#3325) 2018-08-16 14:41:34 +02:00
Julien Fontanet
942ddfa742 feat(xo-server/remotes): sync on use (#3320)
Fixes #2852
2018-08-16 14:39:24 +02:00
Pierre Donias
355cddc044 feat(xo-web/VM): always show Convert button + better label (#3319)
Fixes #3201
2018-08-16 10:14:13 +02:00
Julien Fontanet
c23cccf2ce fix(xo-server/remotes): dont change enabled state on errors (#3318)
See #2852
2018-08-14 17:46:10 +02:00
Julien Fontanet
1407fb7bab chore(xo-server/remotes): merge _getRemote() and getRemote() 2018-08-14 17:10:18 +02:00
Julien Fontanet
4ba542b70f chore(xo-server/remotes): inline Remotes#create() 2018-08-14 17:10:18 +02:00
Julien Fontanet
76f75401ee chore(xo-server/remotes): store handler instances 2018-08-14 17:10:18 +02:00
Julien Fontanet
011cc7ad65 chore(xo-server/updateRemote): remove unused error param 2018-08-14 17:10:17 +02:00
Julien Fontanet
b966e6097f chore(xo-server/models/Remote): remove save() 2018-08-14 17:10:17 +02:00
Julien Fontanet
809e1a35cd chore(xo-server/models/Acl): inline create() and hash() 2018-08-14 17:10:17 +02:00
Julien Fontanet
8e7e1fccbe chore(xo-server/Model): remove unused validate() 2018-08-14 17:10:16 +02:00
Julien Fontanet
e86b30f205 chore(xo-server/Model): remove unused initialize() 2018-08-14 17:10:16 +02:00
Rajaa.BARHTAOUI
7dc0c4cf15 fix(xo-web/New VM): filter out SRs that are not in the template's pool (#3070)
Fixes #3068, fixes #3267
2018-08-14 16:51:32 +02:00
Rajaa.BARHTAOUI
561a9f140d feat(xo-web/host/logs): use SortedTable actions (#3313)
See #3179
2018-08-14 16:28:19 +02:00
badrAZ
ba56114e9f fix(xo-web/backup-ng/new): schedule's name overridden with undefined if it's not been edited (#3288)
Fixes #3286
2018-08-14 12:18:41 +02:00
Pierre Donias
11bd75d2fe feat(xo-web/tasks): remove empty message and let SortedTable handle it (#3305) 2018-08-13 17:21:18 +02:00
Julien Fontanet
ececbaf201 fix(xo-server/remotes): properly ignore async errors 2018-08-13 16:55:56 +02:00
Julien Fontanet
1985134d94 chore(xo-server/remotes): use Array#forEach() 2018-08-13 16:55:56 +02:00
Julien Fontanet
2cc59078b1 chore(xo-server/remotes): inline syncAllRemotes() and forgetAllRemotes() 2018-08-13 16:55:56 +02:00
Julien Fontanet
3d4d7db5da feat(xo-server/logs): double number of entries 2018-08-13 16:55:56 +02:00
Pierre Donias
dc40ceaafe feat(xo-web/SortedTable): always show filter input (#3296)
Fixes #3295
2018-08-13 16:44:31 +02:00
Rajaa.BARHTAOUI
0110e223ee feat(xo-web/Collapse): size prop (#3299) 2018-08-13 14:58:39 +02:00
Julien Fontanet
e7467dca8a feat(xo-server/backupNg): support restoring directories (#3300)
See #1924
2018-08-13 13:32:25 +02:00
Julien Fontanet
4a1e87b534 feat(xen-api/cli): add diff() helper 2018-08-13 11:53:56 +02:00
Olivier Lambert
5a32f904bc add no matching VMs error into troubleshooting for backup (#3297)
* add no matching VMs error into troubleshooting for backup
2018-08-12 10:43:13 +02:00
Julien Fontanet
14d023a9f5 feat(xo-server): 5.24.2 2018-08-10 16:50:43 +02:00
Julien Fontanet
2e5e81e93e feat(xen-api): 0.17.1 2018-08-10 16:50:11 +02:00
Julien Fontanet
c9cc106be6 feat(xo-server): 5.24.1 2018-08-10 12:57:31 +02:00
Julien Fontanet
29fc17f260 fix(xen-api/putResource): ensure taskRef is not sent on probing
This fix an issue introduced in ba6b9682

Fixes #3293.
2018-08-10 12:41:35 +02:00
Julien Fontanet
c7d16fd345 chore(vhd-lib): remove deprecated assert.equal 2018-08-10 11:37:47 +02:00
Julien Fontanet
ffe29b8957 feat(xo-server-cloud): 0.2.4 2018-08-10 11:23:38 +02:00
Julien Fontanet
be1bd9254d chore: update dependencies 2018-08-10 11:21:59 +02:00
Pierre Donias
6156649faa feat(xo-server-cloud): 0.2.3 2018-08-09 17:41:53 +02:00
Pierre Donias
2edddaa835 feat(xo-web): 5.24.0 2018-08-09 17:07:04 +02:00
Pierre Donias
d00fff3d4c feat(xo-server): 5.24.0 2018-08-09 17:05:10 +02:00
Pierre Donias
c0b84ae848 feat(@xen-orchestra/fs): 0.2.1 2018-08-09 16:59:43 +02:00
262 changed files with 8058 additions and 4145 deletions

View File

@@ -10,6 +10,11 @@ module.exports = {
$Shape: true,
},
parser: 'babel-eslint',
parserOptions: {
ecmaFeatures: {
legacyDecorators: true,
},
},
rules: {
'comma-dangle': ['error', 'always-multiline'],
indent: 'off',

View File

@@ -0,0 +1,3 @@
module.exports = require('../../@xen-orchestra/babel-config')(
require('./package.json')
)

View File

@@ -0,0 +1,24 @@
/benchmark/
/benchmarks/
*.bench.js
*.bench.js.map
/examples/
example.js
example.js.map
*.example.js
*.example.js.map
/fixture/
/fixtures/
*.fixture.js
*.fixture.js.map
*.fixtures.js
*.fixtures.js.map
/test/
/tests/
*.spec.js
*.spec.js.map
__snapshots__/

View File

@@ -0,0 +1,49 @@
# @xen-orchestra/async-map [![Build Status](https://travis-ci.org/vatesfr/xen-orchestra.png?branch=master)](https://travis-ci.org/vatesfr/xen-orchestra)
> ${pkg.description}
## Install
Installation of the [npm package](https://npmjs.org/package/@xen-orchestra/async-map):
```
> npm install --save @xen-orchestra/async-map
```
## Usage
**TODO**
## Development
```
# Install dependencies
> yarn
# Run the tests
> yarn test
# Continuously compile
> yarn dev
# Continuously run the tests
> yarn dev-test
# Build for production (automatically called by npm install)
> yarn build
```
## 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
ISC © [Vates SAS](https://vates.fr)

View File

@@ -0,0 +1,50 @@
{
"name": "@xen-orchestra/async-map",
"version": "0.0.0",
"license": "ISC",
"description": "",
"keywords": [],
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/async-map",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"repository": {
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"author": {
"name": "Julien Fontanet",
"email": "julien.fontanet@isonoe.net"
},
"preferGlobal": false,
"main": "dist/",
"bin": {},
"files": [
"dist/"
],
"browserslist": [
">2%"
],
"engines": {
"node": ">=6"
},
"dependencies": {
"lodash": "^4.17.4"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"cross-env": "^5.1.3",
"rimraf": "^2.6.2"
},
"scripts": {
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"clean": "rimraf dist/",
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"prebuild": "yarn run clean",
"predev": "yarn run prebuild",
"prepare": "yarn run build",
"prepublishOnly": "yarn run build"
}
}

View File

@@ -0,0 +1,43 @@
// type MaybePromise<T> = Promise<T> | T
//
// declare export function asyncMap<T1, T2>(
// collection: MaybePromise<T1[]>,
// (T1, number) => MaybePromise<T2>
// ): Promise<T2[]>
// declare export function asyncMap<K, V1, V2>(
// collection: MaybePromise<{ [K]: V1 }>,
// (V1, K) => MaybePromise<V2>
// ): Promise<V2[]>
import map from 'lodash/map'
// Similar to map() + Promise.all() but wait for all promises to
// settle before rejecting (with the first error)
const asyncMap = (collection, iteratee) => {
let then
if (collection != null && typeof (then = collection.then) === 'function') {
return then.call(collection, collection => asyncMap(collection, iteratee))
}
let errorContainer
const onError = error => {
if (errorContainer === undefined) {
errorContainer = { error }
}
}
return Promise.all(
map(collection, (item, key, collection) =>
new Promise(resolve => {
resolve(iteratee(item, key, collection))
}).catch(onError)
)
).then(values => {
if (errorContainer !== undefined) {
throw errorContainer.error
}
return values
})
}
export { asyncMap as default }

View File

@@ -22,18 +22,16 @@ const configs = {
// loose: true,
shippedProposals: true,
targets: __PROD__
? (() => {
let node = (pkg.engines || {}).node
if (node !== undefined) {
const trimChars = '^=>~'
while (trimChars.includes(node[0])) {
node = node.slice(1)
}
return { node: node }
}
})()
: { browsers: '', node: 'current' },
targets: (() => {
let node = (pkg.engines || {}).node
if (node !== undefined) {
const trimChars = '^=>~'
while (trimChars.includes(node[0])) {
node = node.slice(1)
}
}
return { browsers: pkg.browserslist, node }
})(),
useBuiltIns: '@babel/polyfill' in (pkg.dependencies || {}) && 'usage',
}
},

View File

@@ -0,0 +1,117 @@
#!/usr/bin/env node
const defer = require('golike-defer').default
const { NULL_REF, Xapi } = require('xen-api')
const pkg = require('./package.json')
Xapi.prototype.getVmDisks = async function (vm) {
const disks = { __proto__: null }
await Promise.all([
...vm.VBDs.map(async vbdRef => {
const vbd = await this.getRecord('VBD', vbdRef)
let vdiRef
if (vbd.type === 'Disk' && (vdiRef = vbd.VDI) !== NULL_REF) {
disks[vbd.userdevice] = await this.getRecord('VDI', vdiRef)
}
}),
])
return disks
}
defer(async function main ($defer, args) {
if (args.length === 0 || args.includes('-h') || args.includes('--help')) {
const cliName = Object.keys(pkg.bin)[0]
return console.error(
'%s',
`
Usage: ${cliName} <source XAPI URL> <source snapshot UUID> <target XAPI URL> <target VM UUID> <backup job id> <backup schedule id>
${cliName} v${pkg.version}
`
)
}
const [
srcXapiUrl,
srcSnapshotUuid,
tgtXapiUrl,
tgtVmUuid,
jobId,
scheduleId,
] = args
const srcXapi = new Xapi({
allowUnauthorized: true,
url: srcXapiUrl,
watchEvents: false,
})
await srcXapi.connect()
defer.call(srcXapi, 'disconnect')
const tgtXapi = new Xapi({
allowUnauthorized: true,
url: tgtXapiUrl,
watchEvents: false,
})
await tgtXapi.connect()
defer.call(tgtXapi, 'disconnect')
const [srcSnapshot, tgtVm] = await Promise.all([
srcXapi.getRecordByUuid('VM', srcSnapshotUuid),
tgtXapi.getRecordByUuid('VM', tgtVmUuid),
])
const srcVm = await srcXapi.getRecord('VM', srcSnapshot.snapshot_of)
const metadata = {
'xo:backup:datetime': srcSnapshot.snapshot_time,
'xo:backup:job': jobId,
'xo:backup:schedule': scheduleId,
'xo:backup:vm': srcVm.uuid,
}
const [srcDisks, tgtDisks] = await Promise.all([
srcXapi.getVmDisks(srcSnapshot),
tgtXapi.getVmDisks(tgtVm),
])
const userDevices = Object.keys(tgtDisks)
const tgtSr = await tgtXapi.getRecord(
'SR',
tgtDisks[Object.keys(tgtDisks)[0]].SR
)
await Promise.all([
srcXapi.setFieldEntries(srcSnapshot, 'other_config', metadata),
srcXapi.setFieldEntries(srcSnapshot, 'other_config', {
'xo:backup:exported': 'true',
}),
tgtXapi.setField(
tgtVm,
'name_label',
`${srcVm.name_label} (${srcSnapshot.snapshot_time})`
),
tgtXapi.setFieldEntries(tgtVm, 'other_config', metadata),
tgtXapi.setFieldEntries(tgtVm, 'other_config', {
'xo:backup:sr': tgtSr.uuid,
'xo:copy_of': srcSnapshotUuid,
}),
tgtXapi.setFieldEntries(tgtVm, 'blocked_operations', {
start:
'Start operation for this vm is blocked, clone it if you want to use it.',
}),
Promise.all(
userDevices.map(userDevice => {
const srcDisk = srcDisks[userDevice]
const tgtDisk = tgtDisks[userDevice]
return tgtXapi.setFieldEntry(
tgtDisk,
'other_config',
'xo:copy_of',
srcDisk.uuid
)
})
),
])
})(process.argv.slice(2)).catch(console.error.bind(console, 'Fatal error:'))

View File

@@ -0,0 +1,20 @@
{
"name": "@xen-orchestra/cr-seed-cli",
"version": "0.2.0",
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/cr-seed-cli",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"repository": {
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"engines": {
"node": ">=8"
},
"bin": {
"xo-cr-seed": "./index.js"
},
"dependencies": {
"golike-defer": "^0.4.1",
"xen-api": "^0.19.0"
}
}

View File

@@ -41,10 +41,10 @@
"moment-timezone": "^0.5.14"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.54",
"@babel/core": "7.0.0-beta.54",
"@babel/preset-env": "7.0.0-beta.54",
"@babel/preset-flow": "7.0.0-beta.54",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"cross-env": "^5.1.3",
"rimraf": "^2.6.2"
},

View File

@@ -44,7 +44,9 @@ class Schedule {
this._createDate =
zone.toLowerCase() === 'utc'
? moment.utc
: zone === 'local' ? moment : () => moment.tz(zone)
: zone === 'local'
? moment
: () => moment.tz(zone)
}
createJob (fn) {

View File

@@ -0,0 +1,3 @@
module.exports = require('../../@xen-orchestra/babel-config')(
require('./package.json')
)

View File

@@ -0,0 +1,24 @@
/benchmark/
/benchmarks/
*.bench.js
*.bench.js.map
/examples/
example.js
example.js.map
*.example.js
*.example.js.map
/fixture/
/fixtures/
*.fixture.js
*.fixture.js.map
*.fixtures.js
*.fixtures.js.map
/test/
/tests/
*.spec.js
*.spec.js.map
__snapshots__/

View File

@@ -0,0 +1,49 @@
# ${pkg.name} [![Build Status](https://travis-ci.org/${pkg.shortGitHubPath}.png?branch=master)](https://travis-ci.org/${pkg.shortGitHubPath})
> ${pkg.description}
## Install
Installation of the [npm package](https://npmjs.org/package/${pkg.name}):
```
> npm install --save ${pkg.name}
```
## Usage
**TODO**
## Development
```
# Install dependencies
> yarn
# Run the tests
> yarn test
# Continuously compile
> yarn dev
# Continuously run the tests
> yarn dev-test
# Build for production (automatically called by npm install)
> yarn build
```
## Contributions
Contributions are *very* welcomed, either on the documentation or on
the code.
You may:
- report any [issue](${pkg.bugs})
you've encountered;
- fork and create a pull request.
## License
${pkg.license} © [${pkg.author.name}](${pkg.author.url})

View File

@@ -0,0 +1,47 @@
{
"name": "@xen-orchestra/defined",
"version": "0.0.0",
"license": "ISC",
"description": "",
"keywords": [],
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/defined",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"repository": {
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"author": {
"name": "Julien Fontanet",
"email": "julien.fontanet@vates.fr"
},
"preferGlobal": false,
"main": "dist/",
"bin": {},
"files": [
"dist/"
],
"browserslist": [
">2%"
],
"engines": {
"node": ">=6"
},
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"cross-env": "^5.1.3",
"rimraf": "^2.6.2"
},
"scripts": {
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"clean": "rimraf dist/",
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"prebuild": "yarn run clean",
"predev": "yarn run prebuild",
"prepublishOnly": "yarn run build"
}
}

View File

@@ -1,3 +1,5 @@
// @flow
// Usage:
//
// ```js
@@ -39,7 +41,7 @@ export default function defined () {
// const getFriendName = _ => _.friends[0].name
// const friendName = get(getFriendName, props.user)
// ```
export const get = (accessor, arg) => {
export const get = (accessor: (input: ?any) => any, arg: ?any) => {
try {
return accessor(arg)
} catch (error) {
@@ -58,5 +60,5 @@ export const get = (accessor, arg) => {
// _ => new ProxyAgent(_)
// )
// ```
export const ifDef = (value, thenFn) =>
export const ifDef = (value: ?any, thenFn: (value: any) => any) =>
value !== undefined ? thenFn(value) : value

View File

@@ -0,0 +1,3 @@
module.exports = require('../../@xen-orchestra/babel-config')(
require('./package.json')
)

View File

@@ -0,0 +1,24 @@
/benchmark/
/benchmarks/
*.bench.js
*.bench.js.map
/examples/
example.js
example.js.map
*.example.js
*.example.js.map
/fixture/
/fixtures/
*.fixture.js
*.fixture.js.map
*.fixtures.js
*.fixtures.js.map
/test/
/tests/
*.spec.js
*.spec.js.map
__snapshots__/

View File

@@ -0,0 +1,71 @@
# @xen-orchestra/emit-async [![Build Status](https://travis-ci.org/${pkg.shortGitHubPath}.png?branch=master)](https://travis-ci.org/${pkg.shortGitHubPath})
> ${pkg.description}
## Install
Installation of the [npm package](https://npmjs.org/package/@xen-orchestra/emit-async):
```
> npm install --save @xen-orchestra/emit-async
```
## Usage
```js
import EE from 'events'
import emitAsync from '@xen-orchestra/emit-async'
const ee = new EE()
ee.emitAsync = emitAsync
ee.on('start', async function () {
// whatever
})
// similar to EventEmmiter#emit() but returns a promise which resolves when all
// listeners have resolved
await ee.emitAsync('start')
// by default, it will rejects as soon as one listener reject, you can customise
// error handling though:
await ee.emitAsync({
onError (error) {
console.warn(error)
}
}, 'start')
```
## Development
```
# Install dependencies
> yarn
# Run the tests
> yarn test
# Continuously compile
> yarn dev
# Continuously run the tests
> yarn dev-test
# Build for production (automatically called by npm install)
> yarn build
```
## Contributions
Contributions are *very* welcomed, either on the documentation or on
the code.
You may:
- report any [issue](${pkg.bugs})
you've encountered;
- fork and create a pull request.
## License
${pkg.license} © [${pkg.author.name}](${pkg.author.url})

View File

@@ -0,0 +1,46 @@
{
"name": "@xen-orchestra/emit-async",
"version": "0.0.0",
"license": "ISC",
"description": "",
"keywords": [],
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/emit-async",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"repository": {
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"author": {
"name": "Julien Fontanet",
"email": "julien.fontanet@vates.fr"
},
"preferGlobal": false,
"main": "dist/",
"bin": {},
"files": [
"dist/"
],
"browserslist": [
">2%"
],
"engines": {
"node": ">=6"
},
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"cross-env": "^5.1.3",
"rimraf": "^2.6.2"
},
"scripts": {
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"clean": "rimraf dist/",
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"prebuild": "yarn run clean",
"predev": "yarn run prebuild",
"prepublishOnly": "yarn run build"
}
}

View File

@@ -0,0 +1,26 @@
export default function emitAsync (event) {
let opts
let i = 1
// an option object has been passed as first param
if (typeof event !== 'string') {
opts = event
event = arguments[i++]
}
const n = arguments.length - i
const args = new Array(n)
for (let j = 0; j < n; ++j) {
args[j] = arguments[j + i]
}
const onError = opts != null && opts.onError
return Promise.all(
this.listeners(event).map(listener =>
new Promise(resolve => {
resolve(listener.apply(this, args))
}).catch(onError)
)
)
}

View File

@@ -1,6 +1,6 @@
{
"name": "@xen-orchestra/fs",
"version": "0.2.0",
"version": "0.3.1",
"license": "AGPL-3.0",
"description": "The File System for Xen Orchestra backups.",
"keywords": [],
@@ -20,24 +20,22 @@
"node": ">=6"
},
"dependencies": {
"@babel/runtime": "7.0.0-beta.54",
"@marsaud/smb2": "^0.9.0",
"execa": "^0.10.0",
"execa": "^1.0.0",
"fs-extra": "^7.0.0",
"get-stream": "^3.0.0",
"get-stream": "^4.0.0",
"lodash": "^4.17.4",
"promise-toolbox": "^0.9.5",
"promise-toolbox": "^0.10.1",
"through2": "^2.0.3",
"tmp": "^0.0.33",
"xo-remote-parser": "^0.5.0"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.54",
"@babel/core": "7.0.0-beta.54",
"@babel/plugin-proposal-function-bind": "7.0.0-beta.54",
"@babel/plugin-transform-runtime": "7.0.0-beta.54",
"@babel/preset-env": "7.0.0-beta.54",
"@babel/preset-flow": "7.0.0-beta.54",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-function-bind": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"cross-env": "^5.1.3",
"index-modules": "^0.3.0",

View File

@@ -85,8 +85,8 @@ export const validChecksumOfReadStream = (
callback(
checksum !== expectedChecksum
? new Error(
`Bad checksum (${checksum}), expected: ${expectedChecksum}`
)
`Bad checksum (${checksum}), expected: ${expectedChecksum}`
)
: null
)
}

View File

@@ -2,8 +2,8 @@
import rimraf from 'rimraf'
import tmp from 'tmp'
import { pFromCallback } from 'promise-toolbox'
import { fromCallback as pFromCallback } from 'promise-toolbox'
import { getHandler } from '.'
const initialDir = process.cwd()

View File

@@ -28,14 +28,9 @@ export default class LocalHandler extends RemoteHandlerAbstract {
async _sync () {
if (this._remote.enabled) {
try {
const path = this._getRealPath()
await fs.ensureDir(path)
await fs.access(path, fs.R_OK | fs.W_OK)
} catch (exc) {
this._remote.enabled = false
this._remote.error = exc.message
}
const path = this._getRealPath()
await fs.ensureDir(path)
await fs.access(path, fs.R_OK | fs.W_OK)
}
return this._remote
}

View File

@@ -1,9 +1,10 @@
import execa from 'execa'
import fs from 'fs-extra'
import { forEach } from 'lodash'
import LocalHandler from './local'
const DEFAULT_NFS_OPTIONS = 'vers=3'
export default class NfsHandler extends LocalHandler {
get type () {
return 'nfs'
@@ -13,73 +14,38 @@ export default class NfsHandler extends LocalHandler {
return `/run/xo-server/mounts/${this._remote.id}`
}
async _loadRealMounts () {
let stdout
const mounted = {}
try {
stdout = await execa.stdout('findmnt', [
'-P',
'-t',
'nfs,nfs4',
'--output',
'SOURCE,TARGET',
'--noheadings',
])
const regex = /^SOURCE="([^:]*):(.*)" TARGET="(.*)"$/
forEach(stdout.split('\n'), m => {
if (m) {
const match = regex.exec(m)
mounted[match[3]] = {
host: match[1],
share: match[2],
}
}
})
} catch (exc) {
// When no mounts are found, the call pretends to fail...
if (exc.stderr !== '') {
throw exc
}
}
this._realMounts = mounted
return mounted
}
_matchesRealMount () {
return this._getRealPath() in this._realMounts
}
async _mount () {
await fs.ensureDir(this._getRealPath())
const { host, path, port } = this._remote
return execa('mount', [
'-t',
'nfs',
'-o',
'vers=3',
`${host}${port !== undefined ? ':' + port : ''}:${path}`,
this._getRealPath(),
])
const { host, path, port, options } = this._remote
return execa(
'mount',
[
'-t',
'nfs',
'-o',
DEFAULT_NFS_OPTIONS + (options !== undefined ? `,${options}` : ''),
`${host}${port !== undefined ? ':' + port : ''}:${path}`,
this._getRealPath(),
],
{
env: {
LANG: 'C',
},
}
).catch(error => {
if (!error.stderr.includes('already mounted')) {
throw error
}
})
}
async _sync () {
await this._loadRealMounts()
if (this._matchesRealMount() && !this._remote.enabled) {
try {
await this._umount(this._remote)
} catch (exc) {
this._remote.enabled = true
this._remote.error = exc.message
}
} else if (!this._matchesRealMount() && this._remote.enabled) {
try {
await this._mount()
} catch (exc) {
this._remote.enabled = false
this._remote.error = exc.message
}
if (this._remote.enabled) {
await this._mount()
} else {
await this._umount()
}
return this._remote
}
@@ -91,7 +57,15 @@ export default class NfsHandler extends LocalHandler {
}
}
async _umount (remote) {
await execa('umount', ['--force', this._getRealPath()])
async _umount () {
await execa('umount', ['--force', this._getRealPath()], {
env: {
LANG: 'C',
},
}).catch(error => {
if (!error.stderr.includes('not mounted')) {
throw error
}
})
}
}

View File

@@ -1,5 +1,5 @@
import Smb2 from '@marsaud/smb2'
import { lastly as pFinally } from 'promise-toolbox'
import { pFinally } from 'promise-toolbox'
import RemoteHandlerAbstract from './abstract'
@@ -71,13 +71,8 @@ export default class SmbHandler extends RemoteHandlerAbstract {
async _sync () {
if (this._remote.enabled) {
try {
// Check access (smb2 does not expose connect in public so far...)
await this.list()
} catch (error) {
this._remote.enabled = false
this._remote.error = error.message
}
// Check access (smb2 does not expose connect in public so far...)
await this.list()
}
return this._remote
}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../@xen-orchestra/babel-config')(
require('./package.json')
)

View File

@@ -0,0 +1,24 @@
/benchmark/
/benchmarks/
*.bench.js
*.bench.js.map
/examples/
example.js
example.js.map
*.example.js
*.example.js.map
/fixture/
/fixtures/
*.fixture.js
*.fixture.js.map
*.fixtures.js
*.fixtures.js.map
/test/
/tests/
*.spec.js
*.spec.js.map
__snapshots__/

View File

@@ -0,0 +1,160 @@
# @xen-orchestra/log [![Build Status](https://travis-ci.org/vatesfr/xen-orchestra.png?branch=master)](https://travis-ci.org/vatesfr/xen-orchestra)
> ${pkg.description}
## Install
Installation of the [npm package](https://npmjs.org/package/@xen-orchestra/log):
```
> npm install --save @xen-orchestra/log
```
## Usage
Everywhere something should be logged:
```js
import createLogger from '@xen-orchestra/log'
const log = createLogger('my-module')
log.debug('only useful for debugging')
log.info('this information is relevant to the user')
log.warn('something went wrong but did not prevent current action')
log.error('something went wrong')
log.fatal('service/app is going down')
```
Then, at application level, configure the logs are handled:
```js
import { configure, catchGlobalErrors } from '@xen-orchestra/log/configure'
import transportConsole from '@xen-orchestra/log/transports/console'
import transportEmail from '@xen-orchestra/log/transports/email'
const transport = transportEmail({
service: 'gmail',
auth: {
user: 'jane.smith@gmail.com',
pass: 'H&NbECcpXF|pyXe#%ZEb'
},
from: 'jane.smith@gmail.com',
to: [
'jane.smith@gmail.com',
'sam.doe@yahoo.com'
]
})
configure([
{
// if filter is a string, then it is pattern
// (https://github.com/visionmedia/debug#wildcards) which is
// matched against the namespace of the logs
filter: process.env.DEBUG,
transport: transportConsole()
},
{
// only levels >= warn
level: 'warn',
transport
}
])
// send all global errors (uncaught exceptions, warnings, unhandled rejections)
// to this transport
catchGlobalErrors(transport)
```
### Transports
#### Console
```js
import transportConsole from '@xen-orchestra/log/transports/console'
configure(transports.console())
```
#### Email
Optional dependency:
```
> yarn add nodemailer pretty-format
```
Configuration:
```js
import transportEmail from '@xen-orchestra/log/transports/email'
configure(transportEmail({
service: 'gmail',
auth: {
user: 'jane.smith@gmail.com',
pass: 'H&NbECcpXF|pyXe#%ZEb'
},
from: 'jane.smith@gmail.com',
to: [
'jane.smith@gmail.com',
'sam.doe@yahoo.com'
]
}))
```
#### Syslog
Optional dependency:
```
> yarn add split-host syslog-client
```
Configuration:
```js
import transportSyslog from '@xen-orchestra/log/transports/syslog'
// By default, log to udp://localhost:514
configure(transportSyslog())
// But TCP, a different host, or a different port can be used
configure(transportSyslog('tcp://syslog.company.lan'))
```
## Development
```
# Install dependencies
> yarn
# Run the tests
> yarn test
# Continuously compile
> yarn dev
# Continuously run the tests
> yarn dev-test
# Build for production (automatically called by npm install)
> yarn build
```
## Contributions
Contributions are *very* welcomed, either on the documentation or on
the code.
You may:
- report any [issue](https://github.com/vatesfr/xo-web/issues/)
you've encountered;
- fork and create a pull request.
## License
ISC © [Vates SAS](https://vates.fr)

View File

@@ -0,0 +1 @@
module.exports = require('./dist/configure')

View File

@@ -0,0 +1,51 @@
{
"private": true,
"name": "@xen-orchestra/log",
"version": "0.0.0",
"license": "ISC",
"description": "",
"keywords": [],
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/log",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"repository": {
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"author": {
"name": "Julien Fontanet",
"email": "julien.fontanet@vates.fr"
},
"preferGlobal": false,
"main": "dist/",
"bin": {},
"files": [
"dist/"
],
"browserslist": [
">2%"
],
"engines": {
"node": ">=4"
},
"dependencies": {
"lodash": "^4.17.4",
"promise-toolbox": "^0.10.1"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"cross-env": "^5.1.3",
"index-modules": "^0.3.0",
"rimraf": "^2.6.2"
},
"scripts": {
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"clean": "rimraf dist/",
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"prebuild": "yarn run clean",
"predev": "yarn run prebuild",
"prepublishOnly": "yarn run build"
}
}

View File

@@ -0,0 +1,106 @@
import createConsoleTransport from './transports/console'
import LEVELS, { resolve } from './levels'
import { compileGlobPattern } from './utils'
// ===================================================================
const createTransport = config => {
if (typeof config === 'function') {
return config
}
if (Array.isArray(config)) {
const transports = config.map(createTransport)
const { length } = transports
return function () {
for (let i = 0; i < length; ++i) {
transports[i].apply(this, arguments)
}
}
}
let { filter, transport } = config
const level = resolve(config.level)
if (filter !== undefined) {
if (typeof filter === 'string') {
const re = compileGlobPattern(filter)
filter = log => re.test(log.namespace)
}
const orig = transport
transport = function (log) {
if ((level !== undefined && log.level >= level) || filter(log)) {
return orig.apply(this, arguments)
}
}
} else if (level !== undefined) {
const orig = transport
transport = function (log) {
if (log.level >= level) {
return orig.apply(this, arguments)
}
}
}
return transport
}
const symbol =
typeof Symbol !== 'undefined'
? Symbol.for('@xen-orchestra/log')
: '@@@xen-orchestra/log'
global[symbol] = createTransport({
// display warnings or above, and all that are enabled via DEBUG or
// NODE_DEBUG env
filter: process.env.DEBUG || process.env.NODE_DEBUG,
level: LEVELS.INFO,
transport: createConsoleTransport(),
})
export const configure = config => {
global[symbol] = createTransport(config)
}
// -------------------------------------------------------------------
export const catchGlobalErrors = logger => {
// patch process
const onUncaughtException = error => {
logger.error('uncaught exception', { error })
}
const onUnhandledRejection = error => {
logger.warn('possibly unhandled rejection', { error })
}
const onWarning = error => {
logger.warn('Node warning', { error })
}
process.on('uncaughtException', onUncaughtException)
process.on('unhandledRejection', onUnhandledRejection)
process.on('warning', onWarning)
// patch EventEmitter
const EventEmitter = require('events')
const { prototype } = EventEmitter
const { emit } = prototype
function patchedEmit (event, error) {
if (event === 'error' && !this.listenerCount(event)) {
logger.error('unhandled error event', { error })
return false
}
return emit.apply(this, arguments)
}
prototype.emit = patchedEmit
return () => {
process.removeListener('uncaughtException', onUncaughtException)
process.removeListener('unhandledRejection', onUnhandledRejection)
process.removeListener('warning', onWarning)
if (prototype.emit === patchedEmit) {
prototype.emit = emit
}
}
}

View File

@@ -0,0 +1,65 @@
import createTransport from './transports/console'
import LEVELS from './levels'
const symbol =
typeof Symbol !== 'undefined'
? Symbol.for('@xen-orchestra/log')
: '@@@xen-orchestra/log'
if (!(symbol in global)) {
// the default behavior, without requiring `configure` is to avoid
// logging anything unless it's a real error
const transport = createTransport()
global[symbol] = log => log.level > LEVELS.WARN && transport(log)
}
// -------------------------------------------------------------------
function Log (data, level, namespace, message, time) {
this.data = data
this.level = level
this.namespace = namespace
this.message = message
this.time = time
}
function Logger (namespace) {
this._namespace = namespace
// bind all logging methods
for (const name in LEVELS) {
const lowerCase = name.toLowerCase()
this[lowerCase] = this[lowerCase].bind(this)
}
}
const { prototype } = Logger
for (const name in LEVELS) {
const level = LEVELS[name]
prototype[name.toLowerCase()] = function (message, data) {
global[symbol](new Log(data, level, this._namespace, message, new Date()))
}
}
prototype.wrap = function (message, fn) {
const logger = this
const warnAndRethrow = error => {
logger.warn(message, { error })
throw error
}
return function () {
try {
const result = fn.apply(this, arguments)
const then = result != null && result.then
return typeof then === 'function'
? then.call(result, warnAndRethrow)
: result
} catch (error) {
warnAndRethrow(error)
}
}
}
const createLogger = namespace => new Logger(namespace)
export { createLogger as default }

View File

@@ -0,0 +1,24 @@
const LEVELS = Object.create(null)
export { LEVELS as default }
// https://github.com/trentm/node-bunyan#levels
LEVELS.FATAL = 60 // service/app is going down
LEVELS.ERROR = 50 // fatal for current action
LEVELS.WARN = 40 // something went wrong but it's not fatal
LEVELS.INFO = 30 // detail on unusual but normal operation
LEVELS.DEBUG = 20
export const NAMES = Object.create(null)
for (const name in LEVELS) {
NAMES[LEVELS[name]] = name
}
export const resolve = level => {
if (typeof level === 'string') {
level = LEVELS[level.toUpperCase()]
}
return level
}
Object.freeze(LEVELS)
Object.freeze(NAMES)

View File

@@ -0,0 +1,32 @@
/* eslint-env jest */
import { forEach, isInteger } from 'lodash'
import LEVELS, { NAMES, resolve } from './levels'
describe('LEVELS', () => {
it('maps level names to their integer values', () => {
forEach(LEVELS, (value, name) => {
expect(isInteger(value)).toBe(true)
})
})
})
describe('NAMES', () => {
it('maps level values to their names', () => {
forEach(LEVELS, (value, name) => {
expect(NAMES[value]).toBe(name)
})
})
})
describe('resolve()', () => {
it('returns level values either from values or names', () => {
forEach(LEVELS, value => {
expect(resolve(value)).toBe(value)
})
forEach(NAMES, (name, value) => {
expect(resolve(name)).toBe(+value)
})
})
})

View File

@@ -0,0 +1,24 @@
import LEVELS, { NAMES } from '../levels'
// Bind console methods (necessary for browsers)
const debugConsole = console.log.bind(console)
const infoConsole = console.info.bind(console)
const warnConsole = console.warn.bind(console)
const errorConsole = console.error.bind(console)
const { ERROR, INFO, WARN } = LEVELS
const consoleTransport = ({ data, level, namespace, message, time }) => {
const fn =
level < INFO
? debugConsole
: level < WARN
? infoConsole
: level < ERROR
? warnConsole
: errorConsole
fn('%s - %s - [%s] %s', time.toISOString(), namespace, NAMES[level], message)
data != null && fn(data)
}
export default () => consoleTransport

View File

@@ -0,0 +1,70 @@
import fromCallback from 'promise-toolbox/fromCallback'
import prettyFormat from 'pretty-format' // eslint-disable-line node/no-extraneous-import
import { createTransport } from 'nodemailer' // eslint-disable-line node/no-extraneous-import
import { evalTemplate, required } from '../utils'
import { NAMES } from '../levels'
export default ({
// transport options (https://nodemailer.com/smtp/)
auth,
authMethod,
host,
ignoreTLS,
port,
proxy,
requireTLS,
secure,
service,
tls,
// message options (https://nodemailer.com/message/)
bcc,
cc,
from = required('from'),
to = required('to'),
subject = '[{{level}} - {{namespace}}] {{time}} {{message}}',
}) => {
const transporter = createTransport(
{
auth,
authMethod,
host,
ignoreTLS,
port,
proxy,
requireTLS,
secure,
service,
tls,
disableFileAccess: true,
disableUrlAccess: true,
},
{
bcc,
cc,
from,
to,
}
)
return log =>
fromCallback(cb =>
transporter.sendMail(
{
subject: evalTemplate(
subject,
key =>
key === 'level'
? NAMES[log.level]
: key === 'time'
? log.time.toISOString()
: log[key]
),
text: prettyFormat(log.data),
},
cb
)
)
}

View File

@@ -0,0 +1,7 @@
export default () => {
const memoryLogger = log => {
logs.push(log)
}
const logs = (memoryLogger.logs = [])
return memoryLogger
}

View File

@@ -0,0 +1,42 @@
import fromCallback from 'promise-toolbox/fromCallback'
import splitHost from 'split-host' // eslint-disable-line node/no-extraneous-import node/no-missing-import
import startsWith from 'lodash/startsWith'
import { createClient, Facility, Severity, Transport } from 'syslog-client' // eslint-disable-line node/no-extraneous-import node/no-missing-import
import LEVELS from '../levels'
// https://github.com/paulgrove/node-syslog-client#syslogseverity
const LEVEL_TO_SEVERITY = {
[LEVELS.FATAL]: Severity.Critical,
[LEVELS.ERROR]: Severity.Error,
[LEVELS.WARN]: Severity.Warning,
[LEVELS.INFO]: Severity.Informational,
[LEVELS.DEBUG]: Severity.Debug,
}
const facility = Facility.User
export default target => {
const opts = {}
if (target !== undefined) {
if (startsWith(target, 'tcp://')) {
target = target.slice(6)
opts.transport = Transport.Tcp
} else if (startsWith(target, 'udp://')) {
target = target.slice(6)
opts.transport = Transport.Udp
}
;({ host: target, port: opts.port } = splitHost(target))
}
const client = createClient(target, opts)
return log =>
fromCallback(cb =>
client.log(log.message, {
facility,
severity: LEVEL_TO_SEVERITY[log.level],
})
)
}

View File

@@ -0,0 +1,62 @@
import escapeRegExp from 'lodash/escapeRegExp'
// ===================================================================
const TPL_RE = /\{\{(.+?)\}\}/g
export const evalTemplate = (tpl, data) => {
const getData =
typeof data === 'function' ? (_, key) => data(key) : (_, key) => data[key]
return tpl.replace(TPL_RE, getData)
}
// -------------------------------------------------------------------
const compileGlobPatternFragment = pattern =>
pattern
.split('*')
.map(escapeRegExp)
.join('.*')
export const compileGlobPattern = pattern => {
const no = []
const yes = []
pattern.split(/[\s,]+/).forEach(pattern => {
if (pattern[0] === '-') {
no.push(pattern.slice(1))
} else {
yes.push(pattern)
}
})
const raw = ['^']
if (no.length !== 0) {
raw.push('(?!', no.map(compileGlobPatternFragment).join('|'), ')')
}
if (yes.length !== 0) {
raw.push('(?:', yes.map(compileGlobPatternFragment).join('|'), ')')
} else {
raw.push('.*')
}
raw.push('$')
return new RegExp(raw.join(''))
}
// -------------------------------------------------------------------
export const required = name => {
throw new Error(`missing required arg ${name}`)
}
// -------------------------------------------------------------------
export const serializeError = error => ({
...error,
message: error.message,
name: error.name,
stack: error.stack,
})

View File

@@ -0,0 +1,13 @@
/* eslint-env jest */
import { compileGlobPattern } from './utils'
describe('compileGlobPattern()', () => {
it('works', () => {
const re = compileGlobPattern('foo, ba*, -bar')
expect(re.test('foo')).toBe(true)
expect(re.test('bar')).toBe(false)
expect(re.test('baz')).toBe(true)
expect(re.test('qux')).toBe(false)
})
})

View File

@@ -0,0 +1 @@
dist/transports

View File

@@ -0,0 +1,3 @@
module.exports = require('../../@xen-orchestra/babel-config')(
require('./package.json')
)

View File

@@ -0,0 +1,24 @@
/benchmark/
/benchmarks/
*.bench.js
*.bench.js.map
/examples/
example.js
example.js.map
*.example.js
*.example.js.map
/fixture/
/fixtures/
*.fixture.js
*.fixture.js.map
*.fixtures.js
*.fixtures.js.map
/test/
/tests/
*.spec.js
*.spec.js.map
__snapshots__/

View File

@@ -0,0 +1,49 @@
# ${pkg.name} [![Build Status](https://travis-ci.org/${pkg.shortGitHubPath}.png?branch=master)](https://travis-ci.org/${pkg.shortGitHubPath})
> ${pkg.description}
## Install
Installation of the [npm package](https://npmjs.org/package/${pkg.name}):
```
> npm install --save ${pkg.name}
```
## Usage
**TODO**
## Development
```
# Install dependencies
> yarn
# Run the tests
> yarn test
# Continuously compile
> yarn dev
# Continuously run the tests
> yarn dev-test
# Build for production (automatically called by npm install)
> yarn build
```
## Contributions
Contributions are *very* welcomed, either on the documentation or on
the code.
You may:
- report any [issue](${pkg.bugs})
you've encountered;
- fork and create a pull request.
## License
${pkg.license} © [${pkg.author.name}](${pkg.author.url})

View File

@@ -0,0 +1,49 @@
{
"name": "@xen-orchestra/mixin",
"version": "0.0.0",
"license": "ISC",
"description": "",
"keywords": [],
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/mixin",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"repository": {
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"author": {
"name": "Julien Fontanet",
"email": "julien.fontanet@vates.fr"
},
"preferGlobal": false,
"main": "dist/",
"bin": {},
"files": [
"dist/"
],
"browserslist": [
">2%"
],
"engines": {
"node": ">=6"
},
"dependencies": {
"bind-property-descriptor": "^1.0.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-plugin-dev": "^1.0.0",
"babel-plugin-lodash": "^3.3.2",
"cross-env": "^5.1.3",
"rimraf": "^2.6.2"
},
"scripts": {
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"clean": "rimraf dist/",
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"prebuild": "yarn run clean",
"predev": "yarn run prebuild",
"prepublishOnly": "yarn run build"
}
}

View File

@@ -0,0 +1,130 @@
import { getBoundPropertyDescriptor } from 'bind-property-descriptor'
// ===================================================================
const { defineProperties, getOwnPropertyDescriptor } = Object
const isIgnoredProperty = name => name[0] === '_' || name === 'constructor'
const IGNORED_STATIC_PROPERTIES = {
__proto__: null,
arguments: true,
caller: true,
length: true,
name: true,
prototype: true,
}
const isIgnoredStaticProperty = name => name in IGNORED_STATIC_PROPERTIES
const ownKeys =
(typeof Reflect !== 'undefined' && Reflect.ownKeys) ||
(({ getOwnPropertyNames: names, getOwnPropertySymbols: symbols }) =>
symbols !== undefined ? obj => names(obj).concat(symbols(obj)) : names)(
Object
)
// -------------------------------------------------------------------
const mixin = Mixins => Class => {
if (__DEV__ && !Array.isArray(Mixins)) {
throw new TypeError('Mixins should be an array')
}
const { name } = Class
// Copy properties of plain object mix-ins to the prototype.
{
const allMixins = Mixins
Mixins = []
const { prototype } = Class
const descriptors = { __proto__: null }
allMixins.forEach(Mixin => {
if (typeof Mixin === 'function') {
Mixins.push(Mixin)
return
}
for (const prop of ownKeys(Mixin)) {
if (__DEV__ && prop in prototype) {
throw new Error(`${name}#${prop} is already defined`)
}
;(descriptors[prop] = getOwnPropertyDescriptor(
Mixin,
prop
)).enumerable = false // Object methods are enumerable but class methods are not.
}
})
defineProperties(prototype, descriptors)
}
const n = Mixins.length
function DecoratedClass (...args) {
const instance = new Class(...args)
for (let i = 0; i < n; ++i) {
const Mixin = Mixins[i]
const { prototype } = Mixin
const mixinInstance = new Mixin(instance, ...args)
const descriptors = { __proto__: null }
const props = ownKeys(prototype)
for (let j = 0, m = props.length; j < m; ++j) {
const prop = props[j]
if (isIgnoredProperty(prop)) {
continue
}
if (prop in instance) {
throw new Error(`${name}#${prop} is already defined`)
}
descriptors[prop] = getBoundPropertyDescriptor(
prototype,
prop,
mixinInstance
)
}
defineProperties(instance, descriptors)
}
return instance
}
// Copy original and mixed-in static properties on Decorator class.
const descriptors = { __proto__: null }
ownKeys(Class).forEach(prop => {
let descriptor
if (
!(
isIgnoredStaticProperty(prop) &&
// if they already exist...
(descriptor = getOwnPropertyDescriptor(DecoratedClass, prop)) !==
undefined &&
// and are not configurable.
!descriptor.configurable
)
) {
descriptors[prop] = getOwnPropertyDescriptor(Class, prop)
}
})
Mixins.forEach(Mixin => {
ownKeys(Mixin).forEach(prop => {
if (isIgnoredStaticProperty(prop)) {
return
}
if (__DEV__ && prop in descriptors) {
throw new Error(`${name}.${prop} is already defined`)
}
descriptors[prop] = getOwnPropertyDescriptor(Mixin, prop)
})
})
defineProperties(DecoratedClass, descriptors)
return DecoratedClass
}
export { mixin as default }

View File

@@ -4,10 +4,160 @@
### Enhancements
- [Host/Networks] Remove "Add network" button [#3386](https://github.com/vatesfr/xen-orchestra/issues/3386) (PR [#3478](https://github.com/vatesfr/xen-orchestra/pull/3478))
- [Host/networks] Private networks table [#3387](https://github.com/vatesfr/xen-orchestra/issues/3387) (PR [#3481](https://github.com/vatesfr/xen-orchestra/pull/3481))
- [Home/pool] Patch count pill now shows the number of unique patches in the pool [#3321](https://github.com/vatesfr/xen-orchestra/issues/3321) (PR [#3483](https://github.com/vatesfr/xen-orchestra/pull/3483))
- [Patches] Pre-install checks to avoid errors [#3252](https://github.com/vatesfr/xen-orchestra/issues/3252) (PR [#3484](https://github.com/vatesfr/xen-orchestra/pull/3484))
- [Vm/Snapshots] Allow VM operators to create snapshots and delete those they created [#3443](https://github.com/vatesfr/xen-orchestra/issues/3443) (PR [#3482](https://github.com/vatesfr/xen-orchestra/pull/3482))
- [VM/clone] Handle ACLs and Self Service [#3139](https://github.com/vatesfr/xen-orchestra/issues/3139) (PR [#3493](https://github.com/vatesfr/xen-orchestra/pull/3493))
### Bug fixes
- [Backup NG] Fix `Cannot read property 'uuid' of undefined` when a disk is removed from a VM to backup (PR [#3479](https://github.com/vatesfr/xen-orchestra/pull/3479))
- [Backup NG] Fix unexpected full after failure, interruption or basic rolling snapshot (PR [#3485](https://github.com/vatesfr/xen-orchestra/pull/3485))
- [Usage report] Display top 3 used SRs instead of top 3 biggest SRs [#3307](https://github.com/vatesfr/xen-orchestra/issues/3307) (PR [#3475](https://github.com/vatesfr/xen-orchestra/pull/3475))
### Released packages
- vhd-lib v0.3.2
- xo-vmdk-to-vhd v0.1.5
- xo-server-usage-report v0.6.0
- xo-acl-resolver v0.3.0
- xo-server v5.28.0
- xo-web v5.28.0
## **5.27.1** (2018-09-28)
### Enhancements
### Bug fixes
- [OVA Import] Allow import of files bigger than 127GB (PR [#3451](https://github.com/vatesfr/xen-orchestra/pull/3451))
- [File restore] Fix a path issue when going back to the parent folder (PR [#3446](https://github.com/vatesfr/xen-orchestra/pull/3446))
- [File restore] Fix a minor issue when showing which selected files are redundant (PR [#3447](https://github.com/vatesfr/xen-orchestra/pull/3447))
- [Memory] Fix a major leak [#2580](https://github.com/vatesfr/xen-orchestra/issues/2580) [#2820](https://github.com/vatesfr/xen-orchestra/issues/2820) (PR [#3453](https://github.com/vatesfr/xen-orchestra/pull/3453))
- [NFS Remotes] Fix `already mounted` race condition [#3380](https://github.com/vatesfr/xen-orchestra/issues/3380) (PR [#3460](https://github.com/vatesfr/xen-orchestra/pull/3460))
- Fix `Cannot read property 'type' of undefined` when deleting a VM (PR [#3465](https://github.com/vatesfr/xen-orchestra/pull/3465))
### Released packages
- @xen-orchestra/fs v0.3.1
- vhd-lib v0.3.1
- xo-vmdk-to-vhd v0.1.4
- xo-server v5.27.2
- xo-web v5.27.1
## **5.27.0** (2018-09-24)
### Enhancements
- [Remotes] Test the remote automatically on changes [#3323](https://github.com/vatesfr/xen-orchestra/issues/3323) (PR [#3397](https://github.com/vatesfr/xen-orchestra/pull/3397))
- [Remotes] Use *WORKGROUP* as default domain for new SMB remote (PR [#3398](https://github.com/vatesfr/xen-orchestra/pull/3398))
- [Backup NG form] Display a tip to encourage users to create vms on a thin-provisioned storage [#3334](https://github.com/vatesfr/xen-orchestra/issues/3334) (PR [#3402](https://github.com/vatesfr/xen-orchestra/pull/3402))
- [Backup NG form] improve schedule's form [#3138](https://github.com/vatesfr/xen-orchestra/issues/3138) (PR [#3359](https://github.com/vatesfr/xen-orchestra/pull/3359))
- [Backup NG Overview] Display transferred and merged data size for backup jobs [#3340](https://github.com/vatesfr/xen-orchestra/issues/3340) (PR [#3408](https://github.com/vatesfr/xen-orchestra/pull/3408))
- [VM] Display the PVHVM status [#3014](https://github.com/vatesfr/xen-orchestra/issues/3014) (PR [#3418](https://github.com/vatesfr/xen-orchestra/pull/3418))
- [Backup reports] Ability to test the plugin (PR [#3421](https://github.com/vatesfr/xen-orchestra/pull/3421))
- [Backup NG] Ability to restart failed VMs' backup [#3339](https://github.com/vatesfr/xen-orchestra/issues/3339) (PR [#3420](https://github.com/vatesfr/xen-orchestra/pull/3420))
- [VM] Ability to change the NIC type [#3423](https://github.com/vatesfr/xen-orchestra/issues/3423) (PR [#3440](https://github.com/vatesfr/xen-orchestra/pull/3440))
- [Backup NG Overview] Display the schedule's name [#3444](https://github.com/vatesfr/xen-orchestra/issues/3444) (PR [#3445](https://github.com/vatesfr/xen-orchestra/pull/3445))
### Bug fixes
- [Remotes] Rename connect(ed)/disconnect(ed) to enable(d)/disable(d) [#3323](https://github.com/vatesfr/xen-orchestra/issues/3323) (PR [#3396](https://github.com/vatesfr/xen-orchestra/pull/3396))
- [Remotes] Fix error appears twice on testing (PR [#3399](https://github.com/vatesfr/xen-orchestra/pull/3399))
- [Backup NG] Don't fail on VMs with empty VBDs (like CDs or floppy disks) (PR [#3410](https://github.com/vatesfr/xen-orchestra/pull/3410))
- [XOA updater] Fix issue where trial request would fail [#3407](https://github.com/vatesfr/xen-orchestra/issues/3407) (PR [#3412](https://github.com/vatesfr/xen-orchestra/pull/3412))
- [Backup NG logs] Fix log's value not being updated in the copy and report button [#3273](https://github.com/vatesfr/xen-orchestra/issues/3273) (PR [#3360](https://github.com/vatesfr/xen-orchestra/pull/3360))
- [Backup NG] Fix issue when *Delete first* was enabled for some of the remotes [#3424](https://github.com/vatesfr/xen-orchestra/issues/3424) (PR [#3427](https://github.com/vatesfr/xen-orchestra/pull/3427))
- [VM/host consoles] Work around a XenServer/XCP-ng issue which lead to some consoles not working [#3432](https://github.com/vatesfr/xen-orchestra/issues/3432) (PR [#3435](https://github.com/vatesfr/xen-orchestra/pull/3435))
- [Backup NG] Remove extraneous snapshots in case of multiple schedules [#3132](https://github.com/vatesfr/xen-orchestra/issues/3132) (PR [#3439](https://github.com/vatesfr/xen-orchestra/pull/3439))
- [Backup NG] Fix page reloaded on creating a schedule [#3461](https://github.com/vatesfr/xen-orchestra/issues/3461) (PR [#3462](https://github.com/vatesfr/xen-orchestra/pull/3462))
### Released packages
- xo-server-backup-reports v0.14.0
- @xen-orchestra/async-map v0.0.0
- @xen-orchestra/defined v0.0.0
- @xen-orchestra/emit-async v0.0.0
- @xen-orchestra/mixin v0.0.0
- xo-server v5.27.0
- xo-web v5.27.0
## **5.26.0** (2018-09-07)
### Enhancements
- [Backup (file) restore] Order backups by date in selector [#3294](https://github.com/vatesfr/xen-orchestra/issues/3294) (PR [#3374](https://github.com/vatesfr/xen-orchestra/pull/3374))
- [Self] Hide Tasks entry in menu for self users [#3311](https://github.com/vatesfr/xen-orchestra/issues/3311) (PR [#3373](https://github.com/vatesfr/xen-orchestra/pull/3373))
- [Tasks] Show previous tasks [#3266](https://github.com/vatesfr/xen-orchestra/issues/3266) (PR [#3377](https://github.com/vatesfr/xen-orchestra/pull/3377))
- [Backup NG] Add job name in names of replicated VMs (PR [#3379](https://github.com/vatesfr/xen-orchestra/pull/3379))
- [Backup NG] Restore directories [#1924](https://github.com/vatesfr/xen-orchestra/issues/1924) (PR [#3384](https://github.com/vatesfr/xen-orchestra/pull/3384))
- [VM] Start a VM on a specific host [#3191](https://github.com/vatesfr/xen-orchestra/issues/3191) (PR [#3389](https://github.com/vatesfr/xen-orchestra/pull/3389))
### Bug fixes
- [Self] Fix Self Service quotas not being correctly updated when deleting multiple VMs at a time (PR [#3368](https://github.com/vatesfr/xen-orchestra/pull/3368))
- [Backup NG] Don't fail listing backups when a remote is broken [#3365](https://github.com/vatesfr/xen-orchestra/issues/3365) (PR [#3367](https://github.com/vatesfr/xen-orchestra/pull/3367))
- [New XOSAN] Fix error sometimes occurring when selecting the pool (PR [#3370](https://github.com/vatesfr/xen-orchestra/pull/3370))
- [New VM] Selecting multiple VMs and clicking Create then Cancel used to redirect to Home [#3268](https://github.com/vatesfr/xen-orchestra/issues/3268) (PR [#3371](https://github.com/vatesfr/xen-orchestra/pull/3371))
- [Remotes] `cannot read 'properties' of undefined` error (PR [#3382](https://github.com/vatesfr/xen-orchestra/pull/3382))
- [Servers] Various issues when adding a new server [#3385](https://github.com/vatesfr/xen-orchestra/issues/3385) (PR [#3388](https://github.com/vatesfr/xen-orchestra/pull/3388))
- [Backup NG] Always delete the correct old replications [#3391](https://github.com/vatesfr/xen-orchestra/issues/3391) (PR [#3394](https://github.com/vatesfr/xen-orchestra/pull/3394))
### Released packages
- xo-server v5.26.0
- xo-web v5.26.0
## **5.25.2** (2018-08-27)
### Enhancements
### Bug fixes
- [Remotes] Fix "undefined" mount option issue [#3361](https://github.com/vatesfr/xen-orchestra/issues/3361) (PR [#3363](https://github.com/vatesfr/xen-orchestra/pull/3363))
- [Continuous Replication] Don't try to import/export VDIs on halted host [#3354](https://github.com/vatesfr/xen-orchestra/issues/3354) (PR [#3355](https://github.com/vatesfr/xen-orchestra/pull/3355))
- [Disaster Recovery] Don't try to import/export VMs on halted host (PR [#3364](https://github.com/vatesfr/xen-orchestra/pull/3364))
- [Backup NG] A successful backup job reported as Interrupted [#3018](https://github.com/vatesfr/xen-orchestra/issues/3018) (PR [#3238](https://github.com/vatesfr/xen-orchestra/pull/3238))
### Released packages
- xo-server v5.25.2
- xo-web v5.25.1
## **5.25.0** (2018-08-23)
### Enhancements
- [Tables] Filter input now always shows up even if the table is empty [#3295](https://github.com/vatesfr/xen-orchestra/issues/3295) (PR [#3296](https://github.com/vatesfr/xen-orchestra/pull/3296))
- [Tasks] The table is now still shown when there are no tasks (PR [#3305](https://github.com/vatesfr/xen-orchestra/pull/3305))
- [Host / Logs] Homogenize action buttons in table and enable bulk deletion [#3179](https://github.com/vatesfr/xen-orchestra/issues/3179) (PR [#3313](https://github.com/vatesfr/xen-orchestra/pull/3313))
- [VM/Advanced] Change "Convert" to "Convert to template" and always show the button [#3201](https://github.com/vatesfr/xen-orchestra/issues/3201) (PR [#3319](https://github.com/vatesfr/xen-orchestra/pull/3319))
- [Backup NG form] Display a tip when doing a CR on a thick-provisioned SR [#3291](https://github.com/vatesfr/xen-orchestra/issues/3291) (PR [#3333](https://github.com/vatesfr/xen-orchestra/pull/3333))
- [SR/new] Add local ext SR type [#3332](https://github.com/vatesfr/xen-orchestra/issues/3332) (PR [#3335](https://github.com/vatesfr/xen-orchestra/pull/3335))
- [Backup reports] Send report for the interrupted backup jobs on the server startup [#2998](https://github.com/vatesfr/xen-orchestra/issues/#2998) (PR [3164](https://github.com/vatesfr/xen-orchestra/pull/3164) [3154](https://github.com/vatesfr/xen-orchestra/pull/3154))
- [Backup NG form] Move VMs' selection to a dedicated card [#2711](https://github.com/vatesfr/xen-orchestra/issues/2711) (PR [#3338](https://github.com/vatesfr/xen-orchestra/pull/3338))
- [Backup NG smart mode] Exclude replicated VMs [#2338](https://github.com/vatesfr/xen-orchestra/issues/2338) (PR [#3312](https://github.com/vatesfr/xen-orchestra/pull/3312))
- [Backup NG form] Show the compression checkbox when the full mode is active [#3236](https://github.com/vatesfr/xen-orchestra/issues/3236) (PR [#3345](https://github.com/vatesfr/xen-orchestra/pull/3345))
- [New VM] Display an error when the getting of the coreOS default template fails [#3227](https://github.com/vatesfr/xen-orchestra/issues/3227) (PR [#3343](https://github.com/vatesfr/xen-orchestra/pull/3343))
- [Backup NG form] Set default retention to 1 [#3134](https://github.com/vatesfr/xen-orchestra/issues/3134) (PR [#3290](https://github.com/vatesfr/xen-orchestra/pull/3290))
- [Backup NG] New logs are searchable by job name [#3272](https://github.com/vatesfr/xen-orchestra/issues/3272) (PR [#3351](https://github.com/vatesfr/xen-orchestra/pull/3351))
- [Remotes] Add a field for NFS remotes to set mount options [#1793](https://github.com/vatesfr/xen-orchestra/issues/1793) (PR [#3353](https://github.com/vatesfr/xen-orchestra/pull/3353))
### Bug fixes
- [Backup NG form] Fix schedule's name overridden with undefined if it's not been edited [#3286](https://github.com/vatesfr/xen-orchestra/issues/3286) (PR [#3288](https://github.com/vatesfr/xen-orchestra/pull/3288))
- [Remotes] Don't change `enabled` state on errors (PR [#3318](https://github.com/vatesfr/xen-orchestra/pull/3318))
- [Remotes] Auto-reconnect on use if necessary [#2852](https://github.com/vatesfr/xen-orchestra/issues/2852) (PR [#3320](https://github.com/vatesfr/xen-orchestra/pull/3320))
- [XO items' select] Fix adding or removing a XO item from a select make the missing XO items disappear [#3322](https://github.com/vatesfr/xen-orchestra/issues/3322) (PR [#3315](https://github.com/vatesfr/xen-orchestra/pull/3315))
- [New VM / Self] Filter out SRs that are not in the template's pool [#3068](https://github.com/vatesfr/xen-orchestra/issues/3068) (PR [#3070](https://github.com/vatesfr/xen-orchestra/pull/3070))
- [New VM / Self] Fix 'unknown item' displayed in SR selector [#3267](https://github.com/vatesfr/xen-orchestra/issues/3267) (PR [#3070](https://github.com/vatesfr/xen-orchestra/pull/3070))
### Released packages
- xo-server-backup-reports v0.13.0
- @xen-orchestra/fs 0.3.0
- xo-server v5.25.0
- xo-web v5.25.0
@@ -24,7 +174,6 @@
- [Backup NG Overview] List the Backup NG job's modes [#3169](https://github.com/vatesfr/xen-orchestra/issues/3169) (PR [#3277](https://github.com/vatesfr/xen-orchestra/pull/3277))
- [Backup NG form] Move "Use compression" checkbox in the advanced settings [#2711](https://github.com/vatesfr/xen-orchestra/issues/2711) (PR [#3281](https://github.com/vatesfr/xen-orchestra/pull/3281))
- [Backup NG form] Ability to remove previous backups first before backup the VMs [#3212](https://github.com/vatesfr/xen-orchestra/issues/3212) (PR [#3260](https://github.com/vatesfr/xen-orchestra/pull/3260))
- [Backup reports] Send report for the interrupted backup jobs on the server startup [#2998](https://github.com/vatesfr/xen-orchestra/issues/#2998) (PR [3164](https://github.com/vatesfr/xen-orchestra/pull/3164) [3154](https://github.com/vatesfr/xen-orchestra/pull/3154))
- [Patching] Check date consistency before patching to avoid error on install [#3056](https://github.com/vatesfr/xen-orchestra/issues/3056)
### Bug fixes
@@ -64,7 +213,7 @@
- xo-remote-parser v0.5.0
- complex-matcher v0.4.0
- xo-server-backup-reports v0.13.0
- xo-server-backup-reports v0.12.3
- xo-server v5.23.0
- xo-web v5.23.0

BIN
docs/assets/log-runId.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -66,4 +66,10 @@ To solve it, you have to change a parameter in your VM. `xe vm-param-set has-ven
This message appears when you do not have enough free space on the target remote when running a backup to it.
To check your free space, enter your XOA and run `xoa check` to check free system space and `df -h` to check free space on your chosen remote storage.
To check your free space, enter your XOA and run `xoa check` to check free system space and `df -h` to check free space on your chosen remote storage.
### Error: no VMs match this pattern
This is happening when you have a *smart backup job* that doesn't match any VMs. For example: you created a job to backup all running VMs. If no VMs are running on backup schedule, you'll have this message. This could also happen if you lost connection with your pool master (the VMs aren't visible anymore from Xen Orchestra).
Edit your job and try to see matching VMs or check if your pool is connected to XOA.

View File

@@ -29,13 +29,19 @@ You also have a filter to search anything related to these logs.
> Logs are not "live" tasks. If you restart XOA during a backup, the log associated with the job will stay in orange (in progress), because it wasn't finished. It will stay forever unfinished because the job was cut in the middle.
## Backups execution
Each backups' job execution is identified by a `runId`. You can find this `runId` in its detailed log.
![](./assets/log-runId.png)
## Consistent backup (with quiesce snapshots)
All backup rely on snapshots. But what about data consistency? By default, Xen Orchestra will try to make a **quiesce snapshot** every time a snapshot is done (and fallback to normal snapshot if it's not possible).
All backup types rely on snapshots. But what about data consistency? By default, Xen Orchestra will try to take a **quiesced snapshot** every time a snapshot is done (and fall back to normal snapshots if it's not possible).
All your Windows VMs can be protected (especially MS SQL or Exchange services) after you have installed Xen Tools in your VMs. A quiesce snapshots means the operating system will be notified and the cache will be flushed to disks. This way, your backups will always be consistent.
Snapshots of Windows VMs can be quiesced (especially MS SQL or Exchange services) after you have installed Xen Tools in your VMs. However, [there is an extra step to install the VSS provider on windows](quiesce). A quiesced snapshot means the operating system will be notified and the cache will be flushed to disks. This way, your backups will always be consistent.
To see if you have quiesced snapshots for a VM, just go into its snapshot tab, the "info" icon means it is a quiesced snapshot:
To see if you have quiesced snapshots for a VM, just go into its snapshot tab, then the "info" icon means it is a quiesced snapshot:
![](./assets/quiesced1.png)

View File

@@ -1,10 +1,10 @@
# File level restore
You can also restore individual files inside a VM. It works with all your existing delta backups.
You can also restore specific files and directories inside a VM. It works with all your existing delta backups.
> You must use the latest XOA release. When you connect with the console, you should see `Build number: 16.12.20`. If you have this or higher (eg `17.*`), it means that's OK! Otherwise, please update your XOA.
> Restoring individual files from an SMB remote is not yet possible, but it's planned for the future!
> Restoring individual files from an SMB remote is not possible yet, but it's planned for the future!
> File level restore **is only possible on delta backups**

View File

@@ -101,6 +101,13 @@ memory to xo-server itself:
+ ExecStart=/usr/local/bin/node --max-old-space-size=8192 /usr/local/bin/xo-server
```
The last step is to refresh and restart the service:
```
$ systemctl daemon-reload
$ systemctl restart xo-server
```
### Behind a transparent proxy
If your are behind a transparent proxy, you'll probably have issues with the updater (SSL/TLS issues).

View File

@@ -1,32 +1,37 @@
{
"devDependencies": {
"@babel/core": "7.0.0-beta.54",
"@babel/register": "7.0.0-beta.54",
"@babel/core": "^7.0.0",
"@babel/register": "^7.0.0",
"babel-core": "^7.0.0-0",
"babel-eslint": "^8.1.2",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.0.1",
"benchmark": "^2.1.4",
"eslint": "^5.1.0",
"eslint-config-standard": "12.0.0-alpha.0",
"eslint-config-standard-jsx": "^5.0.0",
"eslint-config-standard": "12.0.0",
"eslint-config-standard-jsx": "^6.0.2",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-node": "^6.0.0",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.0.0",
"eslint-plugin-react": "^7.6.1",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-standard": "^4.0.0",
"exec-promise": "^0.7.0",
"flow-bin": "^0.76.0",
"flow-bin": "^0.82.0",
"globby": "^8.0.0",
"husky": "^0.14.3",
"husky": "^1.0.0-rc.15",
"jest": "^23.0.1",
"lodash": "^4.17.4",
"prettier": "^1.10.2",
"promise-toolbox": "^0.9.5",
"promise-toolbox": "^0.10.1",
"sorted-object": "^2.0.1"
},
"engines": {
"yarn": "^1.7.0"
},
"husky": {
"hooks": {
"pre-commit": "scripts/lint-staged"
}
},
"jest": {
"collectCoverage": true,
"projects": [
@@ -49,7 +54,6 @@
"dev": "scripts/run-script --parallel dev",
"dev-test": "jest --bail --watch \"^(?!.*\\.integ\\.spec\\.js$)\"",
"posttest": "scripts/run-script test",
"precommit": "scripts/lint-staged",
"prepare": "scripts/run-script prepare",
"pretest": "eslint --ignore-path .gitignore .",
"test": "jest \"^(?!.*\\.integ\\.spec\\.js$)\"",

View File

@@ -30,9 +30,9 @@
"lodash": "^4.17.4"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.54",
"@babel/core": "7.0.0-beta.54",
"@babel/preset-env": "7.0.0-beta.54",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"cross-env": "^5.1.1",
"rimraf": "^2.6.2"

View File

@@ -28,10 +28,10 @@
},
"dependencies": {},
"devDependencies": {
"@babel/cli": "7.0.0-beta.54",
"@babel/core": "7.0.0-beta.54",
"@babel/preset-env": "7.0.0-beta.54",
"@babel/preset-flow": "7.0.0-beta.54",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"cross-env": "^5.1.3",
"rimraf": "^2.6.2"
},

View File

@@ -26,22 +26,21 @@
"node": ">=6"
},
"dependencies": {
"@xen-orchestra/fs": "^0.2.0",
"@xen-orchestra/fs": "^0.3.0",
"cli-progress": "^2.0.0",
"exec-promise": "^0.7.0",
"struct-fu": "^1.2.0",
"vhd-lib": "^0.3.0"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.54",
"@babel/core": "7.0.0-beta.54",
"@babel/plugin-transform-runtime": "7.0.0-beta.54",
"@babel/preset-env": "7.0.0-beta.54",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"cross-env": "^5.1.3",
"execa": "^0.10.0",
"execa": "^1.0.0",
"index-modules": "^0.3.0",
"promise-toolbox": "^0.9.5",
"promise-toolbox": "^0.10.1",
"rimraf": "^2.6.1",
"tmp": "^0.0.33"
},

View File

@@ -14,7 +14,8 @@ export default async function main (args) {
onProgress ({ done, total }) {
if (bar === undefined) {
bar = new Bar({
format: 'merging [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}',
format:
'merging [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}',
})
bar.start(total, done)
} else {

View File

@@ -3,7 +3,7 @@
import execa from 'execa'
import rimraf from 'rimraf'
import tmp from 'tmp'
import { fromCallback as pFromCallback } from 'promise-toolbox'
import { pFromCallback } from 'promise-toolbox'
import command from './commands/info'

View File

@@ -5,15 +5,13 @@ import fs from 'fs-extra'
import getStream from 'get-stream'
import rimraf from 'rimraf'
import tmp from 'tmp'
import { fromEvent, pFromCallback } from 'promise-toolbox'
import { getHandler } from '@xen-orchestra/fs'
import { randomBytes } from 'crypto'
import { fromEvent, fromCallback as pFromCallback } from 'promise-toolbox'
import chainVhd from './chain'
import createReadStream from './createSyntheticStream'
import Vhd from './vhd'
import vhdMerge from './merge'
import { SECTOR_SIZE } from './_constants'
import Vhd, { chainVhd, createSyntheticStream, mergeVhd as vhdMerge } from './'
import { SECTOR_SIZE } from './src/_constants'
const initialDir = process.cwd()
@@ -273,7 +271,7 @@ test('createSyntheticStream passes vhd-util check', async () => {
await createRandomFile('randomfile', initalSize)
await convertFromRawToVhd('randomfile', 'randomfile.vhd')
const handler = getHandler({ url: 'file://' + process.cwd() })
const stream = createReadStream(handler, 'randomfile.vhd')
const stream = createSyntheticStream(handler, 'randomfile.vhd')
await fromEvent(
stream.pipe(await fs.createWriteStream('recovered.vhd')),
'finish'

View File

@@ -1,6 +1,6 @@
{
"name": "vhd-lib",
"version": "0.3.0",
"version": "0.3.2",
"license": "AGPL-3.0",
"description": "Primitives for VHD file handling",
"keywords": [],
@@ -20,27 +20,26 @@
"node": ">=6"
},
"dependencies": {
"@babel/runtime": "7.0.0-beta.54",
"async-iterator-to-stream": "^1.0.2",
"core-js": "3.0.0-beta.3",
"from2": "^2.3.0",
"fs-extra": "^7.0.0",
"limit-concurrency-decorator": "^0.4.0",
"promise-toolbox": "^0.9.5",
"promise-toolbox": "^0.10.1",
"struct-fu": "^1.2.0",
"uuid": "^3.0.1"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.54",
"@babel/core": "7.0.0-beta.54",
"@babel/plugin-transform-runtime": "7.0.0-beta.54",
"@babel/preset-env": "7.0.0-beta.54",
"@babel/preset-flow": "7.0.0-beta.54",
"@xen-orchestra/fs": "^0.2.0",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"@xen-orchestra/fs": "^0.3.1",
"babel-plugin-lodash": "^3.3.2",
"cross-env": "^5.1.3",
"execa": "^0.10.0",
"execa": "^1.0.0",
"fs-promise": "^2.0.0",
"get-stream": "^3.0.0",
"get-stream": "^4.0.0",
"index-modules": "^0.3.0",
"rimraf": "^2.6.2",
"tmp": "^0.0.33"

View File

@@ -1,13 +1,10 @@
import { SECTOR_SIZE } from './_constants'
export default function computeGeometryForSize (size) {
const totalSectors = Math.ceil(size / 512)
const totalSectors = Math.min(Math.ceil(size / 512), 65535 * 16 * 255)
let sectorsPerTrackCylinder
let heads
let cylinderTimesHeads
if (totalSectors > 65535 * 16 * 255) {
throw Error('disk is too big')
}
// straight copypasta from the file spec appendix on CHS Calculation
if (totalSectors >= 65535 * 16 * 63) {
sectorsPerTrackCylinder = 255

View File

@@ -58,7 +58,7 @@ export default asyncIteratorToStream(async function * (
const maxTableEntries = Math.ceil(diskSize / VHD_BLOCK_SIZE_BYTES) + 1
const tablePhysicalSizeBytes =
Math.ceil(maxTableEntries * 4 / SECTOR_SIZE) * SECTOR_SIZE
Math.ceil((maxTableEntries * 4) / SECTOR_SIZE) * SECTOR_SIZE
const batPosition = FOOTER_SIZE + HEADER_SIZE
const firstBlockPosition = batPosition + tablePhysicalSizeBytes
@@ -115,7 +115,7 @@ export default asyncIteratorToStream(async function * (
}
next.data.copy(
currentBlockWithBitmap,
bitmapSize + next.offsetBytes % VHD_BLOCK_SIZE_BYTES
bitmapSize + (next.offsetBytes % VHD_BLOCK_SIZE_BYTES)
)
}
yield * yieldAndTrack(currentBlockWithBitmap)

View File

@@ -1,3 +1,6 @@
// see https://github.com/babel/babel/issues/8450
import 'core-js/features/symbol/async-iterator'
export { default } from './vhd'
export { default as chainVhd } from './chain'
export { default as createContentStream } from './createContentStream'

View File

@@ -51,7 +51,10 @@ export default concurrency(2)(async function merge (
// finds first allocated block for the 2 following loops
let firstBlock = 0
while (firstBlock < maxTableEntries && !childVhd.containsBlock(firstBlock)) {
while (
firstBlock < maxTableEntries &&
!childVhd.containsBlock(firstBlock)
) {
++firstBlock
}

View File

@@ -98,7 +98,7 @@ export default class Vhd {
Buffer.alloc(n),
start
)
assert.equal(bytesRead, n)
assert.strictEqual(bytesRead, n)
return buffer
}

View File

@@ -3,11 +3,11 @@ import execa from 'execa'
import rimraf from 'rimraf'
import tmp from 'tmp'
import { createWriteStream, readFile } from 'fs-promise'
import { fromCallback as pFromCallback, fromEvent } from 'promise-toolbox'
import { fromEvent, pFromCallback } from 'promise-toolbox'
import { createFooter } from './_createFooterHeader'
import createReadableRawVHDStream from './createReadableRawStream'
import createReadableSparseVHDStream from './createReadableSparseStream'
import { createReadableRawStream, createReadableSparseStream } from './'
import { createFooter } from './src/_createFooterHeader'
const initialDir = process.cwd()
@@ -54,7 +54,7 @@ test('ReadableRawVHDStream does not crash', async () => {
},
}
const fileSize = 1000
const stream = createReadableRawVHDStream(fileSize, mockParser)
const stream = createReadableRawStream(fileSize, mockParser)
const pipe = stream.pipe(createWriteStream('output.vhd'))
await fromEvent(pipe, 'finish')
await execa('vhd-util', ['check', '-t', '-i', '-n', 'output.vhd'])
@@ -85,7 +85,7 @@ test('ReadableRawVHDStream detects when blocks are out of order', async () => {
}
return expect(
new Promise((resolve, reject) => {
const stream = createReadableRawVHDStream(100000, mockParser)
const stream = createReadableRawStream(100000, mockParser)
stream.on('error', reject)
const pipe = stream.pipe(createWriteStream('outputStream'))
pipe.on('finish', resolve)
@@ -107,7 +107,7 @@ test('ReadableSparseVHDStream can handle a sparse file', async () => {
},
]
const fileSize = blockSize * 110
const stream = createReadableSparseVHDStream(
const stream = createReadableSparseStream(
fileSize,
blockSize,
blocks.map(b => b.offsetBytes),

View File

@@ -0,0 +1,3 @@
module.exports = require('../../@xen-orchestra/babel-config')(
require('./package.json')
)

View File

@@ -30,14 +30,14 @@ exports.resolveRef = (xapi, type, refOrUuidOrNameLabel) =>
isOpaqueRef(refOrUuidOrNameLabel)
? refOrUuidOrNameLabel
: xapi.call(`${type}.get_by_uuid`, refOrUuidOrNameLabel).catch(() =>
xapi
.call(`${type}.get_by_name_label`, refOrUuidOrNameLabel)
.then(refs => {
if (refs.length === 1) {
return refs[0]
}
throw new Error(
`no single match for ${type} with name label ${refOrUuidOrNameLabel}`
)
})
)
xapi
.call(`${type}.get_by_name_label`, refOrUuidOrNameLabel)
.then(refs => {
if (refs.length === 1) {
return refs[0]
}
throw new Error(
`no single match for ${type} with name label ${refOrUuidOrNameLabel}`
)
})
)

View File

@@ -1,6 +1,6 @@
{
"name": "xen-api",
"version": "0.17.0",
"version": "0.19.0",
"license": "ISC",
"description": "Connector to the Xen API",
"keywords": [
@@ -29,34 +29,33 @@
"dist/"
],
"engines": {
"node": ">=4"
"node": ">=6"
},
"dependencies": {
"babel-polyfill": "^6.23.0",
"blocked": "^1.2.1",
"debug": "^3.1.0",
"debug": "^4.0.1",
"event-to-promise": "^0.8.0",
"exec-promise": "^0.7.0",
"http-request-plus": "^0.5.0",
"http-request-plus": "^0.6.0",
"iterable-backoff": "^0.0.0",
"jest-diff": "^23.5.0",
"json-rpc-protocol": "^0.12.0",
"kindof": "^2.0.0",
"lodash": "^4.17.4",
"make-error": "^1.3.0",
"minimist": "^1.2.0",
"ms": "^2.1.1",
"promise-toolbox": "^0.9.5",
"promise-toolbox": "^0.10.1",
"pw": "0.0.4",
"xmlrpc": "^1.3.2",
"xo-collection": "^0.4.1"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-function-bind": "^6.22.0",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.1.3",
"rimraf": "^2.6.1"
},
@@ -67,23 +66,5 @@
"prebuild": "rimraf dist/",
"predev": "yarn run prebuild",
"prepublishOnly": "yarn run build"
},
"babel": {
"plugins": [
"lodash",
"transform-decorators-legacy",
"transform-function-bind"
],
"presets": [
[
"env",
{
"targets": {
"node": 4
}
}
],
"stage-3"
]
}
}

View File

@@ -1,9 +1,8 @@
#!/usr/bin/env node
import 'babel-polyfill'
import blocked from 'blocked'
import createDebug from 'debug'
import diff from 'jest-diff'
import eventToPromise from 'event-to-promise'
import execPromise from 'exec-promise'
import minimist from 'minimist'
@@ -81,16 +80,18 @@ const main = async args => {
})
repl.context.xapi = xapi
repl.context.diff = (a, b) => console.log('%s', diff(a, b))
repl.context.find = predicate => find(xapi.objects.all, predicate)
repl.context.findAll = predicate => filter(xapi.objects.all, predicate)
// Make the REPL waits for promise completion.
repl.eval = (evaluate => (cmd, context, filename, cb) => {
;fromCallback(cb => {
evaluate.call(repl, cmd, context, filename, cb)
})
.then(value => (isArray(value) ? Promise.all(value) : value))
::asCallback(cb)
asCallback.call(
fromCallback(cb => {
evaluate.call(repl, cmd, context, filename, cb)
}).then(value => (isArray(value) ? Promise.all(value) : value)),
cb
)
})(repl.eval)
await eventToPromise(repl, 'exit')

View File

@@ -21,12 +21,12 @@ import {
import {
Cancel,
cancelable,
catchPlus as pCatch,
defer,
delay as pDelay,
fromEvents,
lastly,
timeout as pTimeout,
pCatch,
pDelay,
pFinally,
pTimeout,
TimeoutError,
} from 'promise-toolbox'
@@ -122,7 +122,14 @@ const parseUrl = url => {
}
const [, protocol = 'https:', username, password, hostname, port] = matches
return { protocol, username, password, hostname, port }
const parsedUrl = { protocol, hostname, port }
if (username !== undefined) {
parsedUrl.username = decodeURIComponent(username)
}
if (password !== undefined) {
parsedUrl.password = decodeURIComponent(password)
}
return parsedUrl
}
// -------------------------------------------------------------------
@@ -136,12 +143,16 @@ const {
// -------------------------------------------------------------------
export const NULL_REF = 'OpaqueRef:NULL'
const OPAQUE_REF_PREFIX = 'OpaqueRef:'
export const isOpaqueRef = value =>
typeof value === 'string' && startsWith(value, OPAQUE_REF_PREFIX)
// -------------------------------------------------------------------
const isGetAllRecordsMethod = RegExp.prototype.test.bind(/\.get_all_records$/)
const RE_READ_ONLY_METHOD = /^[^.]+\.get_/
const isReadOnlyCall = (method, args) =>
args.length === 1 &&
@@ -249,7 +260,7 @@ export class Xapi extends EventEmitter {
objects.getKey = getKey
this._objectsByRefs = createObject(null)
this._objectsByRefs['OpaqueRef:NULL'] = undefined
this._objectsByRefs[NULL_REF] = undefined
this._taskWatchers = Object.create(null)
@@ -417,7 +428,7 @@ export class Xapi extends EventEmitter {
this._sessionCall('task.cancel', [taskRef]).catch(noop)
})
return this.watchTask(taskRef)::lastly(() => {
return pFinally.call(this.watchTask(taskRef), () => {
this._sessionCall('task.destroy', [taskRef]).catch(noop)
})
})
@@ -485,8 +496,24 @@ export class Xapi extends EventEmitter {
throw new Error('no object with UUID: ' + uuid)
}
getRecord (type, ref) {
return this._sessionCall(`${type}.get_record`, [ref])
async getRecord (type, ref) {
const record = await this._sessionCall(`${type}.get_record`, [ref])
// All custom properties are read-only and non enumerable.
defineProperties(record, {
$id: { value: record.uuid || ref },
$ref: { value: ref },
$type: { value: type },
})
return record
}
async getRecordByUuid (type, uuid) {
return this.getRecord(
type,
await this._sessionCall(`${type}.get_by_uuid`, [uuid])
)
}
@cancelable
@@ -561,7 +588,7 @@ export class Xapi extends EventEmitter {
headers['content-length'] = '1125899906842624'
}
const doRequest = override =>
const doRequest = (...opts) =>
httpRequest.put(
$cancelToken,
this._url,
@@ -571,11 +598,12 @@ export class Xapi extends EventEmitter {
{
body,
headers,
query,
pathname,
maxRedirects: 0,
rejectUnauthorized: !this._allowUnauthorized,
},
override,
{ query }
...opts
)
// if a stream, sends a dummy request to probe for a
@@ -586,8 +614,6 @@ export class Xapi extends EventEmitter {
// omit task_id because this request will fail on purpose
query: 'task_id' in query ? omit(query, 'task_id') : query,
maxRedirects: 0,
}).then(
response => {
response.req.abort()
@@ -603,7 +629,8 @@ export class Xapi extends EventEmitter {
statusCode,
} = response
if (statusCode === 302 && location !== undefined) {
return doRequest(location)
// ensure the original query is sent
return doRequest(location, { query })
}
}
@@ -636,6 +663,41 @@ export class Xapi extends EventEmitter {
)
}
setField ({ $type, $ref }, field, value) {
return this.call(`${$type}.set_${field}`, $ref, value).then(noop)
}
setFieldEntries (record, field, entries) {
return Promise.all(
Object.keys(entries).map(entry => {
const value = entries[entry]
if (value !== undefined) {
return value === null
? this.unsetFieldEntry(record, field, entry)
: this.setFieldEntry(record, field, entry, value)
}
})
).then(noop)
}
async setFieldEntry ({ $type, $ref }, field, entry, value) {
while (true) {
try {
await this.call(`${$type}.add_to_${field}`, $ref, entry, value)
return
} catch (error) {
if (error == null || error.code !== 'MAP_DUPLICATE_KEY') {
throw error
}
}
await this.unsetFieldEntry({ $type, $ref }, field, entry)
}
}
unsetFieldEntry ({ $type, $ref }, field, entry) {
return this.call(`${$type}.remove_from_${field}`, $ref, entry)
}
watchTask (ref) {
const watchers = this._taskWatchers
if (watchers === undefined) {
@@ -695,7 +757,8 @@ export class Xapi extends EventEmitter {
newArgs.push.apply(newArgs, args)
}
return this._transportCall(method, newArgs)::pCatch(
return pCatch.call(
this._transportCall(method, newArgs),
isSessionInvalid,
() => {
// XAPI is sometimes reinitialized and sessions are lost.
@@ -844,12 +907,15 @@ export class Xapi extends EventEmitter {
_watchEvents () {
const loop = () =>
this.status === CONNECTED &&
this._sessionCall('event.from', [
['*'],
this._fromToken,
EVENT_TIMEOUT + 0.1, // Force float.
])
::pTimeout(EVENT_TIMEOUT * 1.1e3) // 10% longer than the XenAPI timeout
pTimeout
.call(
this._sessionCall('event.from', [
['*'],
this._fromToken,
EVENT_TIMEOUT + 0.1, // Force float.
]),
EVENT_TIMEOUT * 1.1e3 // 10% longer than the XenAPI timeout
)
.then(onSuccess, onFailure)
const onSuccess = ({ events, token, valid_ref_counts: { task } }) => {
@@ -894,7 +960,8 @@ export class Xapi extends EventEmitter {
throw error
}
return loop()::pCatch(
return pCatch.call(
loop(),
isMethodUnknown,
// If the server failed, it is probably due to an excessively
@@ -915,10 +982,7 @@ export class Xapi extends EventEmitter {
return this._sessionCall('system.listMethods').then(methods => {
// Uses introspection to determine the methods to use to get
// all objects.
const getAllRecordsMethods = filter(
methods,
::/\.get_all_records$/.test
)
const getAllRecordsMethods = filter(methods, isGetAllRecordsMethod)
return Promise.all(
map(getAllRecordsMethods, method =>
@@ -982,9 +1046,11 @@ Xapi.prototype._transportCall = reduce(
function () {
let iterator // lazily created
const loop = () =>
call
.apply(this, arguments)
::pCatch(isNetworkError, isXapiNetworkError, error => {
pCatch.call(
call.apply(this, arguments),
isNetworkError,
isXapiNetworkError,
error => {
if (iterator === undefined) {
iterator = fibonacci()
.clamp(undefined, 60)
@@ -1010,17 +1076,19 @@ Xapi.prototype._transportCall = reduce(
debug('%s: network error %s, aborting', this._humanId, error.code)
// mark as disconnected
this.disconnect()::pCatch(noop)
pCatch.call(this.disconnect(), noop)
throw error
})
}
)
return loop()
},
call =>
function loop () {
return call
.apply(this, arguments)
::pCatch(isHostSlave, ({ params: [master] }) => {
return pCatch.call(
call.apply(this, arguments),
isHostSlave,
({ params: [master] }) => {
debug(
'%s: host is slave, attempting to connect at %s',
this._humanId,
@@ -1035,7 +1103,8 @@ Xapi.prototype._transportCall = reduce(
this._url = newUrl
return loop.apply(this, arguments)
})
}
)
},
call =>
function (method) {

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env node
import { delay as pDelay } from 'promise-toolbox'
import { pDelay } from 'promise-toolbox'
import { createClient } from './'
@@ -23,9 +23,11 @@ xapi
// Injects lots of events.
.then(([poolRef]) => {
const loop = () =>
xapi
.call('event.inject', 'pool', poolRef)
::pDelay(10) // A small delay is required to avoid overloading the Xen API.
pDelay
.call(
xapi.call('event.inject', 'pool', poolRef),
10 // A small delay is required to avoid overloading the Xen API.
)
.then(loop)
return loop()

View File

@@ -1,13 +0,0 @@
{
"comments": false,
"compact": true,
"presets": [
[
"env", {
"targets": {
"node": 4
}
}
]
]
}

View File

@@ -1,3 +1,5 @@
'use strict'
// These global variables are not a problem because the algorithm is
// synchronous.
let permissionsByObject
@@ -84,7 +86,7 @@ const checkAuthorizationByTypes = {
'VM-controller': checkMember('$container'),
'VM-snapshot': checkMember('$snapshot_of'),
'VM-snapshot': or(checkSelf, checkMember('$snapshot_of')),
'VM-template': or(checkSelf, checkMember('$pool')),
}
@@ -103,7 +105,12 @@ function checkAuthorization (objectId, permission) {
// -------------------------------------------------------------------
export default (permissionsByObject_, getObject_, permissions, permission) => {
module.exports = (
permissionsByObject_,
getObject_,
permissions,
permission
) => {
// Assign global variables.
permissionsByObject = permissionsByObject_
getObject = getObject_

View File

@@ -1,6 +1,6 @@
{
"name": "xo-acl-resolver",
"version": "0.2.4",
"version": "0.3.0",
"license": "ISC",
"description": "Xen-Orchestra internal: do ACLs resolution",
"keywords": [],
@@ -15,21 +15,11 @@
"email": "julien.fontanet@vates.fr"
},
"preferGlobal": false,
"main": "dist/",
"bin": {},
"files": [
"dist/"
"index.js"
],
"engines": {
"node": ">=0.12"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-preset-env": "^1.6.1"
},
"scripts": {
"build": "babel --source-maps --out-dir=dist/ src/",
"dev": "babel --watch --source-maps --out-dir=dist/ src/",
"prepublishOnly": "yarn run build"
"node": ">=6"
}
}

View File

@@ -28,31 +28,32 @@
"node": ">=6"
},
"dependencies": {
"@babel/polyfill": "7.0.0-beta.54",
"@babel/polyfill": "^7.0.0",
"bluebird": "^3.5.1",
"chalk": "^2.2.0",
"event-to-promise": "^0.8.0",
"exec-promise": "^0.7.0",
"fs-promise": "^2.0.3",
"got": "^8.0.1",
"http-request-plus": "^0.6.0",
"human-format": "^0.10.0",
"l33teral": "^3.0.3",
"lodash": "^4.17.4",
"micromatch": "^3.1.3",
"mkdirp": "^0.5.1",
"nice-pipe": "0.0.0",
"pretty-ms": "^3.0.1",
"pretty-ms": "^4.0.0",
"progress-stream": "^2.0.0",
"promise-toolbox": "^0.10.1",
"pump": "^3.0.0",
"pw": "^0.0.4",
"strip-indent": "^2.0.0",
"xdg-basedir": "^3.0.0",
"xo-lib": "^0.9.0"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.54",
"@babel/core": "7.0.0-beta.54",
"@babel/preset-env": "7.0.0-beta.54",
"@babel/preset-flow": "7.0.0-beta.54",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"cross-env": "^5.1.3",
"rimraf": "^2.6.2"

View File

@@ -11,10 +11,10 @@ const resolveUrl = require('url').resolve
const stat = require('fs-promise').stat
const chalk = require('chalk')
const eventToPromise = require('event-to-promise')
const forEach = require('lodash/forEach')
const fromCallback = require('promise-toolbox/fromCallback')
const getKeys = require('lodash/keys')
const got = require('got')
const hrp = require('http-request-plus').default
const humanFormat = require('human-format')
const identity = require('lodash/identity')
const isArray = require('lodash/isArray')
@@ -23,6 +23,7 @@ const micromatch = require('micromatch')
const nicePipe = require('nice-pipe')
const pairs = require('lodash/toPairs')
const pick = require('lodash/pick')
const pump = require('pump')
const startsWith = require('lodash/startsWith')
const prettyMs = require('pretty-ms')
const progressStream = require('progress-stream')
@@ -308,8 +309,8 @@ async function listObjects (args) {
const properties = getKeys(extractFlags(args))
const filterProperties = properties.length
? function (object) {
return pick(object, properties)
}
return pick(object, properties)
}
: identity
const filter = args.length ? parseParameters(args) : undefined
@@ -362,50 +363,43 @@ async function call (args) {
ensurePathParam(method, file)
url = resolveUrl(baseUrl, result[key])
const output = createWriteStream(file)
const response = await hrp(url)
const progress = progressStream({ time: 1e3 }, printProgress)
return eventToPromise(
nicePipe([
got.stream(url).on('response', function (response) {
const length = response.headers['content-length']
if (length !== undefined) {
progress.length(length)
}
}),
progress,
output,
]),
'finish'
const progress = progressStream(
{
length: response.headers['content-length'],
time: 1e3,
},
printProgress
)
return fromCallback(cb => pump(response, progress, output, cb))
}
if (key === '$sendTo') {
ensurePathParam(method, file)
url = resolveUrl(baseUrl, result[key])
const stats = await stat(file)
const length = stats.size
const { size: length } = await stat(file)
const input = nicePipe([
createReadStream(file),
progressStream(
{
length: length,
length,
time: 1e3,
},
printProgress
),
])
const response = await got.post(url, {
body: input,
headers: {
'content-length': length,
},
method: 'POST',
})
return response.body
return hrp
.post(url, {
body: input,
headers: {
'content-length': length,
},
})
.readAll('utf-8')
}
}

View File

@@ -22,19 +22,17 @@
"*.js"
],
"engines": {
"node": ">=4"
"node": ">=6"
},
"dependencies": {
"@babel/runtime": "7.0.0-beta.54",
"kindof": "^2.0.0",
"lodash": "^4.17.2",
"make-error": "^1.0.2"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.54",
"@babel/core": "7.0.0-beta.54",
"@babel/plugin-transform-runtime": "7.0.0-beta.54",
"@babel/preset-env": "7.0.0-beta.54",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"cross-env": "^5.1.3",
"event-to-promise": "^0.8.0",
"rimraf": "^2.6.1"

View File

@@ -8,7 +8,10 @@ import isObject from './is-object'
// ===================================================================
const { create: createObject, prototype: { hasOwnProperty } } = Object
const {
create: createObject,
prototype: { hasOwnProperty },
} = Object
export const ACTION_ADD = 'add'
export const ACTION_UPDATE = 'update'

View File

@@ -0,0 +1,3 @@
module.exports = require('../../@xen-orchestra/babel-config')(
require('./package.json')
)

View File

@@ -20,20 +20,21 @@
"dist/",
"*.js"
],
"browserslist": [
"> 1%"
],
"engines": {
"node": ">=4"
"node": ">=6"
},
"dependencies": {
"babel-runtime": "^6.18.0",
"lodash": "^4.16.6",
"make-error": "^1.2.1"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.5.2",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.1.3",
"rimraf": "^2.6.1"
},
@@ -44,22 +45,5 @@
"prebuild": "yarn run clean",
"predev": "yarn run prebuild",
"prepublishOnly": "yarn run build"
},
"babel": {
"plugins": [
"lodash"
],
"presets": [
[
"env",
{
"targets": {
"browsers": "> 1%",
"node": 4
}
}
],
"stage-3"
]
}
}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../@xen-orchestra/babel-config')(
require('./package.json')
)

View File

@@ -10,8 +10,7 @@ const xo = new Xo({
url: 'localhost:9000',
})
xo
.open()
xo.open()
.then(function () {
return xo
.call('acl.get', {})

View File

@@ -24,19 +24,22 @@
"files": [
"dist/"
],
"browserslist": [
"> 2%"
],
"engines": {
"node": ">=4"
"node": ">=6"
},
"dependencies": {
"jsonrpc-websocket-client": "^0.3.0",
"jsonrpc-websocket-client": "^0.4.1",
"lodash": "^4.17.2",
"make-error": "^1.0.4"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"babel-preset-env": "^1.5.2",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.1.3",
"rimraf": "^2.6.1"
},
@@ -46,28 +49,5 @@
"prebuild": "rimraf dist/",
"predev": "yarn run prebuild",
"prepublishOnly": "yarn run build"
},
"babel": {
"env": {
"test": {
"ignore": null
}
},
"ignore": "*.spec.js",
"plugins": [
"lodash"
],
"presets": [
[
"env",
{
"targets": {
"browsers": "> 2%",
"node": 4
}
}
],
"stage-3"
]
}
}

View File

@@ -21,15 +21,15 @@
"dist/"
],
"engines": {
"node": ">=4"
"node": ">=6"
},
"dependencies": {
"lodash": "^4.13.1"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.54",
"@babel/core": "7.0.0-beta.54",
"@babel/preset-env": "7.0.0-beta.54",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"cross-env": "^5.1.3",
"deep-freeze": "^0.0.1",

View File

@@ -0,0 +1,3 @@
module.exports = require('../../@xen-orchestra/babel-config')(
require('./package.json')
)

View File

@@ -26,35 +26,19 @@
"dist/"
],
"engines": {
"node": ">=4"
"node": ">=6"
},
"dependencies": {
"babel-runtime": "^6.11.6",
"passport-github": "^1.1.0"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-env": "^1.6.1"
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0"
},
"scripts": {
"build": "NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"dev": "NODE_DEV=development babel --watch --source-maps --out-dir=dist/ src/",
"prepublishOnly": "yarn run build"
},
"babel": {
"plugins": [
"transform-runtime"
],
"presets": [
[
"env",
{
"targets": {
"node": 4
}
}
]
]
}
}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../@xen-orchestra/babel-config')(
require('./package.json')
)

View File

@@ -29,18 +29,16 @@
"dist/"
],
"engines": {
"node": ">=4"
"node": ">=6"
},
"dependencies": {
"babel-runtime": "^6.23.0",
"passport-google-oauth20": "^1.0.0"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.3.3",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.1.3",
"rimraf": "^2.6.1"
},
@@ -50,28 +48,5 @@
"prebuild": "rimraf dist/",
"predev": "yarn run prebuild",
"prepublishOnly": "yarn run build"
},
"babel": {
"env": {
"test": {
"ignore": null
}
},
"ignore": "*.spec.js",
"plugins": [
"transform-runtime",
"lodash"
],
"presets": [
[
"env",
{
"targets": {
"node": 4
}
}
],
"stage-3"
]
}
}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../@xen-orchestra/babel-config')(
require('./package.json')
)

View File

@@ -30,23 +30,21 @@
"dist/"
],
"engines": {
"node": ">=4"
"node": ">=6"
},
"dependencies": {
"babel-runtime": "^6.22.0",
"event-to-promise": "^0.8.0",
"exec-promise": "^0.7.0",
"inquirer": "^6.0.0",
"ldapjs": "^1.0.1",
"lodash": "^4.17.4",
"promise-toolbox": "^0.9.5"
"promise-toolbox": "^0.10.1"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.5.2",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.1.3",
"rimraf": "^2.6.1"
},
@@ -56,22 +54,5 @@
"prebuild": "rimraf dist/",
"predev": "yarn run prebuild",
"prepublishOnly": "yarn run build"
},
"babel": {
"plugins": [
"lodash",
"transform-runtime"
],
"presets": [
[
"env",
{
"targets": {
"node": 4
}
}
],
"stage-3"
]
}
}

View File

@@ -1,5 +1,5 @@
import { forEach, isFinite, isInteger } from 'lodash'
import { forOwn as forOwnAsync } from 'promise-toolbox'
import { pforOwn } from 'promise-toolbox'
import { prompt } from 'inquirer'
// ===================================================================
@@ -160,7 +160,7 @@ const promptByType = {
}
}
await forOwnAsync.call(schema.properties || {}, promptProperty)
await pforOwn.call(schema.properties || {}, promptProperty)
return value
},

View File

@@ -0,0 +1,3 @@
module.exports = require('../../@xen-orchestra/babel-config')(
require('./package.json')
)

View File

@@ -29,17 +29,16 @@
"dist/"
],
"engines": {
"node": ">=4"
"node": ">=6"
},
"dependencies": {
"babel-runtime": "^6.11.6",
"passport-saml": "^0.33.0"
"passport-saml": "^0.35.0"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.1.3",
"rimraf": "^2.6.1"
},
@@ -50,21 +49,5 @@
"prebuild": "yarn run clean",
"predev": "yarn run prebuild",
"prepublishOnly": "yarn run build"
},
"babel": {
"plugins": [
"transform-runtime"
],
"presets": [
[
"env",
{
"targets": {
"node": 4
}
}
],
"stage-3"
]
}
}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../@xen-orchestra/babel-config')(
require('./package.json')
)

View File

@@ -1,6 +1,6 @@
{
"name": "xo-server-backup-reports",
"version": "0.12.3",
"version": "0.14.0",
"license": "AGPL-3.0",
"description": "Backup reports plugin for XO-Server",
"keywords": [
@@ -32,19 +32,18 @@
"dist/"
],
"engines": {
"node": ">=4"
"node": ">=6"
},
"dependencies": {
"babel-runtime": "^6.26.0",
"human-format": "^0.10.0",
"lodash": "^4.13.1",
"moment-timezone": "^0.5.13"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-plugin-lodash": "^3.3.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.5.2",
"cross-env": "^5.1.3",
"rimraf": "^2.6.1"
},
@@ -55,21 +54,5 @@
"prebuild": "yarn run clean",
"predev": "yarn run prebuild",
"prepublishOnly": "yarn run build"
},
"babel": {
"plugins": [
"lodash",
"transform-runtime"
],
"presets": [
[
"env",
{
"targets": {
"node": 4
}
}
]
]
}
}

View File

@@ -30,6 +30,20 @@ export const configurationSchema = {
},
}
export const testSchema = {
type: 'object',
properties: {
runId: {
type: 'string',
description: `<a href="https://xen-orchestra.com/docs/backups.html#backups-execution" rel="noopener noreferrer" target="_blank">job's runId</a>`,
},
},
additionalProperties: false,
required: ['runId'],
}
// ===================================================================
const ICON_FAILURE = '🚨'
@@ -118,6 +132,10 @@ class BackupReportsXoPlugin {
this._xo.on('job:terminated', this._report)
}
test ({ runId }) {
return this._backupNgListener(undefined, undefined, undefined, runId)
}
unload () {
this._xo.removeListener('job:terminated', this._report)
}
@@ -135,6 +153,9 @@ class BackupReportsXoPlugin {
async _backupNgListener (_1, _2, schedule, runJobId) {
const xo = this._xo
const log = await xo.getBackupNgLogs(runJobId)
if (log === undefined) {
throw new Error(`no log found with runId=${JSON.stringify(runJobId)}`)
}
const { reportWhen, mode } = log.data || {}
if (

View File

@@ -0,0 +1,3 @@
module.exports = require('../../@xen-orchestra/babel-config')(
require('./package.json')
)

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