Compare commits

..

13 Commits

Author SHA1 Message Date
Florent BEAUCHAMP
4bd5b38aeb fix(backups): fix health check task during CR (#6830)
Fixes https://xcp-ng.org/forum/post/62073

`healthCheck` is launched after `cleanVm`, therefore it should be closing the parent task, not `cleanVm`.
2023-05-12 10:45:32 +02:00
Julien Fontanet
836db1b807 fix(xo-web/new/network): correct type for vlan (#6829)
BREAKING CHANGE: API method `network.create` no longer accepts a `string` for `vlan` param.

Fixes https://xcp-ng.org/forum/post/62090

Either `number` or `undefined`, not an empty string.
2023-05-12 10:36:59 +02:00
Julien Fontanet
73d88cc5f1 fix(xo-server/vm.convertToTemplate): handle VBD_IS_EMPTY (#6808)
Fixes https://xcp-ng.org/forum/post/61653
2023-05-12 09:12:41 +02:00
Julien Fontanet
3def66d968 chore(xo-vmdk-to-vhd): move notes.md to docs/
So that it will be correctly ignored when publishing the package.
2023-05-12 09:10:00 +02:00
Gabriel Gunullu
3f73138fc3 fix(test-integration): run integration tests only in ci (#6826)
Fixes issues introduced by

- be6233f
- adc5e7d

After the switching from Jest to Tap/Test, those tests were no longer executed during the test-integration script.
2023-05-11 17:47:48 +02:00
Julien Fontanet
bfe621a21d feat: technical release 2023-05-11 14:35:15 +02:00
Julien Fontanet
32fa792eeb feat(xo-web): 5.117.0 2023-05-11 14:23:02 +02:00
Julien Fontanet
a833050fc2 feat(xo-server): 5.114.0 2023-05-11 14:17:40 +02:00
Julien Fontanet
e7e6294bc3 feat(xo-vmdk-to-vhd): 2.5.4 2023-05-11 14:09:23 +02:00
Julien Fontanet
7c71884e27 feat(@vates/task): 0.1.2 2023-05-11 14:03:57 +02:00
Florent BEAUCHAMP
3e822044f2 fix(xo-vmdk-to-vhd): wait for OVA stream to be written before reading more data (#6800) 2023-05-11 12:23:06 +02:00
Julien Fontanet
d457f5fca4 chore(xo-server): use Task.run() helper 2023-05-11 11:10:00 +02:00
Julien Fontanet
1837e01719 fix(xo-server): new Task() now expects data instead of name option
Introduced by 036f3f6bd
2023-05-11 11:08:31 +02:00
30 changed files with 82 additions and 111 deletions

View File

@@ -31,6 +31,6 @@
},
"scripts": {
"postversion": "npm publish --access public",
"test-integration": "tap *.spec.js"
"test-integration": "tap *.integ.js"
}
}

View File

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

View File

@@ -14,7 +14,7 @@
},
"scripts": {
"postversion": "npm publish --access public",
"test": "node--test"
"test-integration": "node--test *.integ.js"
},
"dependencies": {
"@kldzj/stream-throttle": "^1.1.1",

View File

@@ -50,8 +50,8 @@ exports.DeltaReplicationWriter = class DeltaReplicationWriter extends MixinRepli
},
})
this.transfer = task.wrapFn(this.transfer)
this.healthCheck = task.wrapFn(this.healthCheck)
this.cleanup = task.wrapFn(this.cleanup, true)
this.cleanup = task.wrapFn(this.cleanup)
this.healthCheck = task.wrapFn(this.healthCheck, true)
return task.run(() => this._prepare())
}

View File

@@ -1,9 +1,5 @@
# ChangeLog
## **next**
- Add ability to open VM console in new window (PR [#6827](https://github.com/vatesfr/xen-orchestra/pull/6827))
## **0.2.0**
- Invalidate sessionId token after logout (PR [#6480](https://github.com/vatesfr/xen-orchestra/pull/6480))

View File

@@ -24,9 +24,9 @@
<AppLogin />
</div>
<div v-else>
<AppHeader v-if="uiStore.hasUi" />
<AppHeader />
<div style="display: flex">
<AppNavigation v-if="uiStore.hasUi" />
<AppNavigation />
<main class="main">
<RouterView />
</main>

View File

@@ -1,5 +1,5 @@
<template>
<div ref="consoleContainer" class="remote-console" />
<div ref="vmConsoleContainer" class="vm-console" />
</template>
<script lang="ts" setup>
@@ -19,7 +19,7 @@ const props = defineProps<{
isConsoleAvailable: boolean;
}>();
const consoleContainer = ref<HTMLDivElement>();
const vmConsoleContainer = ref<HTMLDivElement>();
const xenApiStore = useXenApiStore();
const url = computed(() => {
if (xenApiStore.currentSessionId == null) {
@@ -78,7 +78,7 @@ const createVncConnection = async () => {
await promiseTimeout(FIBONACCI_MS_ARRAY[nConnectionAttempts - 1]);
}
vncClient = new VncClient(consoleContainer.value!, url.value!.toString(), {
vncClient = new VncClient(vmConsoleContainer.value!, url.value!.toString(), {
wsProtocols: ["binary"],
});
vncClient.scaleViewport = true;
@@ -91,7 +91,7 @@ watch(url, clearVncClient);
watchEffect(() => {
if (
url.value === undefined ||
consoleContainer.value === undefined ||
vmConsoleContainer.value === undefined ||
!props.isConsoleAvailable
) {
return;
@@ -107,8 +107,8 @@ onBeforeUnmount(() => {
</script>
<style lang="postcss" scoped>
.remote-console {
height: 100%;
.vm-console {
height: 80rem;
& > :deep(div) {
background-color: transparent !important;

View File

@@ -1,7 +1,6 @@
import { useBreakpoints, useColorMode } from "@vueuse/core";
import { defineStore } from "pinia";
import { computed, ref } from "vue";
import { useRoute } from "vue-router";
export const useUiStore = defineStore("ui", () => {
const currentHostOpaqueRef = ref();
@@ -14,15 +13,10 @@ export const useUiStore = defineStore("ui", () => {
const isMobile = computed(() => !isDesktop.value);
const route = useRoute();
const hasUi = computed(() => route.query.ui !== "0");
return {
colorMode,
currentHostOpaqueRef,
isDesktop,
isMobile,
hasUi,
};
});

View File

@@ -1,34 +1,20 @@
<template>
<div v-if="!isReady">Loading...</div>
<div v-else-if="!isVmRunning">Console is only available for running VMs.</div>
<template v-else-if="vm && vmConsole">
<RemoteConsole
:is-console-available="!isOperationsPending(vm, STOP_OPERATIONS)"
:location="vmConsole.location"
class="remote-console"
/>
<RouterLink
v-if="uiStore.hasUi"
:to="{ query: { ui: '0' } }"
class="open-link"
target="_blank"
>
<UiIcon :icon="faArrowUpRightFromSquare" />
Open in new window
</RouterLink>
</template>
<RemoteConsole
v-else-if="vm && vmConsole"
:location="vmConsole.location"
:is-console-available="!isOperationsPending(vm, STOP_OPERATIONS)"
/>
</template>
<script lang="ts" setup>
import RemoteConsole from "@/components/RemoteConsole.vue";
import UiIcon from "@/components/ui/icon/UiIcon.vue";
import { isOperationsPending } from "@/libs/utils";
import { useConsoleStore } from "@/stores/console.store";
import { useUiStore } from "@/stores/ui.store";
import { useVmStore } from "@/stores/vm.store";
import { faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
import { computed } from "vue";
import { useRoute } from "vue-router";
import RemoteConsole from "@/components/RemoteConsole.vue";
import { useConsoleStore } from "@/stores/console.store";
import { useVmStore } from "@/stores/vm.store";
import { isOperationsPending } from "@/libs/utils";
const STOP_OPERATIONS = [
"shutdown",
@@ -40,7 +26,6 @@ const STOP_OPERATIONS = [
"suspend",
];
const uiStore = useUiStore();
const route = useRoute();
const { isReady: isVmReady, getByUuid: getVmByUuid } = useVmStore().subscribe();
@@ -64,31 +49,3 @@ const vmConsole = computed(() => {
return getConsoleByOpaqueRef(consoleOpaqueRef);
});
</script>
<style lang="postcss" scoped>
.open-link {
display: flex;
align-items: center;
gap: 1rem;
background-color: var(--color-extra-blue-base);
color: var(--color-blue-scale-500);
text-decoration: none;
padding: 1.5rem;
font-size: 1.6rem;
border-radius: 0 0 0 0.8rem;
position: absolute;
top: 8rem;
right: 0;
white-space: nowrap;
transform: translateX(calc(100% - 4.5rem));
transition: transform 0.2s ease-in-out;
&:hover {
transform: translateX(0);
}
}
.remote-console {
height: calc(100% - 8rem);
}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<ObjectNotFoundWrapper :is-ready="isReady" :uuid-checker="hasUuid">
<VmHeader v-if="uiStore.hasUi" />
<VmHeader />
<RouterView />
</ObjectNotFoundWrapper>
</template>

View File

@@ -21,7 +21,7 @@
"dependencies": {
"@vates/event-listeners-manager": "^1.0.1",
"@vates/parse-duration": "^0.1.1",
"@vates/task": "^0.1.1",
"@vates/task": "^0.1.2",
"@xen-orchestra/log": "^0.6.0",
"acme-client": "^5.0.0",
"app-conf": "^2.3.0",

View File

@@ -43,7 +43,7 @@
"pw": "^0.0.4",
"xdg-basedir": "^4.0.0",
"xo-lib": "^0.11.1",
"xo-vmdk-to-vhd": "^2.5.3"
"xo-vmdk-to-vhd": "^2.5.4"
},
"devDependencies": {
"@babel/cli": "^7.0.0",

View File

@@ -4,7 +4,7 @@
"version": "0.2.2",
"name": "@xen-orchestra/vmware-explorer",
"dependencies": {
"@vates/task": "^0.1.1",
"@vates/task": "^0.1.2",
"@vates/read-chunk": "^1.1.1",
"lodash": "^4.17.21",
"node-fetch": "^3.3.0",

View File

@@ -1,5 +1,25 @@
# ChangeLog
## **next**
### Enhancements
- [Plugins] Clicking on a plugin name now filters out other plugins
### Bug fixes
- [Host/Network] Fix IP configuration not working with empty fields
- [Import/VM/From VMware] Fix `Property description must be an object: undefined` [Forum#61834](https://xcp-ng.org/forum/post/61834) [Forum#61900](https://xcp-ng.org/forum/post/61900)
- [Import/VM/From VMware] Fix `Cannot read properties of undefined (reading 'stream')` [Forum#59879](https://xcp-ng.org/forum/post/59879) (PR [#6825](https://github.com/vatesfr/xen-orchestra/pull/6825))
- [OVA export] Fix major memory leak which may lead to xo-server crash [Forum#56051](https://xcp-ng.org/forum/post/56051) (PR [#6800](https://github.com/vatesfr/xen-orchestra/pull/6800))
### Released packages
- @vates/task 0.1.2
- xo-vmdk-to-vhd 2.5.4
- xo-server 5.114.0
- xo-web 5.117.0
## **5.82.0** (2023-04-28)
<img id="latest" src="https://badgen.net/badge/channel/latest/yellow" alt="Channel: latest" />

View File

@@ -7,15 +7,13 @@
> Users must be able to say: “Nice enhancement, I'm eager to test it”
- [Plugins] Clicking on a plugin name now filters out other plugins
### Bug fixes
> Users must be able to say: “I had this issue, happy to know it's fixed”
- [Host/Network] Fix IP configuration not working with empty fields
- [Import/VM/From VMware] Fix `Property description must be an object: undefined` [Forum#61834](https://xcp-ng.org/forum/post/61834) [Forum#61900](https://xcp-ng.org/forum/post/61900)
- [Import/VM/From VMware] Fix `Cannot read properties of undefined (reading 'stream')` [Forum#59879](https://xcp-ng.org/forum/post/59879) (PR [#6825](https://github.com/vatesfr/xen-orchestra/pull/6825))
- [VM] Fix `VBD_IS_EMPTY` error when converting to template [Forum#61653](https://xcp-ng.org/forum/post/61653) (PR [#6808](https://github.com/vatesfr/xen-orchestra/pull/6808))
- [New/Network] Fix `invalid parameter error` when not providing a VLAN [Forum#62090](https://xcp-ng.org/forum/post/62090) (PR [#6829](https://github.com/vatesfr/xen-orchestra/pull/6829))
- [Backup/Health check] Fix `task has already ended` error during a healthcheck in continous replication [Forum#62073](https://xcp-ng.org/forum/post/62073) (PR [#6830](https://github.com/vatesfr/xen-orchestra/pull/6830))
### Packages to release
@@ -33,8 +31,8 @@
<!--packages-start-->
- @vates/task patch
- xo-server minor
- xo-web minor
- @xen-orchestra/backups patch
- xo-server patch
- xo-web patch
<!--packages-end-->

View File

@@ -96,7 +96,7 @@
"prepare": "husky install",
"prettify": "prettier --ignore-path .gitignore --ignore-unknown --write .",
"test": "npm run test-lint && npm run test-unit",
"test-integration": "jest \".integ\\.spec\\.js$\"",
"test-integration": "jest \".integ\\.spec\\.js$\" && scripts/run-script.js --parallel test-integration",
"test-lint": "eslint --ignore-path .gitignore --ignore-pattern packages/xo-web .",
"test-unit": "jest \"^(?!.*\\.integ\\.spec\\.js$)\" && scripts/run-script.js --bail test"
},

View File

@@ -35,7 +35,7 @@
},
"scripts": {
"postversion": "npm publish",
"test": "node--test"
"test-integration": "node--test *.integ.js"
},
"devDependencies": {
"execa": "^4.0.0",

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "xo-server",
"version": "5.113.0",
"version": "5.114.0",
"license": "AGPL-3.0-or-later",
"description": "Server part of Xen-Orchestra",
"keywords": [
@@ -136,7 +136,7 @@
"xo-collection": "^0.5.0",
"xo-common": "^0.8.0",
"xo-remote-parser": "^0.9.2",
"xo-vmdk-to-vhd": "^2.5.3"
"xo-vmdk-to-vhd": "^2.5.4"
},
"devDependencies": {
"@babel/cli": "^7.0.0",

View File

@@ -10,7 +10,7 @@ export async function create({ pool, name, description, pif, mtu = 1500, vlan =
description,
pifId: pif && this.getObject(pif, 'PIF')._xapiId,
mtu: +mtu,
vlan: +vlan,
vlan,
})
if (nbd) {
@@ -27,7 +27,7 @@ create.params = {
description: { type: 'string', minLength: 0, optional: true },
pif: { type: 'string', optional: true },
mtu: { type: 'integer', optional: true },
vlan: { type: ['integer', 'string'], optional: true },
vlan: { type: 'integer', optional: true },
}
create.resolve = {

View File

@@ -883,7 +883,8 @@ export async function convertToTemplate({ vm }) {
// Attempts to eject all removable media
const ignoreNotRemovable = error => {
if (error.code !== 'VBD_NOT_REMOVABLE_MEDIA') {
const { code } = error
if (code !== 'VBD_IS_EMPTY' && code !== 'VBD_NOT_REMOVABLE_MEDIA') {
throw error
}
}
@@ -1375,7 +1376,7 @@ export async function importMultipleFromEsxi({
await asyncEach(
vms,
async vm => {
await new Task({ name: `importing vm ${vm}` }).run(async () => {
await Task.run({ data: { name: `importing vm ${vm}` } }, async () => {
try {
const vmUuid = await this.migrationfromEsxi({
host,

View File

@@ -154,7 +154,7 @@ export default class MigrateVm {
}
#connectToEsxi(host, user, password, sslVerify) {
return new Task({ name: `connecting to ${host}` }).run(async () => {
return Task.run({ data: { name: `connecting to ${host}` } }, async () => {
const esxi = new Esxi(host, user, password, sslVerify)
await fromEvent(esxi, 'ready')
return esxi
@@ -174,21 +174,24 @@ export default class MigrateVm {
const app = this._app
const esxi = await this.#connectToEsxi(host, user, password, sslVerify)
const esxiVmMetadata = await new Task({ name: `get metadata of ${vmId}` }).run(async () => {
const esxiVmMetadata = await Task.run({ data: { name: `get metadata of ${vmId}` } }, async () => {
return esxi.getTransferableVmMetadata(vmId)
})
const { disks, firmware, memory, name_label, networks, nCpus, powerState, snapshots } = esxiVmMetadata
const isRunning = powerState !== 'poweredOff'
const chainsByNodes = await new Task({ name: `build disks and snapshots chains for ${vmId}` }).run(async () => {
return this.#buildDiskChainByNode(disks, snapshots)
})
const chainsByNodes = await Task.run(
{ data: { name: `build disks and snapshots chains for ${vmId}` } },
async () => {
return this.#buildDiskChainByNode(disks, snapshots)
}
)
const sr = app.getXapiObject(srId)
const xapi = sr.$xapi
const vm = await new Task({ name: 'creating MV on XCP side ' }).run(async () => {
const vm = await Task.run({ data: { name: 'creating MV on XCP side' } }, async () => {
// got data, ready to start creating
const vm = await xapi._getOrWaitObject(
await xapi.VM_create({
@@ -233,7 +236,7 @@ export default class MigrateVm {
const vhds = await Promise.all(
Object.keys(chainsByNodes).map(async (node, userdevice) =>
new Task({ name: `Cold import of disks ${node} ` }).run(async () => {
Task.run({ data: { name: `Cold import of disks ${node}` } }, async () => {
const chainByNode = chainsByNodes[node]
const vdi = await xapi._getOrWaitObject(
await xapi.VDI_create({
@@ -280,11 +283,11 @@ export default class MigrateVm {
if (isRunning && stopSource) {
// it the vm was running, we stop it and transfer the data in the active disk
await new Task({ name: 'powering down source VM' }).run(() => esxi.powerOff(vmId))
await Task.run({ data: { name: 'powering down source VM' } }, () => esxi.powerOff(vmId))
await Promise.all(
Object.keys(chainsByNodes).map(async (node, userdevice) => {
await new Task({ name: `Transfering deltas of ${userdevice}` }).run(async () => {
await Task.run({ data: { name: `Transfering deltas of ${userdevice}` } }, async () => {
const chainByNode = chainsByNodes[node]
const disk = chainByNode[chainByNode.length - 1]
const { fileName, path, datastore, isFull } = disk
@@ -313,7 +316,7 @@ export default class MigrateVm {
)
}
await new Task({ name: 'Finishing transfer' }).run(async () => {
await Task.run({ data: { name: 'Finishing transfer' } }, async () => {
// remove the importing in label
await vm.set_name_label(esxiVmMetadata.name_label)

View File

@@ -1,7 +1,7 @@
{
"private": false,
"name": "xo-vmdk-to-vhd",
"version": "2.5.3",
"version": "2.5.4",
"license": "AGPL-3.0-or-later",
"description": "JS lib reading and writing .vmdk and .ova files",
"keywords": [

View File

@@ -26,7 +26,7 @@ export async function writeOvaOn(
async function writeDisk(entry, blockIterator) {
for await (const block of blockIterator) {
entry.write(block)
await fromCallback.call(entry, entry.write, block)
}
}

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "xo-web",
"version": "5.116.1",
"version": "5.117.0",
"license": "AGPL-3.0-or-later",
"description": "Web interface client for Xen-Orchestra",
"keywords": [
@@ -137,7 +137,7 @@
"xo-common": "^0.8.0",
"xo-lib": "^0.11.1",
"xo-remote-parser": "^0.9.2",
"xo-vmdk-to-vhd": "^2.5.3"
"xo-vmdk-to-vhd": "^2.5.4"
},
"scripts": {
"build": "GIT_HEAD=$(git rev-parse HEAD) NODE_ENV=production gulp build",

View File

@@ -197,11 +197,11 @@ const NewNetwork = decorate([
networks,
pif,
pifs,
vlan,
} = state
let { mtu } = state
let { mtu, vlan } = state
mtu = mtu === '' ? undefined : +mtu
vlan = vlan === '' ? undefined : +vlan
return bonded
? createBondedNetwork({

View File

@@ -22,6 +22,8 @@ example.{,c,m}js.map
/test/
/tests/
*.integ.{,c,m}js
*.integ.{,c,m}js.map
*.spec.{,c,m}js
*.spec.{,c,m}js.map
*.test.{,c,m}js