Compare commits
43 Commits
xo-lite-v0
...
lite/migra
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82196ddd0e | ||
|
|
988179a3f0 | ||
|
|
ce617e0732 | ||
|
|
f0f429a473 | ||
|
|
bb6e158301 | ||
|
|
7ff304a042 | ||
|
|
7df1994d7f | ||
|
|
a3a2fda157 | ||
|
|
d8530f9518 | ||
|
|
d3062ac35c | ||
|
|
b11f11f4db | ||
|
|
79d48f3b56 | ||
|
|
869f7ffab0 | ||
|
|
6665d6a8e6 | ||
|
|
8eb0bdbda7 | ||
|
|
710689db0b | ||
|
|
801eea7e75 | ||
|
|
7885e1e6e7 | ||
|
|
d384c746ca | ||
|
|
a30d962b1d | ||
|
|
b6e078716b | ||
|
|
34b69c7ee8 | ||
|
|
70bf8d9620 | ||
|
|
c8bfda9cf5 | ||
|
|
1eb4c20844 | ||
|
|
e5c5f19219 | ||
|
|
db92f0e365 | ||
|
|
570de7c0fe | ||
|
|
90e0f26845 | ||
|
|
c714bc3518 | ||
|
|
48e0acda32 | ||
|
|
013cdbcd96 | ||
|
|
fdd886f213 | ||
|
|
de70ef3064 | ||
|
|
9142a95f79 | ||
|
|
1c6aebf997 | ||
|
|
7b9ec4b7a7 | ||
|
|
decb87f0c9 | ||
|
|
e17470f56c | ||
|
|
99ddbcdc67 | ||
|
|
6953e2fe7b | ||
|
|
beb1063ba1 | ||
|
|
7773edd590 |
@@ -33,7 +33,7 @@
|
||||
"test": "node--test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"sinon": "^15.0.1",
|
||||
"sinon": "^16.0.0",
|
||||
"tap": "^16.3.0",
|
||||
"test": "^3.2.1"
|
||||
}
|
||||
|
||||
@@ -13,12 +13,15 @@ describe('decorateWith', () => {
|
||||
const expectedFn = Function.prototype
|
||||
const newFn = () => {}
|
||||
|
||||
const decorator = decorateWith(function wrapper(fn, ...args) {
|
||||
assert.deepStrictEqual(fn, expectedFn)
|
||||
assert.deepStrictEqual(args, expectedArgs)
|
||||
const decorator = decorateWith(
|
||||
function wrapper(fn, ...args) {
|
||||
assert.deepStrictEqual(fn, expectedFn)
|
||||
assert.deepStrictEqual(args, expectedArgs)
|
||||
|
||||
return newFn
|
||||
}, ...expectedArgs)
|
||||
return newFn
|
||||
},
|
||||
...expectedArgs
|
||||
)
|
||||
|
||||
const descriptor = {
|
||||
configurable: true,
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"ensure-array": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"sinon": "^15.0.1",
|
||||
"sinon": "^16.0.0",
|
||||
"test": "^3.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"fuse-native": "^2.2.6",
|
||||
"lru-cache": "^7.14.0",
|
||||
"promise-toolbox": "^0.21.0",
|
||||
"vhd-lib": "^4.5.0"
|
||||
"vhd-lib": "^4.6.0"
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
"license": "ISC",
|
||||
"version": "0.1.0",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
"node": ">=12.3"
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"test": "node--test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"sinon": "^15.0.1",
|
||||
"sinon": "^16.0.0",
|
||||
"test": "^3.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
|
||||
"dependencies": {
|
||||
"@xen-orchestra/async-map": "^0.1.2",
|
||||
"@xen-orchestra/backups": "^0.42.0",
|
||||
"@xen-orchestra/backups": "^0.42.1",
|
||||
"@xen-orchestra/fs": "^4.1.0",
|
||||
"filenamify": "^6.0.0",
|
||||
"getopts": "^2.2.5",
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Disposable } from 'promise-toolbox'
|
||||
import { getVmBackupDir } from '../../_getVmBackupDir.mjs'
|
||||
|
||||
import { Abstract } from './_Abstract.mjs'
|
||||
import { extractIdsFromSimplePattern } from '../../extractIdsFromSimplePattern.mjs'
|
||||
|
||||
export const AbstractRemote = class AbstractRemoteVmBackupRunner extends Abstract {
|
||||
constructor({
|
||||
@@ -34,7 +35,8 @@ export const AbstractRemote = class AbstractRemoteVmBackupRunner extends Abstrac
|
||||
this._writers = writers
|
||||
|
||||
const RemoteWriter = this._getRemoteWriter()
|
||||
Object.entries(remoteAdapters).forEach(([remoteId, adapter]) => {
|
||||
extractIdsFromSimplePattern(job.remotes).forEach(remoteId => {
|
||||
const adapter = remoteAdapters[remoteId]
|
||||
const targetSettings = {
|
||||
...settings,
|
||||
...allSettings[remoteId],
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/vatesfr/xen-orchestra.git"
|
||||
},
|
||||
"version": "0.42.0",
|
||||
"version": "0.42.1",
|
||||
"engines": {
|
||||
"node": ">=14.18"
|
||||
},
|
||||
@@ -44,14 +44,14 @@
|
||||
"proper-lockfile": "^4.1.2",
|
||||
"tar": "^6.1.15",
|
||||
"uuid": "^9.0.0",
|
||||
"vhd-lib": "^4.5.0",
|
||||
"vhd-lib": "^4.6.0",
|
||||
"xen-api": "^1.3.6",
|
||||
"yazl": "^2.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"fs-extra": "^11.1.0",
|
||||
"rimraf": "^5.0.1",
|
||||
"sinon": "^15.0.1",
|
||||
"sinon": "^16.0.0",
|
||||
"test": "^3.2.1",
|
||||
"tmp": "^0.2.1"
|
||||
},
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"test": "node--test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"sinon": "^15.0.1",
|
||||
"sinon": "^16.0.0",
|
||||
"test": "^3.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
"cross-env": "^7.0.2",
|
||||
"dotenv": "^16.0.0",
|
||||
"rimraf": "^5.0.1",
|
||||
"sinon": "^15.0.4",
|
||||
"sinon": "^16.0.0",
|
||||
"test": "^3.3.0",
|
||||
"tmp": "^0.2.1"
|
||||
},
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
## **next**
|
||||
|
||||
- Ability to migrate selected VMs to another host (PR [#7040](https://github.com/vatesfr/xen-orchestra/pull/7040))
|
||||
- Ability to snapshot selected VMs (PR [#7021](https://github.com/vatesfr/xen-orchestra/pull/7021))
|
||||
- Add Patches to Pool Dashboard (PR [#6709](https://github.com/vatesfr/xen-orchestra/pull/6709))
|
||||
|
||||
## **0.1.3** (2023-09-01)
|
||||
|
||||
- Add Alarms to Pool Dashboard (PR [#6976](https://github.com/vatesfr/xen-orchestra/pull/6976))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
|
||||
@@ -46,7 +46,7 @@ watchEffect(() => {
|
||||
color: var(--color-blue-scale-500);
|
||||
border-radius: 0.5em;
|
||||
background-color: var(--color-blue-scale-100);
|
||||
z-index: 2;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.triangle {
|
||||
|
||||
@@ -14,66 +14,66 @@
|
||||
</UiActionButton>
|
||||
</UiFilterGroup>
|
||||
|
||||
<UiModal
|
||||
v-if="isOpen"
|
||||
:icon="faFilter"
|
||||
@submit.prevent="handleSubmit"
|
||||
@close="handleCancel"
|
||||
>
|
||||
<div class="rows">
|
||||
<CollectionFilterRow
|
||||
v-for="(newFilter, index) in newFilters"
|
||||
:key="newFilter.id"
|
||||
v-model="newFilters[index]"
|
||||
:available-filters="availableFilters"
|
||||
@remove="removeNewFilter"
|
||||
/>
|
||||
</div>
|
||||
<UiModal v-model="isOpen">
|
||||
<ConfirmModalLayout @submit.prevent="handleSubmit">
|
||||
<template #default>
|
||||
<div class="rows">
|
||||
<CollectionFilterRow
|
||||
v-for="(newFilter, index) in newFilters"
|
||||
:key="newFilter.id"
|
||||
v-model="newFilters[index]"
|
||||
:available-filters="availableFilters"
|
||||
@remove="removeNewFilter"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="newFilters.some((filter) => filter.isAdvanced)"
|
||||
class="available-properties"
|
||||
>
|
||||
{{ $t("available-properties-for-advanced-filter") }}
|
||||
<div class="properties">
|
||||
<UiBadge
|
||||
v-for="(filter, property) in availableFilters"
|
||||
:key="property"
|
||||
:icon="getFilterIcon(filter)"
|
||||
<div
|
||||
v-if="newFilters.some((filter) => filter.isAdvanced)"
|
||||
class="available-properties"
|
||||
>
|
||||
{{ property }}
|
||||
</UiBadge>
|
||||
</div>
|
||||
</div>
|
||||
{{ $t("available-properties-for-advanced-filter") }}
|
||||
<div class="properties">
|
||||
<UiBadge
|
||||
v-for="(filter, property) in availableFilters"
|
||||
:key="property"
|
||||
:icon="getFilterIcon(filter)"
|
||||
>
|
||||
{{ property }}
|
||||
</UiBadge>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #buttons>
|
||||
<UiButton transparent @click="addNewFilter">
|
||||
{{ $t("add-or") }}
|
||||
</UiButton>
|
||||
<UiButton :disabled="!isFilterValid" type="submit">
|
||||
{{ $t(editedFilter ? "update" : "add") }}
|
||||
</UiButton>
|
||||
<UiButton outlined @click="handleCancel">
|
||||
{{ $t("cancel") }}
|
||||
</UiButton>
|
||||
</template>
|
||||
<template #buttons>
|
||||
<UiButton transparent @click="addNewFilter">
|
||||
{{ $t("add-or") }}
|
||||
</UiButton>
|
||||
<UiButton :disabled="!isFilterValid" type="submit">
|
||||
{{ $t(editedFilter ? "update" : "add") }}
|
||||
</UiButton>
|
||||
<UiButton outlined @click="close">
|
||||
{{ $t("cancel") }}
|
||||
</UiButton>
|
||||
</template>
|
||||
</ConfirmModalLayout>
|
||||
</UiModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Or, parse } from "complex-matcher";
|
||||
import { computed, ref } from "vue";
|
||||
import type { Filters, NewFilter } from "@/types/filter";
|
||||
import { faFilter, faPlus } from "@fortawesome/free-solid-svg-icons";
|
||||
import CollectionFilterRow from "@/components/CollectionFilterRow.vue";
|
||||
import ConfirmModalLayout from "@/components/ui/modals/layouts/ConfirmModalLayout.vue";
|
||||
import UiModal from "@/components/ui/modals/UiModal.vue";
|
||||
import UiActionButton from "@/components/ui/UiActionButton.vue";
|
||||
import UiBadge from "@/components/ui/UiBadge.vue";
|
||||
import UiButton from "@/components/ui/UiButton.vue";
|
||||
import UiFilter from "@/components/ui/UiFilter.vue";
|
||||
import UiFilterGroup from "@/components/ui/UiFilterGroup.vue";
|
||||
import UiModal from "@/components/ui/UiModal.vue";
|
||||
import useModal from "@/composables/modal.composable";
|
||||
import { getFilterIcon } from "@/libs/utils";
|
||||
import type { Filters, NewFilter } from "@/types/filter";
|
||||
import { faPlus } from "@fortawesome/free-solid-svg-icons";
|
||||
import { Or, parse } from "complex-matcher";
|
||||
import { computed, ref } from "vue";
|
||||
|
||||
defineProps<{
|
||||
activeFilters: string[];
|
||||
@@ -85,7 +85,7 @@ const emit = defineEmits<{
|
||||
(event: "removeFilter", filter: string): void;
|
||||
}>();
|
||||
|
||||
const { isOpen, open, close } = useModal();
|
||||
const { isOpen, open, close } = useModal({ onClose: () => reset() });
|
||||
const newFilters = ref<NewFilter[]>([]);
|
||||
let newFilterId = 0;
|
||||
|
||||
@@ -156,11 +156,6 @@ const handleSubmit = () => {
|
||||
reset();
|
||||
close();
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
reset();
|
||||
close();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
@@ -190,4 +185,10 @@ const handleCancel = () => {
|
||||
margin-top: 0.6rem;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.rows {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -219,7 +219,6 @@ const valueInputAfter = computed(() =>
|
||||
.collection-filter-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 1rem 0;
|
||||
border-bottom: 1px solid var(--background-color-secondary);
|
||||
gap: 1rem;
|
||||
|
||||
@@ -242,4 +241,8 @@ const valueInputAfter = computed(() =>
|
||||
.form-widget-advanced {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.ui-action-button:first-of-type {
|
||||
margin-left: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -17,56 +17,56 @@
|
||||
</UiActionButton>
|
||||
</UiFilterGroup>
|
||||
|
||||
<UiModal
|
||||
v-if="isOpen"
|
||||
:icon="faSort"
|
||||
@submit.prevent="handleSubmit"
|
||||
@close="handleCancel"
|
||||
>
|
||||
<div class="form-widgets">
|
||||
<FormWidget :label="$t('sort-by')">
|
||||
<select v-model="newSortProperty">
|
||||
<option v-if="!newSortProperty"></option>
|
||||
<option
|
||||
v-for="(sort, property) in availableSorts"
|
||||
:key="property"
|
||||
:value="property"
|
||||
>
|
||||
{{ sort.label ?? property }}
|
||||
</option>
|
||||
</select>
|
||||
</FormWidget>
|
||||
<FormWidget>
|
||||
<select v-model="newSortIsAscending">
|
||||
<option :value="true">{{ $t("ascending") }}</option>
|
||||
<option :value="false">{{ $t("descending") }}</option>
|
||||
</select>
|
||||
</FormWidget>
|
||||
</div>
|
||||
<template #buttons>
|
||||
<UiButton type="submit">{{ $t("add") }}</UiButton>
|
||||
<UiButton outlined @click="handleCancel">
|
||||
{{ $t("cancel") }}
|
||||
</UiButton>
|
||||
</template>
|
||||
<UiModal v-model="isOpen">
|
||||
<ConfirmModalLayout @submit.prevent="handleSubmit">
|
||||
<template #default>
|
||||
<div class="form-widgets">
|
||||
<FormWidget :label="$t('sort-by')">
|
||||
<select v-model="newSortProperty">
|
||||
<option v-if="!newSortProperty"></option>
|
||||
<option
|
||||
v-for="(sort, property) in availableSorts"
|
||||
:key="property"
|
||||
:value="property"
|
||||
>
|
||||
{{ sort.label ?? property }}
|
||||
</option>
|
||||
</select>
|
||||
</FormWidget>
|
||||
<FormWidget>
|
||||
<select v-model="newSortIsAscending">
|
||||
<option :value="true">{{ $t("ascending") }}</option>
|
||||
<option :value="false">{{ $t("descending") }}</option>
|
||||
</select>
|
||||
</FormWidget>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #buttons>
|
||||
<UiButton type="submit">{{ $t("add") }}</UiButton>
|
||||
<UiButton outlined @click="close">
|
||||
{{ $t("cancel") }}
|
||||
</UiButton>
|
||||
</template>
|
||||
</ConfirmModalLayout>
|
||||
</UiModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import FormWidget from "@/components/FormWidget.vue";
|
||||
import UiIcon from "@/components/ui/icon/UiIcon.vue";
|
||||
import ConfirmModalLayout from "@/components/ui/modals/layouts/ConfirmModalLayout.vue";
|
||||
import UiModal from "@/components/ui/modals/UiModal.vue";
|
||||
import UiActionButton from "@/components/ui/UiActionButton.vue";
|
||||
import UiButton from "@/components/ui/UiButton.vue";
|
||||
import UiFilter from "@/components/ui/UiFilter.vue";
|
||||
import UiFilterGroup from "@/components/ui/UiFilterGroup.vue";
|
||||
import UiIcon from "@/components/ui/icon/UiIcon.vue";
|
||||
import UiModal from "@/components/ui/UiModal.vue";
|
||||
import useModal from "@/composables/modal.composable";
|
||||
import type { ActiveSorts, Sorts } from "@/types/sort";
|
||||
import {
|
||||
faCaretDown,
|
||||
faCaretUp,
|
||||
faPlus,
|
||||
faSort,
|
||||
} from "@fortawesome/free-solid-svg-icons";
|
||||
import { ref } from "vue";
|
||||
|
||||
@@ -81,7 +81,7 @@ const emit = defineEmits<{
|
||||
(event: "removeSort", property: string): void;
|
||||
}>();
|
||||
|
||||
const { isOpen, open, close } = useModal();
|
||||
const { isOpen, open, close } = useModal({ onClose: () => reset() });
|
||||
|
||||
const newSortProperty = ref();
|
||||
const newSortIsAscending = ref<boolean>(true);
|
||||
@@ -96,11 +96,6 @@ const handleSubmit = () => {
|
||||
reset();
|
||||
close();
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
reset();
|
||||
close();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
|
||||
@@ -28,13 +28,9 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="item in filteredAndSortedCollection" :key="item[idProperty]">
|
||||
<tr v-for="item in filteredAndSortedCollection" :key="item.$ref">
|
||||
<td v-if="isSelectable">
|
||||
<input
|
||||
v-model="selected"
|
||||
:value="item[props.idProperty]"
|
||||
type="checkbox"
|
||||
/>
|
||||
<input v-model="selected" :value="item.$ref" type="checkbox" />
|
||||
</td>
|
||||
<slot :item="item" name="body-row" />
|
||||
</tr>
|
||||
@@ -42,10 +38,7 @@
|
||||
</UiTable>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, toRef, watch } from "vue";
|
||||
import type { Filters } from "@/types/filter";
|
||||
import type { Sorts } from "@/types/sort";
|
||||
<script generic="T extends XenApiRecord<any>" lang="ts" setup>
|
||||
import CollectionFilter from "@/components/CollectionFilter.vue";
|
||||
import CollectionSorter from "@/components/CollectionSorter.vue";
|
||||
import UiTable from "@/components/ui/UiTable.vue";
|
||||
@@ -54,17 +47,20 @@ import useCollectionSorter from "@/composables/collection-sorter.composable";
|
||||
import useFilteredCollection from "@/composables/filtered-collection.composable";
|
||||
import useMultiSelect from "@/composables/multi-select.composable";
|
||||
import useSortedCollection from "@/composables/sorted-collection.composable";
|
||||
import type { XenApiRecord } from "@/libs/xen-api/xen-api.types";
|
||||
import type { Filters } from "@/types/filter";
|
||||
import type { Sorts } from "@/types/sort";
|
||||
import { computed, toRef, watch } from "vue";
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue?: string[];
|
||||
modelValue?: T["$ref"][];
|
||||
availableFilters?: Filters;
|
||||
availableSorts?: Sorts;
|
||||
collection: Record<string, any>[];
|
||||
idProperty: string;
|
||||
collection: T[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(event: "update:modelValue", selectedRefs: string[]): void;
|
||||
(event: "update:modelValue", selectedRefs: T["$ref"][]): void;
|
||||
}>();
|
||||
|
||||
const isSelectable = computed(() => props.modelValue !== undefined);
|
||||
@@ -85,12 +81,10 @@ const filteredAndSortedCollection = useSortedCollection(
|
||||
compareFn
|
||||
);
|
||||
|
||||
const usableRefs = computed(() =>
|
||||
props.collection.map((item) => item[props.idProperty])
|
||||
);
|
||||
const usableRefs = computed(() => props.collection.map((item) => item["$ref"]));
|
||||
|
||||
const selectableRefs = computed(() =>
|
||||
filteredAndSortedCollection.value.map((item) => item[props.idProperty])
|
||||
filteredAndSortedCollection.value.map((item) => item["$ref"])
|
||||
);
|
||||
|
||||
const { selected, areAllSelected } = useMultiSelect(usableRefs, selectableRefs);
|
||||
|
||||
71
@xen-orchestra/lite/src/components/HostPatchesTable.vue
Normal file
71
@xen-orchestra/lite/src/components/HostPatchesTable.vue
Normal file
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<UiCardSpinner v-if="!areSomeLoaded" />
|
||||
<UiTable v-else class="hosts-patches-table" :class="{ desktop: isDesktop }">
|
||||
<tr v-for="patch in sortedPatches" :key="patch.$id">
|
||||
<th>{{ patch.name }}</th>
|
||||
<td>
|
||||
<div class="version">
|
||||
{{ patch.version }}
|
||||
<template v-if="hasMultipleHosts">
|
||||
<UiSpinner v-if="!areAllLoaded" />
|
||||
<UiCounter
|
||||
v-else
|
||||
v-tooltip="{
|
||||
placement: 'left',
|
||||
content: $t('n-hosts-awaiting-patch', {
|
||||
n: patch.$hostRefs.size,
|
||||
}),
|
||||
}"
|
||||
:value="patch.$hostRefs.size"
|
||||
class="counter"
|
||||
color="error"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</UiTable>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import UiCardSpinner from "@/components/ui/UiCardSpinner.vue";
|
||||
import UiCounter from "@/components/ui/UiCounter.vue";
|
||||
import UiSpinner from "@/components/ui/UiSpinner.vue";
|
||||
import UiTable from "@/components/ui/UiTable.vue";
|
||||
import type { XenApiPatchWithHostRefs } from "@/composables/host-patches.composable";
|
||||
import { vTooltip } from "@/directives/tooltip.directive";
|
||||
import { useUiStore } from "@/stores/ui.store";
|
||||
import { computed } from "vue";
|
||||
|
||||
const props = defineProps<{
|
||||
patches: XenApiPatchWithHostRefs[];
|
||||
hasMultipleHosts: boolean;
|
||||
areAllLoaded: boolean;
|
||||
areSomeLoaded: boolean;
|
||||
}>();
|
||||
|
||||
const sortedPatches = computed(() =>
|
||||
[...props.patches].sort(
|
||||
(patch1, patch2) => patch1.changelog.date - patch2.changelog.date
|
||||
)
|
||||
);
|
||||
|
||||
const { isDesktop } = useUiStore();
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.hosts-patches-table.desktop {
|
||||
max-width: 45rem;
|
||||
}
|
||||
|
||||
.version {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.counter {
|
||||
font-size: 1rem;
|
||||
}
|
||||
</style>
|
||||
@@ -66,8 +66,8 @@ onUnmounted(() => {
|
||||
store.value?.unsubscribe(subscriptionId);
|
||||
});
|
||||
|
||||
const record = computed<ObjectTypeToRecord<HandledTypes> | undefined>(() =>
|
||||
store.value?.getByUuid(props.uuid as any)
|
||||
const record = computed<ObjectTypeToRecord<HandledTypes> | undefined>(
|
||||
() => store.value?.getByUuid(props.uuid as any)
|
||||
);
|
||||
|
||||
const isReady = computed(() => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import UiIcon from "@/components/ui/icon/UiIcon.vue";
|
||||
import { POWER_STATE } from "@/libs/xen-api/xen-api.utils";
|
||||
import { VM_POWER_STATE } from "@/libs/xen-api/xen-api.enums";
|
||||
import {
|
||||
faMoon,
|
||||
faPause,
|
||||
@@ -15,14 +15,14 @@ import {
|
||||
import { computed } from "vue";
|
||||
|
||||
const props = defineProps<{
|
||||
state: POWER_STATE;
|
||||
state: VM_POWER_STATE;
|
||||
}>();
|
||||
|
||||
const icons = {
|
||||
[POWER_STATE.RUNNING]: faPlay,
|
||||
[POWER_STATE.PAUSED]: faPause,
|
||||
[POWER_STATE.SUSPENDED]: faMoon,
|
||||
[POWER_STATE.HALTED]: faStop,
|
||||
[VM_POWER_STATE.RUNNING]: faPlay,
|
||||
[VM_POWER_STATE.PAUSED]: faPause,
|
||||
[VM_POWER_STATE.SUSPENDED]: faMoon,
|
||||
[VM_POWER_STATE.HALTED]: faStop,
|
||||
};
|
||||
|
||||
const icon = computed(() => icons[props.state] ?? faQuestion);
|
||||
|
||||
@@ -1,45 +1,58 @@
|
||||
<template>
|
||||
<UiModal
|
||||
v-if="isSslModalOpen"
|
||||
:icon="faServer"
|
||||
color="error"
|
||||
@close="clearUnreachableHostsUrls"
|
||||
>
|
||||
<template #title>{{ $t("unreachable-hosts") }}</template>
|
||||
<div class="description">
|
||||
<p>{{ $t("following-hosts-unreachable") }}</p>
|
||||
<p>{{ $t("allow-self-signed-ssl") }}</p>
|
||||
<ul>
|
||||
<li v-for="url in unreachableHostsUrls" :key="url">
|
||||
<a :href="url" class="link" rel="noopener" target="_blank">{{
|
||||
url
|
||||
}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<template #buttons>
|
||||
<UiButton color="success" @click="reload">
|
||||
{{ $t("unreachable-hosts-reload-page") }}
|
||||
</UiButton>
|
||||
<UiButton @click="clearUnreachableHostsUrls">{{ $t("cancel") }}</UiButton>
|
||||
</template>
|
||||
<UiModal v-model="isSslModalOpen" color="error">
|
||||
<ConfirmModalLayout :icon="faServer">
|
||||
<template #title>{{ $t("unreachable-hosts") }}</template>
|
||||
|
||||
<template #default>
|
||||
<div class="description">
|
||||
<p>{{ $t("following-hosts-unreachable") }}</p>
|
||||
<p>{{ $t("allow-self-signed-ssl") }}</p>
|
||||
<ul>
|
||||
<li v-for="url in unreachableHostsUrls" :key="url">
|
||||
<a :href="url" class="link" rel="noopener" target="_blank">{{
|
||||
url
|
||||
}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #buttons>
|
||||
<UiButton color="success" @click="reload">
|
||||
{{ $t("unreachable-hosts-reload-page") }}
|
||||
</UiButton>
|
||||
<UiButton @click="closeSslModal">{{ $t("cancel") }}</UiButton>
|
||||
</template>
|
||||
</ConfirmModalLayout>
|
||||
</UiModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import ConfirmModalLayout from "@/components/ui/modals/layouts/ConfirmModalLayout.vue";
|
||||
import UiModal from "@/components/ui/modals/UiModal.vue";
|
||||
import UiButton from "@/components/ui/UiButton.vue";
|
||||
import useModal from "@/composables/modal.composable";
|
||||
import { useHostCollection } from "@/stores/xen-api/host.store";
|
||||
import { faServer } from "@fortawesome/free-solid-svg-icons";
|
||||
import UiModal from "@/components/ui/UiModal.vue";
|
||||
import UiButton from "@/components/ui/UiButton.vue";
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { difference } from "lodash-es";
|
||||
import { ref, watch } from "vue";
|
||||
|
||||
const { records: hosts } = useHostCollection();
|
||||
const unreachableHostsUrls = ref<Set<string>>(new Set());
|
||||
const clearUnreachableHostsUrls = () => unreachableHostsUrls.value.clear();
|
||||
const isSslModalOpen = computed(() => unreachableHostsUrls.value.size > 0);
|
||||
const reload = () => window.location.reload();
|
||||
|
||||
const { isOpen: isSslModalOpen, close: closeSslModal } = useModal({
|
||||
onClose: () => unreachableHostsUrls.value.clear(),
|
||||
});
|
||||
|
||||
watch(
|
||||
() => unreachableHostsUrls.value.size,
|
||||
(size) => {
|
||||
isSslModalOpen.value = size > 0;
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
watch(hosts, (nextHosts, previousHosts) => {
|
||||
difference(nextHosts, previousHosts).forEach((host) => {
|
||||
const url = new URL("http://localhost");
|
||||
@@ -53,7 +66,11 @@ watch(hosts, (nextHosts, previousHosts) => {
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.description p {
|
||||
margin: 1rem 0;
|
||||
.description {
|
||||
text-align: center;
|
||||
|
||||
p {
|
||||
margin: 1rem 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -58,7 +58,7 @@ const getDefaultOpenedDirectories = (): Set<string> => {
|
||||
}
|
||||
|
||||
const openedDirectories = new Set<string>();
|
||||
const parts = currentRoute.path.split("/");
|
||||
const parts = currentRoute.path.split("/").slice(2);
|
||||
let currentPath = "";
|
||||
|
||||
for (const part of parts) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<template>
|
||||
<UiModal v-if="isRawValueModalOpen" @close="closeRawValueModal">
|
||||
<CodeHighlight :code="rawValueModalPayload" />
|
||||
<UiModal v-model="isRawValueModalOpen">
|
||||
<BasicModalLayout>
|
||||
<CodeHighlight :code="rawValueModalPayload" />
|
||||
</BasicModalLayout>
|
||||
</UiModal>
|
||||
<StoryParamsTable>
|
||||
<thead>
|
||||
@@ -99,7 +101,8 @@ import CodeHighlight from "@/components/CodeHighlight.vue";
|
||||
import StoryParamsTable from "@/components/component-story/StoryParamsTable.vue";
|
||||
import StoryWidget from "@/components/component-story/StoryWidget.vue";
|
||||
import UiIcon from "@/components/ui/icon/UiIcon.vue";
|
||||
import UiModal from "@/components/ui/UiModal.vue";
|
||||
import BasicModalLayout from "@/components/ui/modals/layouts/BasicModalLayout.vue";
|
||||
import UiModal from "@/components/ui/modals/UiModal.vue";
|
||||
import useModal from "@/composables/modal.composable";
|
||||
import useSortedCollection from "@/composables/sorted-collection.composable";
|
||||
import { vTooltip } from "@/directives/tooltip.directive";
|
||||
@@ -130,7 +133,6 @@ const model = useVModel(props, "modelValue", emit);
|
||||
|
||||
const {
|
||||
open: openRawValueModal,
|
||||
close: closeRawValueModal,
|
||||
isOpen: isRawValueModalOpen,
|
||||
payload: rawValueModalPayload,
|
||||
} = useModal<string>();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
v-if="label !== undefined || learnMoreUrl !== undefined"
|
||||
class="label-container"
|
||||
>
|
||||
<label :for="id" class="label">
|
||||
<label :class="{ light }" :for="id" class="label">
|
||||
<UiIcon :icon="icon" />
|
||||
{{ label }}
|
||||
</label>
|
||||
@@ -58,6 +58,7 @@ const props = withDefaults(
|
||||
error?: string;
|
||||
help?: string;
|
||||
disabled?: boolean;
|
||||
light?: boolean;
|
||||
}>(),
|
||||
{ disabled: undefined }
|
||||
);
|
||||
@@ -95,14 +96,24 @@ useContext(DisabledContext, () => props.disabled);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.label {
|
||||
text-transform: uppercase;
|
||||
font-weight: 700;
|
||||
color: var(--color-blue-scale-100);
|
||||
font-size: 1.4rem;
|
||||
padding: 1rem 0;
|
||||
|
||||
&.light {
|
||||
font-size: 1.6rem;
|
||||
color: var(--color-blue-scale-300);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
&:not(.light) {
|
||||
font-size: 1.4rem;
|
||||
text-transform: uppercase;
|
||||
font-weight: 700;
|
||||
color: var(--color-blue-scale-100);
|
||||
}
|
||||
}
|
||||
|
||||
.messages-container {
|
||||
|
||||
@@ -1,20 +1,28 @@
|
||||
<template>
|
||||
<UiModal
|
||||
@submit.prevent="saveJson"
|
||||
v-model="isCodeModalOpen"
|
||||
:color="isJsonValid ? 'success' : 'error'"
|
||||
v-if="isCodeModalOpen"
|
||||
:icon="faCode"
|
||||
@close="closeCodeModal"
|
||||
closable
|
||||
>
|
||||
<FormTextarea class="modal-textarea" v-model="editedJson" />
|
||||
<template #buttons>
|
||||
<UiButton transparent @click="formatJson">{{ $t("reformat") }}</UiButton>
|
||||
<UiButton outlined @click="closeCodeModal">{{ $t("cancel") }}</UiButton>
|
||||
<UiButton :disabled="!isJsonValid" type="submit"
|
||||
>{{ $t("save") }}
|
||||
</UiButton>
|
||||
</template>
|
||||
<FormModalLayout @submit.prevent="saveJson" :icon="faCode">
|
||||
<template #default>
|
||||
<FormTextarea class="modal-textarea" v-model="editedJson" />
|
||||
</template>
|
||||
|
||||
<template #buttons>
|
||||
<UiButton transparent @click="formatJson">
|
||||
{{ $t("reformat") }}
|
||||
</UiButton>
|
||||
<UiButton outlined @click="closeCodeModal">
|
||||
{{ $t("cancel") }}
|
||||
</UiButton>
|
||||
<UiButton :disabled="!isJsonValid" type="submit">
|
||||
{{ $t("save") }}
|
||||
</UiButton>
|
||||
</template>
|
||||
</FormModalLayout>
|
||||
</UiModal>
|
||||
|
||||
<FormInput
|
||||
@click="openCodeModal"
|
||||
:model-value="jsonValue"
|
||||
@@ -26,8 +34,9 @@
|
||||
<script lang="ts" setup>
|
||||
import FormInput from "@/components/form/FormInput.vue";
|
||||
import FormTextarea from "@/components/form/FormTextarea.vue";
|
||||
import FormModalLayout from "@/components/ui/modals/layouts/FormModalLayout.vue";
|
||||
import UiModal from "@/components/ui/modals/UiModal.vue";
|
||||
import UiButton from "@/components/ui/UiButton.vue";
|
||||
import UiModal from "@/components/ui/UiModal.vue";
|
||||
import useModal from "@/composables/modal.composable";
|
||||
import { faCode } from "@fortawesome/free-solid-svg-icons";
|
||||
import { useVModel, whenever } from "@vueuse/core";
|
||||
|
||||
@@ -41,11 +41,11 @@ import { useHostCollection } from "@/stores/xen-api/host.store";
|
||||
import { useVmCollection } from "@/stores/xen-api/vm.store";
|
||||
import { useVmMetricsCollection } from "@/stores/xen-api/vm-metrics.store";
|
||||
import { percent } from "@/libs/utils";
|
||||
import { POWER_STATE } from "@/libs/xen-api/xen-api.utils";
|
||||
import { VM_POWER_STATE } from "@/libs/xen-api/xen-api.enums";
|
||||
import { logicAnd } from "@vueuse/math";
|
||||
import { computed } from "vue";
|
||||
|
||||
const ACTIVE_STATES = new Set([POWER_STATE.RUNNING, POWER_STATE.PAUSED]);
|
||||
const ACTIVE_STATES = new Set([VM_POWER_STATE.RUNNING, VM_POWER_STATE.PAUSED]);
|
||||
|
||||
const {
|
||||
hasError: hostStoreHasError,
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<UiCard>
|
||||
<UiCardTitle class="patches-title">
|
||||
{{ $t("patches") }}
|
||||
<template v-if="areAllLoaded" #right>
|
||||
{{ $t("n-missing", { n: count }) }}
|
||||
</template>
|
||||
</UiCardTitle>
|
||||
<div class="table-container">
|
||||
<HostPatches
|
||||
:are-all-loaded="areAllLoaded"
|
||||
:are-some-loaded="areSomeLoaded"
|
||||
:has-multiple-hosts="hosts.length > 1"
|
||||
:patches="patches"
|
||||
/>
|
||||
</div>
|
||||
</UiCard>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import HostPatches from "@/components/HostPatchesTable.vue";
|
||||
import UiCard from "@/components/ui/UiCard.vue";
|
||||
import UiCardTitle from "@/components/ui/UiCardTitle.vue";
|
||||
import { useHostPatches } from "@/composables/host-patches.composable";
|
||||
import { useHostCollection } from "@/stores/xen-api/host.store";
|
||||
|
||||
const { records: hosts } = useHostCollection();
|
||||
|
||||
const { count, patches, areSomeLoaded, areAllLoaded } = useHostPatches(hosts);
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.patches-title {
|
||||
--section-title-right-color: var(--color-red-vates-base);
|
||||
}
|
||||
|
||||
.table-container {
|
||||
max-height: 40rem;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -1,157 +0,0 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<form
|
||||
:class="className"
|
||||
class="ui-modal"
|
||||
v-bind="$attrs"
|
||||
@click.self="emit('close')"
|
||||
>
|
||||
<div class="container">
|
||||
<span v-if="onClose" class="close-icon" @click="emit('close')">
|
||||
<UiIcon :icon="faXmark" />
|
||||
</span>
|
||||
<div v-if="icon || $slots.icon" class="modal-icon">
|
||||
<slot name="icon">
|
||||
<UiIcon :icon="icon" />
|
||||
</slot>
|
||||
</div>
|
||||
<UiTitle v-if="$slots.title" type="h4">
|
||||
<slot name="title" />
|
||||
</UiTitle>
|
||||
<div v-if="$slots.subtitle" class="subtitle">
|
||||
<slot name="subtitle" />
|
||||
</div>
|
||||
<div v-if="$slots.default" class="content">
|
||||
<slot />
|
||||
</div>
|
||||
<UiButtonGroup :color="color">
|
||||
<slot name="buttons" />
|
||||
</UiButtonGroup>
|
||||
</div>
|
||||
</form>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import UiButtonGroup from "@/components/ui/UiButtonGroup.vue";
|
||||
import UiIcon from "@/components/ui/icon/UiIcon.vue";
|
||||
import UiTitle from "@/components/ui/UiTitle.vue";
|
||||
import type { IconDefinition } from "@fortawesome/fontawesome-common-types";
|
||||
import { faXmark } from "@fortawesome/free-solid-svg-icons";
|
||||
import { useMagicKeys, whenever } from "@vueuse/core";
|
||||
import { computed } from "vue";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
icon?: IconDefinition;
|
||||
color?: "info" | "warning" | "error" | "success";
|
||||
onClose?: () => void;
|
||||
}>(),
|
||||
{ color: "info" }
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(event: "close"): void;
|
||||
}>();
|
||||
|
||||
const { escape } = useMagicKeys();
|
||||
whenever(escape, () => emit("close"));
|
||||
|
||||
const className = computed(() => {
|
||||
return [`color-${props.color}`, { "has-icon": props.icon !== undefined }];
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.ui-modal {
|
||||
position: fixed;
|
||||
z-index: 2;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
overflow: auto;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #00000080;
|
||||
}
|
||||
|
||||
.color-success {
|
||||
--modal-color: var(--color-green-infra-base);
|
||||
--modal-background-color: var(--background-color-green-infra);
|
||||
}
|
||||
|
||||
.color-info {
|
||||
--modal-color: var(--color-extra-blue-base);
|
||||
--modal-background-color: var(--background-color-extra-blue);
|
||||
}
|
||||
|
||||
.color-warning {
|
||||
--modal-color: var(--color-orange-world-base);
|
||||
--modal-background-color: var(--background-color-orange-world);
|
||||
}
|
||||
|
||||
.color-error {
|
||||
--modal-color: var(--color-red-vates-base);
|
||||
--modal-background-color: var(--background-color-red-vates);
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
min-width: 40rem;
|
||||
padding: 4.2rem;
|
||||
text-align: center;
|
||||
border-radius: 1rem;
|
||||
background-color: var(--modal-background-color);
|
||||
box-shadow: var(--shadow-400);
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
font-size: 2rem;
|
||||
position: absolute;
|
||||
top: 1.5rem;
|
||||
right: 2rem;
|
||||
padding: 0.2rem 0.5rem;
|
||||
cursor: pointer;
|
||||
color: var(--modal-color);
|
||||
}
|
||||
|
||||
.container :deep(.accent) {
|
||||
color: var(--modal-color);
|
||||
}
|
||||
|
||||
.modal-icon {
|
||||
font-size: 4.8rem;
|
||||
margin: 2rem 0;
|
||||
color: var(--modal-color);
|
||||
}
|
||||
|
||||
.ui-title {
|
||||
margin-top: 4rem;
|
||||
|
||||
.has-icon & {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 1.6rem;
|
||||
font-weight: 400;
|
||||
color: var(--color-blue-scale-200);
|
||||
}
|
||||
|
||||
.content {
|
||||
overflow: auto;
|
||||
font-size: 1.6rem;
|
||||
max-height: calc(100vh - 40rem);
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.ui-button-group {
|
||||
margin-top: 4rem;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<UiIcon
|
||||
:class="textClass"
|
||||
:icon="faXmark"
|
||||
class="modal-close-icon"
|
||||
@click="close"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import UiIcon from "@/components/ui/icon/UiIcon.vue";
|
||||
import { useContext } from "@/composables/context.composable";
|
||||
import { ColorContext } from "@/context";
|
||||
import { IK_MODAL_CLOSE } from "@/types/injection-keys";
|
||||
import { faXmark } from "@fortawesome/free-solid-svg-icons";
|
||||
import { inject } from "vue";
|
||||
|
||||
const { textClass } = useContext(ColorContext);
|
||||
|
||||
const close = inject(IK_MODAL_CLOSE, undefined);
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.modal-close-icon {
|
||||
font-size: 2rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<component
|
||||
:is="tag"
|
||||
:class="[backgroundClass, { nested: isNested }]"
|
||||
class="modal-container"
|
||||
>
|
||||
<header v-if="$slots.header" class="modal-header">
|
||||
<slot name="header" />
|
||||
</header>
|
||||
<main v-if="$slots.default" class="modal-content">
|
||||
<slot name="default" />
|
||||
</main>
|
||||
<footer v-if="$slots.footer" class="modal-footer">
|
||||
<slot name="footer" />
|
||||
</footer>
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useContext } from "@/composables/context.composable";
|
||||
import { ColorContext } from "@/context";
|
||||
import type { Color } from "@/types";
|
||||
import { IK_MODAL_NESTED } from "@/types/injection-keys";
|
||||
import { inject, provide } from "vue";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
tag?: string;
|
||||
color?: Color;
|
||||
}>(),
|
||||
{ tag: "div" }
|
||||
);
|
||||
|
||||
defineSlots<{
|
||||
header: () => any;
|
||||
default: () => any;
|
||||
footer: () => any;
|
||||
}>();
|
||||
|
||||
const { backgroundClass } = useContext(ColorContext, () => props.color);
|
||||
|
||||
const isNested = inject(IK_MODAL_NESTED, false);
|
||||
provide(IK_MODAL_NESTED, true);
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.modal-container {
|
||||
display: grid;
|
||||
grid-template-rows: 1fr auto 1fr;
|
||||
max-width: calc(100vw - 2rem);
|
||||
max-height: calc(100vh - 20rem);
|
||||
padding: 2rem;
|
||||
gap: 1rem;
|
||||
border-radius: 1rem;
|
||||
font-size: 1.6rem;
|
||||
|
||||
&:not(.nested) {
|
||||
min-width: 40rem;
|
||||
box-shadow: var(--shadow-400);
|
||||
}
|
||||
|
||||
&.nested {
|
||||
margin-top: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
grid-row: 1;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
text-align: center;
|
||||
grid-row: 2;
|
||||
padding: 2rem;
|
||||
max-height: 75vh;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
grid-row: 3;
|
||||
align-self: end;
|
||||
}
|
||||
</style>
|
||||
57
@xen-orchestra/lite/src/components/ui/modals/UiModal.vue
Normal file
57
@xen-orchestra/lite/src/components/ui/modals/UiModal.vue
Normal file
@@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div v-if="isOpen" class="ui-modal" @click.self="close">
|
||||
<slot />
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useContext } from "@/composables/context.composable";
|
||||
import { ColorContext } from "@/context";
|
||||
import type { Color } from "@/types";
|
||||
import { IK_MODAL_CLOSE } from "@/types/injection-keys";
|
||||
import { useMagicKeys, useVModel, whenever } from "@vueuse/core/index";
|
||||
import { provide } from "vue";
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean;
|
||||
color?: Color;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(event: "update:modelValue", value: boolean): void;
|
||||
}>();
|
||||
|
||||
const isOpen = useVModel(props, "modelValue", emit);
|
||||
|
||||
const close = () => (isOpen.value = false);
|
||||
|
||||
provide(IK_MODAL_CLOSE, close);
|
||||
|
||||
useContext(ColorContext, () => props.color);
|
||||
|
||||
const { escape } = useMagicKeys();
|
||||
|
||||
whenever(escape, () => close());
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.ui-modal {
|
||||
position: fixed;
|
||||
z-index: 2;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
overflow: auto;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(26, 27, 56, 0.25);
|
||||
flex-direction: column;
|
||||
gap: 2rem;
|
||||
font-size: 1.6rem;
|
||||
font-weight: 400;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<ModalContainer>
|
||||
<template #header>
|
||||
<ModalCloseIcon class="close-icon" />
|
||||
</template>
|
||||
|
||||
<template #default>
|
||||
<slot />
|
||||
</template>
|
||||
</ModalContainer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import ModalCloseIcon from "@/components/ui/modals/ModalCloseIcon.vue";
|
||||
import ModalContainer from "@/components/ui/modals/ModalContainer.vue";
|
||||
|
||||
defineSlots<{
|
||||
default: () => void;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.close-icon {
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<ModalContainer tag="form">
|
||||
<template #header>
|
||||
<div class="close-bar">
|
||||
<ModalCloseIcon />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #default>
|
||||
<UiIcon :class="textClass" :icon="icon" class="main-icon" />
|
||||
<div v-if="$slots.title || $slots.subtitle" class="titles">
|
||||
<UiTitle v-if="$slots.title" type="h4">
|
||||
<slot name="title" />
|
||||
</UiTitle>
|
||||
<div v-if="$slots.subtitle" class="subtitle">
|
||||
<slot name="subtitle" />
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="$slots.default">
|
||||
<slot name="default" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<UiButtonGroup>
|
||||
<slot name="buttons" />
|
||||
</UiButtonGroup>
|
||||
</template>
|
||||
</ModalContainer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import UiIcon from "@/components/ui/icon/UiIcon.vue";
|
||||
import ModalCloseIcon from "@/components/ui/modals/ModalCloseIcon.vue";
|
||||
import ModalContainer from "@/components/ui/modals/ModalContainer.vue";
|
||||
import UiButtonGroup from "@/components/ui/UiButtonGroup.vue";
|
||||
import UiTitle from "@/components/ui/UiTitle.vue";
|
||||
import { useContext } from "@/composables/context.composable";
|
||||
import { ColorContext } from "@/context";
|
||||
import type { IconDefinition } from "@fortawesome/fontawesome-common-types";
|
||||
|
||||
defineProps<{
|
||||
icon?: IconDefinition;
|
||||
}>();
|
||||
|
||||
const { textClass } = useContext(ColorContext);
|
||||
|
||||
defineSlots<{
|
||||
title: () => void;
|
||||
subtitle: () => void;
|
||||
default: () => void;
|
||||
buttons: () => void;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.close-bar {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.main-icon {
|
||||
font-size: 4.8rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.titles {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 1.6rem;
|
||||
font-weight: 400;
|
||||
color: var(--color-blue-scale-200);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<ModalContainer tag="form">
|
||||
<template #header>
|
||||
<div :class="borderClass" class="title-bar">
|
||||
<UiIcon :class="textClass" :icon="icon" />
|
||||
<slot name="title" />
|
||||
<ModalCloseIcon class="close-icon" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #default>
|
||||
<slot />
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<UiButtonGroup class="footer-buttons">
|
||||
<slot name="buttons" />
|
||||
</UiButtonGroup>
|
||||
</template>
|
||||
</ModalContainer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import UiIcon from "@/components/ui/icon/UiIcon.vue";
|
||||
import ModalCloseIcon from "@/components/ui/modals/ModalCloseIcon.vue";
|
||||
import ModalContainer from "@/components/ui/modals/ModalContainer.vue";
|
||||
import UiButtonGroup from "@/components/ui/UiButtonGroup.vue";
|
||||
import { useContext } from "@/composables/context.composable";
|
||||
import { ColorContext, DisabledContext } from "@/context";
|
||||
import type { IconDefinition } from "@fortawesome/fontawesome-common-types";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
icon?: IconDefinition;
|
||||
disabled?: boolean;
|
||||
}>(),
|
||||
{ disabled: undefined }
|
||||
);
|
||||
|
||||
defineSlots<{
|
||||
title: () => void;
|
||||
default: () => void;
|
||||
buttons: () => void;
|
||||
}>();
|
||||
|
||||
const { textClass, borderClass } = useContext(ColorContext);
|
||||
|
||||
useContext(DisabledContext, () => props.disabled);
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.title-bar {
|
||||
display: flex;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
font-size: 2.4rem;
|
||||
gap: 1rem;
|
||||
padding-bottom: 1rem;
|
||||
font-weight: 500;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
margin-left: auto;
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.footer-buttons {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
||||
@@ -14,7 +14,7 @@
|
||||
import MenuItem from "@/components/menu/MenuItem.vue";
|
||||
import { useVmCollection } from "@/stores/xen-api/vm.store";
|
||||
import { vTooltip } from "@/directives/tooltip.directive";
|
||||
import { POWER_STATE, VM_OPERATION } from "@/libs/xen-api/xen-api.utils";
|
||||
import { VM_POWER_STATE, VM_OPERATION } from "@/libs/xen-api/xen-api.enums";
|
||||
import type { XenApiVm } from "@/libs/xen-api/xen-api.types";
|
||||
import { useXenApiStore } from "@/stores/xen-api.store";
|
||||
import { faCopy } from "@fortawesome/free-solid-svg-icons";
|
||||
@@ -36,7 +36,7 @@ const areAllSelectedVmsHalted = computed(
|
||||
() =>
|
||||
selectedVms.value.length > 0 &&
|
||||
selectedVms.value.every(
|
||||
(selectedVm) => selectedVm.power_state === POWER_STATE.HALTED
|
||||
(selectedVm) => selectedVm.power_state === VM_POWER_STATE.HALTED
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -1,48 +1,49 @@
|
||||
<template>
|
||||
<MenuItem
|
||||
v-tooltip="areSomeVmsInExecution && $t('selected-vms-in-execution')"
|
||||
:disabled="areSomeVmsInExecution"
|
||||
:disabled="isDisabled"
|
||||
:icon="faTrashCan"
|
||||
@click="openDeleteModal"
|
||||
>
|
||||
{{ $t("delete") }}
|
||||
</MenuItem>
|
||||
<UiModal
|
||||
v-if="isDeleteModalOpen"
|
||||
:icon="faSatellite"
|
||||
@close="closeDeleteModal"
|
||||
>
|
||||
<template #title>
|
||||
<i18n-t keypath="confirm-delete" scope="global" tag="div">
|
||||
<span :class="textClass">
|
||||
{{ $t("n-vms", { n: vmRefs.length }) }}
|
||||
</span>
|
||||
</i18n-t>
|
||||
</template>
|
||||
<template #subtitle>
|
||||
{{ $t("please-confirm") }}
|
||||
</template>
|
||||
<template #buttons>
|
||||
<UiButton outlined @click="closeDeleteModal">
|
||||
{{ $t("go-back") }}
|
||||
</UiButton>
|
||||
<UiButton @click="deleteVms">
|
||||
{{ $t("delete-vms", { n: vmRefs.length }) }}
|
||||
</UiButton>
|
||||
</template>
|
||||
<UiModal v-model="isDeleteModalOpen">
|
||||
<ConfirmModalLayout :icon="faSatellite">
|
||||
<template #title>
|
||||
<i18n-t keypath="confirm-delete" scope="global" tag="div">
|
||||
<span :class="textClass">
|
||||
{{ $t("n-vms", { n: vmRefs.length }) }}
|
||||
</span>
|
||||
</i18n-t>
|
||||
</template>
|
||||
|
||||
<template #subtitle>
|
||||
{{ $t("please-confirm") }}
|
||||
</template>
|
||||
|
||||
<template #buttons>
|
||||
<UiButton outlined @click="closeDeleteModal">
|
||||
{{ $t("go-back") }}
|
||||
</UiButton>
|
||||
<UiButton @click="deleteVms">
|
||||
{{ $t("delete-vms", { n: vmRefs.length }) }}
|
||||
</UiButton>
|
||||
</template>
|
||||
</ConfirmModalLayout>
|
||||
</UiModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import MenuItem from "@/components/menu/MenuItem.vue";
|
||||
import ConfirmModalLayout from "@/components/ui/modals/layouts/ConfirmModalLayout.vue";
|
||||
import UiModal from "@/components/ui/modals/UiModal.vue";
|
||||
import UiButton from "@/components/ui/UiButton.vue";
|
||||
import UiModal from "@/components/ui/UiModal.vue";
|
||||
import { useContext } from "@/composables/context.composable";
|
||||
import useModal from "@/composables/modal.composable";
|
||||
import { ColorContext } from "@/context";
|
||||
import { vTooltip } from "@/directives/tooltip.directive";
|
||||
import type { XenApiVm } from "@/libs/xen-api/xen-api.types";
|
||||
import { POWER_STATE } from "@/libs/xen-api/xen-api.utils";
|
||||
import { VM_POWER_STATE } from "@/libs/xen-api/xen-api.enums";
|
||||
import { useXenApiStore } from "@/stores/xen-api.store";
|
||||
import { useVmCollection } from "@/stores/xen-api/vm.store";
|
||||
import { faSatellite, faTrashCan } from "@fortawesome/free-solid-svg-icons";
|
||||
@@ -65,7 +66,11 @@ const vms = computed<XenApiVm[]>(() =>
|
||||
);
|
||||
|
||||
const areSomeVmsInExecution = computed(() =>
|
||||
vms.value.some((vm) => vm.power_state !== POWER_STATE.HALTED)
|
||||
vms.value.some((vm) => vm.power_state !== VM_POWER_STATE.HALTED)
|
||||
);
|
||||
|
||||
const isDisabled = computed(
|
||||
() => vms.value.length === 0 || areSomeVmsInExecution.value
|
||||
);
|
||||
|
||||
const deleteVms = async () => {
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
<template>
|
||||
<MenuItem
|
||||
v-tooltip="
|
||||
!areAllVmsAllowedToMigrate && $t('some-selected-vms-can-not-be-migrated')
|
||||
"
|
||||
:busy="isMigrating"
|
||||
:disabled="isParentDisabled || !areAllVmsAllowedToMigrate"
|
||||
:icon="faRoute"
|
||||
@click="openModal"
|
||||
>
|
||||
{{ $t("migrate") }}
|
||||
</MenuItem>
|
||||
|
||||
<UiModal v-model="isModalOpen">
|
||||
<FormModalLayout
|
||||
:disabled="!isReady || isMigrating"
|
||||
@submit.prevent="handleMigrate"
|
||||
>
|
||||
<template #title>
|
||||
{{ $t("migrate-n-vms", { n: selectedRefs.length }) }}
|
||||
</template>
|
||||
|
||||
<div>
|
||||
<FormInputWrapper :label="$t('select-destination-host')" light>
|
||||
<FormSelect v-model="selectedHostRef">
|
||||
<option :value="undefined">{{ $t("please-select") }}</option>
|
||||
<option
|
||||
v-for="host in availableHosts"
|
||||
:key="host.$ref"
|
||||
:value="host.$ref"
|
||||
>
|
||||
{{ host.name_label }}
|
||||
</option>
|
||||
</FormSelect>
|
||||
</FormInputWrapper>
|
||||
|
||||
<FormInputWrapper
|
||||
v-if="selectedHostRef !== undefined"
|
||||
:label="$t('select-optional-migration-network')"
|
||||
light
|
||||
>
|
||||
<FormSelect v-model="selectedMigrationNetworkRef">
|
||||
<option :value="undefined">{{ $t("please-select") }}</option>
|
||||
<option
|
||||
v-for="network in availableNetworks"
|
||||
:key="network.$ref"
|
||||
:value="network.$ref"
|
||||
>
|
||||
{{ network.name_label }}
|
||||
</option>
|
||||
</FormSelect>
|
||||
</FormInputWrapper>
|
||||
|
||||
<FormInputWrapper
|
||||
v-if="selectedMigrationNetworkRef !== undefined"
|
||||
:label="$t('select-destination-sr')"
|
||||
light
|
||||
>
|
||||
<FormSelect v-model="selectedSrRef">
|
||||
<option :value="undefined">{{ $t("please-select") }}</option>
|
||||
<option v-for="sr in availableSrs" :key="sr.$ref" :value="sr.$ref">
|
||||
{{ sr.name_label }}
|
||||
</option>
|
||||
</FormSelect>
|
||||
</FormInputWrapper>
|
||||
</div>
|
||||
|
||||
<template #buttons>
|
||||
<UiButton outlined @click="closeModal" :disabled="false">
|
||||
{{ isMigrating ? $t("close") : $t("cancel") }}
|
||||
</UiButton>
|
||||
<UiButton
|
||||
:busy="isMigrating"
|
||||
:disabled="!canExecuteMigration"
|
||||
v-tooltip="notMigratableReason ?? false"
|
||||
type="submit"
|
||||
>
|
||||
{{ $t("migrate-n-vms", { n: selectedRefs.length }) }}
|
||||
</UiButton>
|
||||
</template>
|
||||
</FormModalLayout>
|
||||
</UiModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import FormInputWrapper from "@/components/form/FormInputWrapper.vue";
|
||||
import FormSelect from "@/components/form/FormSelect.vue";
|
||||
import MenuItem from "@/components/menu/MenuItem.vue";
|
||||
import FormModalLayout from "@/components/ui/modals/layouts/FormModalLayout.vue";
|
||||
import UiModal from "@/components/ui/modals/UiModal.vue";
|
||||
import UiButton from "@/components/ui/UiButton.vue";
|
||||
import { useContext } from "@/composables/context.composable";
|
||||
import useModal from "@/composables/modal.composable";
|
||||
import { useVmMigration } from "@/composables/vm-migration.composable";
|
||||
import { DisabledContext } from "@/context";
|
||||
import { vTooltip } from "@/directives/tooltip.directive";
|
||||
import type { XenApiVm } from "@/libs/xen-api/xen-api.types";
|
||||
import { faRoute } from "@fortawesome/free-solid-svg-icons";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
const props = defineProps<{
|
||||
selectedRefs: XenApiVm["$ref"][];
|
||||
}>();
|
||||
|
||||
const isParentDisabled = useContext(DisabledContext);
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const {
|
||||
open: openModal,
|
||||
isOpen: isModalOpen,
|
||||
close: closeModal,
|
||||
} = useModal({
|
||||
confirmClose: () => {
|
||||
if (!isMigrating.value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return confirm(t("migration-close-warning"));
|
||||
},
|
||||
onClose: () => (selectedHostRef.value = undefined),
|
||||
});
|
||||
|
||||
const {
|
||||
isReady,
|
||||
selectedHostRef,
|
||||
selectedMigrationNetworkRef,
|
||||
selectedSrRef,
|
||||
availableHosts,
|
||||
availableNetworks,
|
||||
availableSrs,
|
||||
migrate,
|
||||
isMigrating,
|
||||
canExecuteMigration,
|
||||
notMigratableReason,
|
||||
areAllVmsAllowedToMigrate,
|
||||
} = useVmMigration(() => props.selectedRefs);
|
||||
|
||||
const handleMigrate = async () => {
|
||||
await migrate();
|
||||
closeModal();
|
||||
};
|
||||
</script>
|
||||
@@ -95,13 +95,14 @@
|
||||
import MenuItem from "@/components/menu/MenuItem.vue";
|
||||
import PowerStateIcon from "@/components/PowerStateIcon.vue";
|
||||
import UiIcon from "@/components/ui/icon/UiIcon.vue";
|
||||
import { useHostCollection } from "@/stores/xen-api/host.store";
|
||||
import { VM_OPERATION, VM_POWER_STATE } from "@/libs/xen-api/xen-api.enums";
|
||||
import type { XenApiHost, XenApiVm } from "@/libs/xen-api/xen-api.types";
|
||||
import { useXenApiStore } from "@/stores/xen-api.store";
|
||||
import { useHostMetricsCollection } from "@/stores/xen-api/host-metrics.store";
|
||||
import { useHostCollection } from "@/stores/xen-api/host.store";
|
||||
import { usePoolCollection } from "@/stores/xen-api/pool.store";
|
||||
import { useVmCollection } from "@/stores/xen-api/vm.store";
|
||||
import type { XenApiHost, XenApiVm } from "@/libs/xen-api/xen-api.types";
|
||||
import { POWER_STATE, VM_OPERATION } from "@/libs/xen-api/xen-api.utils";
|
||||
import { useXenApiStore } from "@/stores/xen-api.store";
|
||||
import type { MaybeArray } from "@/types";
|
||||
import {
|
||||
faCirclePlay,
|
||||
faMoon,
|
||||
@@ -136,19 +137,19 @@ const vmRefsWithPowerState = computed(() =>
|
||||
const xenApi = useXenApiStore().getXapi();
|
||||
|
||||
const areVmsRunning = computed(() =>
|
||||
vms.value.every((vm) => vm.power_state === POWER_STATE.RUNNING)
|
||||
vms.value.every((vm) => vm.power_state === VM_POWER_STATE.RUNNING)
|
||||
);
|
||||
const areVmsHalted = computed(() =>
|
||||
vms.value.every((vm) => vm.power_state === POWER_STATE.HALTED)
|
||||
vms.value.every((vm) => vm.power_state === VM_POWER_STATE.HALTED)
|
||||
);
|
||||
const areVmsSuspended = computed(() =>
|
||||
vms.value.every((vm) => vm.power_state === POWER_STATE.SUSPENDED)
|
||||
vms.value.every((vm) => vm.power_state === VM_POWER_STATE.SUSPENDED)
|
||||
);
|
||||
const areVmsPaused = computed(() =>
|
||||
vms.value.every((vm) => vm.power_state === POWER_STATE.PAUSED)
|
||||
vms.value.every((vm) => vm.power_state === VM_POWER_STATE.PAUSED)
|
||||
);
|
||||
|
||||
const areOperationsPending = (operation: VM_OPERATION | VM_OPERATION[]) =>
|
||||
const areOperationsPending = (operation: MaybeArray<VM_OPERATION>) =>
|
||||
vms.value.some((vm) => isOperationPending(vm, operation));
|
||||
|
||||
const areVmsBusyToStart = computed(() =>
|
||||
@@ -179,7 +180,7 @@ const areVmsBusyToForceShutdown = computed(() =>
|
||||
areOperationsPending(VM_OPERATION.HARD_SHUTDOWN)
|
||||
);
|
||||
const getHostState = (host: XenApiHost) =>
|
||||
isHostRunning(host) ? POWER_STATE.RUNNING : POWER_STATE.HALTED;
|
||||
isHostRunning(host) ? VM_POWER_STATE.RUNNING : VM_POWER_STATE.HALTED;
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<MenuItem
|
||||
:busy="areSomeVmsSnapshoting"
|
||||
:disabled="isDisabled"
|
||||
:icon="faCamera"
|
||||
@click="handleSnapshot"
|
||||
>
|
||||
{{ $t("snapshot") }}
|
||||
</MenuItem>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import MenuItem from "@/components/menu/MenuItem.vue";
|
||||
import { useVmCollection } from "@/stores/xen-api/vm.store";
|
||||
import { VM_OPERATION } from "@/libs/xen-api/xen-api.enums";
|
||||
import type { XenApiVm } from "@/libs/xen-api/xen-api.types";
|
||||
import { useXenApiStore } from "@/stores/xen-api.store";
|
||||
import { faCamera } from "@fortawesome/free-solid-svg-icons";
|
||||
import { computed } from "vue";
|
||||
|
||||
const props = defineProps<{
|
||||
vmRefs: XenApiVm["$ref"][];
|
||||
}>();
|
||||
|
||||
const { getByOpaqueRef, isOperationPending } = useVmCollection();
|
||||
|
||||
const vms = computed(() =>
|
||||
props.vmRefs
|
||||
.map((vmRef) => getByOpaqueRef(vmRef))
|
||||
.filter((vm): vm is XenApiVm => vm !== undefined)
|
||||
);
|
||||
|
||||
const areSomeVmsSnapshoting = computed(() =>
|
||||
vms.value.some((vm) => isOperationPending(vm, VM_OPERATION.SNAPSHOT))
|
||||
);
|
||||
|
||||
const isDisabled = computed(
|
||||
() => vms.value.length === 0 || areSomeVmsSnapshoting.value
|
||||
);
|
||||
|
||||
const handleSnapshot = () => {
|
||||
const vmRefsToSnapshot = Object.fromEntries(
|
||||
vms.value.map((vm) => [
|
||||
vm.$ref,
|
||||
`${vm.name_label}_${new Date().toISOString()}`,
|
||||
])
|
||||
);
|
||||
return useXenApiStore().getXapi().vm.snapshot(vmRefsToSnapshot);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped></style>
|
||||
@@ -15,16 +15,12 @@
|
||||
<VmActionPowerStateItems :vm-refs="selectedRefs" />
|
||||
</template>
|
||||
</MenuItem>
|
||||
<MenuItem v-tooltip="$t('coming-soon')" :icon="faRoute">
|
||||
{{ $t("migrate") }}
|
||||
</MenuItem>
|
||||
<VmActionMigrateItem :selected-refs="selectedRefs" />
|
||||
<VmActionCopyItem :selected-refs="selectedRefs" />
|
||||
<MenuItem v-tooltip="$t('coming-soon')" :icon="faEdit">
|
||||
{{ $t("edit-config") }}
|
||||
</MenuItem>
|
||||
<MenuItem v-tooltip="$t('coming-soon')" :icon="faCamera">
|
||||
{{ $t("snapshot") }}
|
||||
</MenuItem>
|
||||
<VmActionSnapshotItem :vm-refs="selectedRefs" />
|
||||
<VmActionExportItem :vm-refs="selectedRefs" />
|
||||
<VmActionDeleteItem :vm-refs="selectedRefs" />
|
||||
</AppMenu>
|
||||
@@ -35,18 +31,18 @@ import AppMenu from "@/components/menu/AppMenu.vue";
|
||||
import MenuItem from "@/components/menu/MenuItem.vue";
|
||||
import UiButton from "@/components/ui/UiButton.vue";
|
||||
import VmActionCopyItem from "@/components/vm/VmActionItems/VmActionCopyItem.vue";
|
||||
import VmActionExportItem from "@/components/vm/VmActionItems/VmActionExportItem.vue";
|
||||
import VmActionDeleteItem from "@/components/vm/VmActionItems/VmActionDeleteItem.vue";
|
||||
import VmActionExportItem from "@/components/vm/VmActionItems/VmActionExportItem.vue";
|
||||
import VmActionMigrateItem from "@/components/vm/VmActionItems/VmActionMigrateItem.vue";
|
||||
import VmActionPowerStateItems from "@/components/vm/VmActionItems/VmActionPowerStateItems.vue";
|
||||
import VmActionSnapshotItem from "@/components/vm/VmActionItems/VmActionSnapshotItem.vue";
|
||||
import { vTooltip } from "@/directives/tooltip.directive";
|
||||
import type { XenApiVm } from "@/libs/xen-api/xen-api.types";
|
||||
import { useUiStore } from "@/stores/ui.store";
|
||||
import {
|
||||
faCamera,
|
||||
faEdit,
|
||||
faEllipsis,
|
||||
faPowerOff,
|
||||
faRoute,
|
||||
} from "@fortawesome/free-solid-svg-icons";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
import type { XenApiHost } from "@/libs/xen-api/xen-api.types";
|
||||
import { useHostStore } from "@/stores/xen-api/host.store";
|
||||
import type { XenApiPatch } from "@/types/xen-api";
|
||||
import { type Pausable, useTimeoutPoll, watchArray } from "@vueuse/core";
|
||||
import { computed, type MaybeRefOrGetter, reactive, toValue } from "vue";
|
||||
|
||||
export type XenApiPatchWithHostRefs = XenApiPatch & { $hostRefs: Set<string> };
|
||||
|
||||
type HostConfig = {
|
||||
timeoutPoll: Pausable;
|
||||
patches: XenApiPatch[];
|
||||
isLoaded: boolean;
|
||||
};
|
||||
|
||||
export const useHostPatches = (hosts: MaybeRefOrGetter<XenApiHost[]>) => {
|
||||
const hostStore = useHostStore();
|
||||
|
||||
const configByHost = reactive(new Map<string, HostConfig>());
|
||||
|
||||
const fetchHostPatches = async (hostRef: XenApiHost["$ref"]) => {
|
||||
if (!configByHost.has(hostRef)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const config = configByHost.get(hostRef)!;
|
||||
|
||||
config.patches = await hostStore.fetchMissingPatches(hostRef);
|
||||
config.isLoaded = true;
|
||||
};
|
||||
|
||||
const registerHost = (hostRef: XenApiHost["$ref"]) => {
|
||||
if (configByHost.has(hostRef)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const timeoutPoll = useTimeoutPoll(() => fetchHostPatches(hostRef), 10000, {
|
||||
immediate: true,
|
||||
});
|
||||
|
||||
configByHost.set(hostRef, {
|
||||
timeoutPoll,
|
||||
patches: [],
|
||||
isLoaded: false,
|
||||
});
|
||||
};
|
||||
|
||||
const unregisterHost = (hostRef: string) => {
|
||||
configByHost.get(hostRef)?.timeoutPoll.pause();
|
||||
configByHost.delete(hostRef);
|
||||
};
|
||||
|
||||
watchArray(
|
||||
() => toValue(hosts).map((host) => host.$ref),
|
||||
(_n, _p, addedRefs, removedRefs) => {
|
||||
addedRefs.forEach((ref) => registerHost(ref));
|
||||
removedRefs?.forEach((ref) => unregisterHost(ref));
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
const patches = computed(() => {
|
||||
const records = new Map<string, XenApiPatchWithHostRefs>();
|
||||
|
||||
configByHost.forEach(({ patches }, hostRef) => {
|
||||
patches.forEach((patch) => {
|
||||
const record = records.get(patch.$id);
|
||||
|
||||
if (record !== undefined) {
|
||||
return record.$hostRefs.add(hostRef);
|
||||
}
|
||||
|
||||
records.set(patch.$id, {
|
||||
...patch,
|
||||
$hostRefs: new Set([hostRef]),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return Array.from(records.values());
|
||||
});
|
||||
|
||||
const count = computed(() => patches.value.length);
|
||||
|
||||
const areAllLoaded = computed(() =>
|
||||
Array.from(configByHost.values()).every((config) => config.isLoaded)
|
||||
);
|
||||
|
||||
const areSomeLoaded = computed(
|
||||
() =>
|
||||
areAllLoaded.value ||
|
||||
Array.from(configByHost.values()).some((config) => config.isLoaded)
|
||||
);
|
||||
|
||||
return { patches, count, areAllLoaded, areSomeLoaded };
|
||||
};
|
||||
@@ -1,16 +1,57 @@
|
||||
# useModal composable
|
||||
|
||||
### Usage
|
||||
|
||||
#### API
|
||||
|
||||
`useModal<T>(options: ModalOptions)`
|
||||
|
||||
Type parameter:
|
||||
|
||||
- `T`: The type for the modal's payload.
|
||||
|
||||
Parameters:
|
||||
|
||||
- `options`: An optional object of type `ModalOptions`.
|
||||
|
||||
Returns an object with:
|
||||
|
||||
- `payload: ReadOnly<Ref<T | undefined>>`: The payload data of the modal. Mainly used if a single modal is used for
|
||||
multiple items (typically with `v-for`)
|
||||
- `isOpen: WritableComputedRef<boolean>`: A writable computed indicating if the modal is open or not.
|
||||
- `open(currentPayload?: T)`: A function to open the modal and optionally set its payload.
|
||||
- `close(force = false)`: A function to close the modal. If force is set to `true`, the modal will be closed without
|
||||
calling the `confirmClose` callback.
|
||||
|
||||
#### Types
|
||||
|
||||
`ModalOptions`
|
||||
|
||||
An object type that accepts:
|
||||
|
||||
- `confirmClose?: () => boolean`: An optional callback that is called before the modal is closed. If this function
|
||||
returns `false`, the modal will not be closed.
|
||||
- `onClose?: () => void`: An optional callback that is called after the modal is closed.
|
||||
|
||||
### Example
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<div v-for="item in items">
|
||||
{{ item.name }} <button @click="openRemoveModal(item)">Delete</button>
|
||||
{{ item.name }}
|
||||
<button @click="openRemoveModal(item)">Delete</button>
|
||||
</div>
|
||||
|
||||
<UiModal v-if="isRemoveModalOpen">
|
||||
Are you sure you want to delete {{ removeModalPayload.name }}
|
||||
|
||||
<button @click="handleRemove">Yes</button>
|
||||
<button @click="closeRemoveModal">No</button>
|
||||
<UiModal v-model="isRemoveModalOpen">
|
||||
<ModalContainer>
|
||||
<template #header>
|
||||
Are you sure you want to delete {{ removeModalPayload.name }}?
|
||||
</template>
|
||||
<template #footer>
|
||||
<button @click="handleRemove">Yes</button>
|
||||
<button @click="closeRemoveModal">No</button>
|
||||
</template>
|
||||
</ModalContainer>
|
||||
</UiModal>
|
||||
</template>
|
||||
|
||||
@@ -22,7 +63,11 @@ const {
|
||||
isOpen: isRemoveModalOpen,
|
||||
open: openRemoveModal,
|
||||
close: closeRemoveModal,
|
||||
} = useModal();
|
||||
} = useModal({
|
||||
confirmClose: () =>
|
||||
window.confirm("Are you sure you want to close this modal?"),
|
||||
onClose: () => console.log("Modal closed"),
|
||||
});
|
||||
|
||||
async function handleRemove() {
|
||||
await removeItem(removeModalPayload.id);
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import { ref } from "vue";
|
||||
import { computed, readonly, ref } from "vue";
|
||||
|
||||
export default function useModal<T>() {
|
||||
type ModalOptions = {
|
||||
confirmClose?: () => boolean;
|
||||
onClose?: () => void;
|
||||
};
|
||||
|
||||
export default function useModal<T>(options: ModalOptions = {}) {
|
||||
const $payload = ref<T>();
|
||||
const $isOpen = ref(false);
|
||||
|
||||
@@ -8,15 +13,35 @@ export default function useModal<T>() {
|
||||
$isOpen.value = true;
|
||||
$payload.value = payload;
|
||||
};
|
||||
const close = (force = false) => {
|
||||
if (!force && options.confirmClose?.() === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.onClose) {
|
||||
options.onClose();
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
$isOpen.value = false;
|
||||
$payload.value = undefined;
|
||||
};
|
||||
|
||||
const isOpen = computed({
|
||||
get() {
|
||||
return $isOpen.value;
|
||||
},
|
||||
set(value) {
|
||||
if (value) {
|
||||
open();
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
payload: $payload,
|
||||
isOpen: $isOpen,
|
||||
payload: readonly($payload),
|
||||
isOpen,
|
||||
open,
|
||||
close,
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ export type SubscriberOptions = {
|
||||
export const useSubscriber = ({
|
||||
onSubscriptionStart,
|
||||
onSubscriptionEnd,
|
||||
enabled,
|
||||
enabled = true,
|
||||
dependencies,
|
||||
}: SubscriberOptions = {}) => {
|
||||
const subscribers = ref(new Set<symbol>());
|
||||
|
||||
329
@xen-orchestra/lite/src/composables/vm-migration.composable.ts
Normal file
329
@xen-orchestra/lite/src/composables/vm-migration.composable.ts
Normal file
@@ -0,0 +1,329 @@
|
||||
import { areCollectionsReady, sortRecordsByNameLabel } from "@/libs/utils";
|
||||
import { VBD_TYPE, VM_OPERATION } from "@/libs/xen-api/xen-api.enums";
|
||||
import type {
|
||||
XenApiHost,
|
||||
XenApiNetwork,
|
||||
XenApiSr,
|
||||
XenApiVdi,
|
||||
XenApiVm,
|
||||
} from "@/libs/xen-api/xen-api.types";
|
||||
import { useXenApiStore } from "@/stores/xen-api.store";
|
||||
import { useHostCollection } from "@/stores/xen-api/host.store";
|
||||
import { useNetworkCollection } from "@/stores/xen-api/network.store";
|
||||
import { usePbdCollection } from "@/stores/xen-api/pbd.store";
|
||||
import { usePifCollection } from "@/stores/xen-api/pif.store";
|
||||
import { usePoolCollection } from "@/stores/xen-api/pool.store";
|
||||
import { useSrCollection } from "@/stores/xen-api/sr.store";
|
||||
import { useVbdCollection } from "@/stores/xen-api/vbd.store";
|
||||
import { useVdiCollection } from "@/stores/xen-api/vdi.store";
|
||||
import { useVmCollection } from "@/stores/xen-api/vm.store";
|
||||
import type { MaybeArray } from "@/types";
|
||||
import type { VmMigrationData } from "@/types/xen-api";
|
||||
import { useMemoize } from "@vueuse/core";
|
||||
import { castArray } from "lodash-es";
|
||||
import type { MaybeRefOrGetter } from "vue";
|
||||
import { computed, ref, toValue, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
export const useVmMigration = (
|
||||
vmRefsToMigrate: MaybeRefOrGetter<MaybeArray<XenApiVm["$ref"]>>
|
||||
) => {
|
||||
const xapi = useXenApiStore().getXapi();
|
||||
|
||||
const poolCollection = usePoolCollection();
|
||||
const hostCollection = useHostCollection();
|
||||
const vmCollection = useVmCollection();
|
||||
const vbdCollection = useVbdCollection();
|
||||
const vdiCollection = useVdiCollection();
|
||||
const srCollection = useSrCollection();
|
||||
const networkCollection = useNetworkCollection();
|
||||
const pbdCollection = usePbdCollection();
|
||||
const pifCollection = usePifCollection();
|
||||
|
||||
const isReady = areCollectionsReady(
|
||||
poolCollection,
|
||||
hostCollection,
|
||||
vmCollection,
|
||||
vbdCollection,
|
||||
vdiCollection,
|
||||
srCollection,
|
||||
networkCollection,
|
||||
pbdCollection,
|
||||
pifCollection
|
||||
);
|
||||
|
||||
const { pool } = poolCollection;
|
||||
const { getByOpaqueRef: getHost, records: hosts } = hostCollection;
|
||||
const {
|
||||
getByOpaqueRefs: getVms,
|
||||
isOperationPending,
|
||||
isOperationAllowed,
|
||||
} = vmCollection;
|
||||
const { getByOpaqueRefs: getVbds } = vbdCollection;
|
||||
const { getByOpaqueRef: getVdi } = vdiCollection;
|
||||
const { getByOpaqueRef: getSr } = srCollection;
|
||||
const {
|
||||
getByOpaqueRef: getNetwork,
|
||||
getByOpaqueRefs: getNetworks,
|
||||
getByUuid: getNetworkByUuid,
|
||||
} = networkCollection;
|
||||
const { getByOpaqueRefs: getPbds } = pbdCollection;
|
||||
const { getByOpaqueRefs: getPifs } = pifCollection;
|
||||
|
||||
const selectedHostRef = ref<XenApiHost["$ref"]>();
|
||||
const selectedHost = computed(() => getHost(selectedHostRef.value));
|
||||
const selectedMigrationNetworkRef = ref<XenApiNetwork["$ref"]>();
|
||||
const selectedMigrationNetwork = computed(() =>
|
||||
getNetwork(selectedMigrationNetworkRef.value)
|
||||
);
|
||||
const selectedSrRef = ref<XenApiSr["$ref"]>();
|
||||
const selectedSr = computed(() => getSr(selectedSrRef.value));
|
||||
const isSimpleMigration = computed(
|
||||
() => selectedMigrationNetworkRef.value === undefined
|
||||
);
|
||||
|
||||
const availableHosts = computed(() =>
|
||||
hosts.value
|
||||
.filter((host) =>
|
||||
vmsToMigrate.value.some((vm) => vm.resident_on !== host.$ref)
|
||||
)
|
||||
.sort(sortRecordsByNameLabel)
|
||||
);
|
||||
|
||||
const getPifsForSelectedHost = () =>
|
||||
getPifs(selectedHost.value!.PIFs).filter((pif) => pif.IP);
|
||||
|
||||
const availableNetworks = computed(() => {
|
||||
if (!selectedHost.value) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return getNetworks(getPifsForSelectedHost().map((pif) => pif.network));
|
||||
});
|
||||
|
||||
const availableSrs = computed(() => {
|
||||
if (!selectedHost.value) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const srs = new Set<XenApiSr>();
|
||||
|
||||
getPbds(selectedHost.value!.PBDs).forEach((pbd) => {
|
||||
const sr = getSr(pbd.SR);
|
||||
if (
|
||||
sr !== undefined &&
|
||||
sr.content_type !== "iso" &&
|
||||
sr.physical_size > 0
|
||||
) {
|
||||
srs.add(sr);
|
||||
}
|
||||
});
|
||||
|
||||
return Array.from(srs);
|
||||
});
|
||||
|
||||
const $isMigrating = ref(false);
|
||||
|
||||
const vmsToMigrate = computed(() =>
|
||||
getVms(castArray(toValue(vmRefsToMigrate)))
|
||||
);
|
||||
|
||||
const getVmVbds = (vm: XenApiVm) =>
|
||||
getVms(vm.snapshots).reduce(
|
||||
(acc, vm) => acc.concat(getVbds(vm.VBDs)),
|
||||
getVbds(vm.VBDs)
|
||||
);
|
||||
|
||||
const getVmVdis = (
|
||||
vmToMigrate: XenApiVm,
|
||||
destinationHost: XenApiHost,
|
||||
forcedSr?: XenApiSr
|
||||
) =>
|
||||
getVmVbds(vmToMigrate).reduce(
|
||||
(acc, vbd) => {
|
||||
if (vbd.type !== VBD_TYPE.DISK) {
|
||||
return acc;
|
||||
}
|
||||
|
||||
const vdi = getVdi(vbd.VDI);
|
||||
|
||||
if (vdi === undefined || vdi.snapshot_of !== "OpaqueRef:NULL") {
|
||||
return acc;
|
||||
}
|
||||
|
||||
acc[vdi.$ref] = isSrConnected(vdi.SR, destinationHost)
|
||||
? vdi.SR
|
||||
: forcedSr !== undefined
|
||||
? forcedSr.$ref
|
||||
: getDefaultSr().$ref;
|
||||
|
||||
return acc;
|
||||
},
|
||||
{} as Record<XenApiVdi["$ref"], XenApiSr["$ref"]>
|
||||
);
|
||||
|
||||
const isSrConnected = useMemoize(
|
||||
(srRef: XenApiSr["$ref"], destinationHost: XenApiHost) =>
|
||||
getSr(srRef)?.PBDs.some((pbdRef) =>
|
||||
destinationHost.PBDs.includes(pbdRef)
|
||||
) ?? false
|
||||
);
|
||||
|
||||
const getDefaultMigrationNetwork = () => {
|
||||
if (selectedHost.value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const migrationNetworkUuid = pool.value!.other_config[
|
||||
"xo:migrationNetwork"
|
||||
] as XenApiNetwork["uuid"];
|
||||
|
||||
const migrationNetwork = getNetworkByUuid(migrationNetworkUuid);
|
||||
|
||||
if (migrationNetwork === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (
|
||||
getPifsForSelectedHost().some(
|
||||
(pif) => pif.network === migrationNetwork.$ref
|
||||
)
|
||||
) {
|
||||
return migrationNetwork;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const getDefaultSr = () => {
|
||||
const defaultSr = getSr(pool.value?.default_SR);
|
||||
|
||||
if (defaultSr === undefined) {
|
||||
throw new Error(
|
||||
`This operation requires a default SR to be set on the pool ${
|
||||
pool.value!.name_label
|
||||
}`
|
||||
);
|
||||
}
|
||||
|
||||
return defaultSr;
|
||||
};
|
||||
|
||||
watch(selectedHost, (host) => {
|
||||
if (host === undefined) {
|
||||
selectedMigrationNetworkRef.value = undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
selectedMigrationNetworkRef.value = getDefaultMigrationNetwork()?.$ref;
|
||||
});
|
||||
|
||||
watch(selectedMigrationNetworkRef, (networkRef) => {
|
||||
if (networkRef === undefined) {
|
||||
selectedSrRef.value = undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
selectedSrRef.value = getDefaultSr().$ref;
|
||||
});
|
||||
|
||||
const isMigrating = computed(
|
||||
() =>
|
||||
$isMigrating.value ||
|
||||
isOperationPending(vmsToMigrate.value, [
|
||||
VM_OPERATION.MIGRATE_SEND,
|
||||
VM_OPERATION.POOL_MIGRATE,
|
||||
])
|
||||
);
|
||||
|
||||
const areAllVmsAllowedToMigrate = computed(() =>
|
||||
isOperationAllowed(
|
||||
vmsToMigrate.value,
|
||||
isSimpleMigration.value
|
||||
? VM_OPERATION.POOL_MIGRATE
|
||||
: VM_OPERATION.MIGRATE_SEND
|
||||
)
|
||||
);
|
||||
|
||||
const { t } = useI18n();
|
||||
const notMigratableReason = computed(() => {
|
||||
if (isMigrating.value) {
|
||||
return t("vms-migration-error.already-being-migrated");
|
||||
}
|
||||
|
||||
if (!areAllVmsAllowedToMigrate.value) {
|
||||
return t("vms-migration-error.not-allowed");
|
||||
}
|
||||
|
||||
if (selectedHost.value === undefined) {
|
||||
return t("vms-migration-error.no-destination-host");
|
||||
}
|
||||
|
||||
if (isSimpleMigration.value) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (selectedMigrationNetwork.value === undefined) {
|
||||
return t("vms-migration-error.no-migration-network");
|
||||
}
|
||||
|
||||
if (selectedSr.value === undefined) {
|
||||
return t("vms-migration-error.no-destination-sr");
|
||||
}
|
||||
|
||||
return undefined;
|
||||
});
|
||||
|
||||
const canExecuteMigration = computed(
|
||||
() => notMigratableReason.value === undefined
|
||||
);
|
||||
|
||||
const migrateSimple = () =>
|
||||
xapi.vm.migrate(
|
||||
vmsToMigrate.value.map((vm) => vm.$ref),
|
||||
selectedHostRef.value!
|
||||
);
|
||||
|
||||
const migrateComplex = () => {
|
||||
const vmsMigrationMap: Record<XenApiVm["$ref"], VmMigrationData> = {};
|
||||
|
||||
vmsToMigrate.value.forEach((vm) => {
|
||||
vmsMigrationMap[vm.$ref] = {
|
||||
destinationHost: selectedHostRef.value!,
|
||||
destinationSr: selectedSrRef.value!,
|
||||
migrationNetwork: selectedMigrationNetworkRef.value!,
|
||||
vdisMap: getVmVdis(vm, selectedHost.value!, selectedSr.value!),
|
||||
};
|
||||
});
|
||||
|
||||
return xapi.vm.migrateComplex(vmsMigrationMap);
|
||||
};
|
||||
|
||||
const migrate = async () => {
|
||||
if (!canExecuteMigration.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$isMigrating.value = true;
|
||||
isSimpleMigration.value ? await migrateSimple() : await migrateComplex();
|
||||
} finally {
|
||||
$isMigrating.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
isReady,
|
||||
isMigrating,
|
||||
areAllVmsAllowedToMigrate,
|
||||
canExecuteMigration,
|
||||
notMigratableReason,
|
||||
availableHosts,
|
||||
availableNetworks,
|
||||
availableSrs,
|
||||
selectedHostRef,
|
||||
selectedMigrationNetworkRef,
|
||||
selectedSrRef,
|
||||
migrate,
|
||||
};
|
||||
};
|
||||
@@ -14,10 +14,20 @@ export const useXenApiStoreBaseContext = <
|
||||
const lastError = ref<string>();
|
||||
const hasError = computed(() => lastError.value !== undefined);
|
||||
|
||||
const getByOpaqueRef = (opaqueRef: XRecord["$ref"]) => {
|
||||
const getByOpaqueRef = (opaqueRef: XRecord["$ref"] | undefined) => {
|
||||
if (opaqueRef === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return recordsByOpaqueRef.get(opaqueRef);
|
||||
};
|
||||
|
||||
const getByOpaqueRefs = (opaqueRefs: XRecord["$ref"][]) => {
|
||||
return opaqueRefs
|
||||
.map((opaqueRef) => recordsByOpaqueRef.get(opaqueRef))
|
||||
.filter((record) => record !== undefined) as XRecord[];
|
||||
};
|
||||
|
||||
const getByUuid = (uuid: XRecord["uuid"]) => {
|
||||
return recordsByUuid.get(uuid);
|
||||
};
|
||||
@@ -49,6 +59,7 @@ export const useXenApiStoreBaseContext = <
|
||||
lastError,
|
||||
records,
|
||||
getByOpaqueRef,
|
||||
getByOpaqueRefs,
|
||||
getByUuid,
|
||||
hasUuid,
|
||||
add,
|
||||
|
||||
@@ -12,12 +12,12 @@ export type MixinAbstractConstructor<T = unknown> = abstract new (
|
||||
|
||||
export type MixinFunction<
|
||||
T extends MixinConstructor | MixinAbstractConstructor = MixinConstructor,
|
||||
R extends T = T & MixinConstructor
|
||||
R extends T = T & MixinConstructor,
|
||||
> = (Base: T) => R;
|
||||
|
||||
export type MixinReturnValue<
|
||||
T extends MixinConstructor | MixinAbstractConstructor,
|
||||
M extends MixinFunction<T, any>[]
|
||||
M extends MixinFunction<T, any>[],
|
||||
> = UnionToIntersection<
|
||||
| T
|
||||
| {
|
||||
@@ -27,7 +27,7 @@ export type MixinReturnValue<
|
||||
|
||||
export default function mixin<
|
||||
T extends MixinConstructor | MixinAbstractConstructor,
|
||||
M extends MixinFunction<T, any>[]
|
||||
M extends MixinFunction<T, any>[],
|
||||
>(Base: T, ...mixins: M): MixinReturnValue<T, M> {
|
||||
return mixins.reduce(
|
||||
(mix, applyMixin) => applyMixin(mix),
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import type { MaybeArray } from "@/types";
|
||||
import type { Filter } from "@/types/filter";
|
||||
import { faSquareCheck } from "@fortawesome/free-regular-svg-icons";
|
||||
import { faFont, faHashtag, faList } from "@fortawesome/free-solid-svg-icons";
|
||||
import { utcParse } from "d3-time-format";
|
||||
import humanFormat from "human-format";
|
||||
import { find, forEach, round, size, sum } from "lodash-es";
|
||||
import { computed, type Ref } from "vue";
|
||||
|
||||
export function sortRecordsByNameLabel(
|
||||
record1: { name_label: string },
|
||||
@@ -140,5 +142,9 @@ export function parseRamUsage(
|
||||
};
|
||||
}
|
||||
|
||||
export const getFirst = <T>(value: T | T[]): T | undefined =>
|
||||
export const getFirst = <T>(value: MaybeArray<T>): T | undefined =>
|
||||
Array.isArray(value) ? value[0] : value;
|
||||
|
||||
export const areCollectionsReady = (
|
||||
...collections: { isReady: Ref<boolean> }[]
|
||||
) => computed(() => collections.every(({ isReady }) => isReady.value));
|
||||
|
||||
493
@xen-orchestra/lite/src/libs/xen-api/xen-api.enums.ts
Normal file
493
@xen-orchestra/lite/src/libs/xen-api/xen-api.enums.ts
Normal file
@@ -0,0 +1,493 @@
|
||||
export enum TASK_ALLOWED_OPERATION {
|
||||
CANCEL = "cancel",
|
||||
DESTROY = "destroy",
|
||||
}
|
||||
|
||||
export enum TASK_STATUS_TYPE {
|
||||
CANCELLED = "cancelled",
|
||||
CANCELLING = "cancelling",
|
||||
FAILURE = "failure",
|
||||
PENDING = "pending",
|
||||
SUCCESS = "success",
|
||||
}
|
||||
|
||||
export enum EVENT_OPERATION {
|
||||
ADD = "add",
|
||||
DEL = "del",
|
||||
MOD = "mod",
|
||||
}
|
||||
|
||||
export enum POOL_ALLOWED_OPERATION {
|
||||
APPLY_UPDATES = "apply_updates",
|
||||
CERT_REFRESH = "cert_refresh",
|
||||
CLUSTER_CREATE = "cluster_create",
|
||||
CONFIGURE_REPOSITORIES = "configure_repositories",
|
||||
COPY_PRIMARY_HOST_CERTS = "copy_primary_host_certs",
|
||||
DESIGNATE_NEW_MASTER = "designate_new_master",
|
||||
EXCHANGE_CA_CERTIFICATES_ON_JOIN = "exchange_ca_certificates_on_join",
|
||||
EXCHANGE_CERTIFICATES_ON_JOIN = "exchange_certificates_on_join",
|
||||
GET_UPDATES = "get_updates",
|
||||
HA_DISABLE = "ha_disable",
|
||||
HA_ENABLE = "ha_enable",
|
||||
SYNC_UPDATES = "sync_updates",
|
||||
TLS_VERIFICATION_ENABLE = "tls_verification_enable",
|
||||
}
|
||||
|
||||
export enum TELEMETRY_FREQUENCY {
|
||||
DAILY = "daily",
|
||||
MONTHLY = "monthly",
|
||||
WEEKLY = "weekly",
|
||||
}
|
||||
|
||||
export enum UPDATE_SYNC_FREQUENCY {
|
||||
DAILY = "daily",
|
||||
WEEKLY = "weekly",
|
||||
}
|
||||
|
||||
export enum AFTER_APPLY_GUIDANCE {
|
||||
RESTART_HOST = "restartHost",
|
||||
RESTART_HVM = "restartHVM",
|
||||
RESTART_PV = "restartPV",
|
||||
RESTART_XAPI = "restartXAPI",
|
||||
}
|
||||
|
||||
export enum UPDATE_AFTER_APPLY_GUIDANCE {
|
||||
RESTART_HOST = "restartHost",
|
||||
RESTART_HVM = "restartHVM",
|
||||
RESTART_PV = "restartPV",
|
||||
RESTART_XAPI = "restartXAPI",
|
||||
}
|
||||
|
||||
export enum LIVEPATCH_STATUS {
|
||||
OK = "ok",
|
||||
OK_LIVEPATCH_COMPLETE = "ok_livepatch_complete",
|
||||
OK_LIVEPATCH_INCOMPLETE = "ok_livepatch_incomplete",
|
||||
}
|
||||
|
||||
export enum VM_POWER_STATE {
|
||||
HALTED = "Halted",
|
||||
PAUSED = "Paused",
|
||||
RUNNING = "Running",
|
||||
SUSPENDED = "Suspended",
|
||||
}
|
||||
|
||||
export enum UPDATE_GUIDANCE {
|
||||
REBOOT_HOST = "reboot_host",
|
||||
REBOOT_HOST_ON_LIVEPATCH_FAILURE = "reboot_host_on_livepatch_failure",
|
||||
RESTART_DEVICE_MODEL = "restart_device_model",
|
||||
RESTART_TOOLSTACK = "restart_toolstack",
|
||||
}
|
||||
|
||||
export enum ON_SOFTREBOOT_BEHAVIOR {
|
||||
DESTROY = "destroy",
|
||||
PRESERVE = "preserve",
|
||||
RESTART = "restart",
|
||||
SOFT_REBOOT = "soft_reboot",
|
||||
}
|
||||
|
||||
export enum ON_NORMAL_EXIT {
|
||||
DESTROY = "destroy",
|
||||
RESTART = "restart",
|
||||
}
|
||||
|
||||
export enum VM_OPERATION {
|
||||
ASSERT_OPERATION_VALID = "assert_operation_valid",
|
||||
AWAITING_MEMORY_LIVE = "awaiting_memory_live",
|
||||
CALL_PLUGIN = "call_plugin",
|
||||
CHANGING_DYNAMIC_RANGE = "changing_dynamic_range",
|
||||
CHANGING_MEMORY_LIMITS = "changing_memory_limits",
|
||||
CHANGING_MEMORY_LIVE = "changing_memory_live",
|
||||
CHANGING_NVRAM = "changing_NVRAM",
|
||||
CHANGING_SHADOW_MEMORY = "changing_shadow_memory",
|
||||
CHANGING_SHADOW_MEMORY_LIVE = "changing_shadow_memory_live",
|
||||
CHANGING_STATIC_RANGE = "changing_static_range",
|
||||
CHANGING_VCPUS = "changing_VCPUs",
|
||||
CHANGING_VCPUS_LIVE = "changing_VCPUs_live",
|
||||
CHECKPOINT = "checkpoint",
|
||||
CLEAN_REBOOT = "clean_reboot",
|
||||
CLEAN_SHUTDOWN = "clean_shutdown",
|
||||
CLONE = "clone",
|
||||
COPY = "copy",
|
||||
CREATE_TEMPLATE = "create_template",
|
||||
CREATE_VTPM = "create_vtpm",
|
||||
CSVM = "csvm",
|
||||
DATA_SOURCE_OP = "data_source_op",
|
||||
DESTROY = "destroy",
|
||||
EXPORT = "export",
|
||||
GET_BOOT_RECORD = "get_boot_record",
|
||||
HARD_REBOOT = "hard_reboot",
|
||||
HARD_SHUTDOWN = "hard_shutdown",
|
||||
IMPORT = "import",
|
||||
MAKE_INTO_TEMPLATE = "make_into_template",
|
||||
METADATA_EXPORT = "metadata_export",
|
||||
MIGRATE_SEND = "migrate_send",
|
||||
PAUSE = "pause",
|
||||
POOL_MIGRATE = "pool_migrate",
|
||||
POWER_STATE_RESET = "power_state_reset",
|
||||
PROVISION = "provision",
|
||||
QUERY_SERVICES = "query_services",
|
||||
RESUME = "resume",
|
||||
RESUME_ON = "resume_on",
|
||||
REVERT = "revert",
|
||||
REVERTING = "reverting",
|
||||
SEND_SYSRQ = "send_sysrq",
|
||||
SEND_TRIGGER = "send_trigger",
|
||||
SHUTDOWN = "shutdown",
|
||||
SNAPSHOT = "snapshot",
|
||||
SNAPSHOT_WITH_QUIESCE = "snapshot_with_quiesce",
|
||||
START = "start",
|
||||
START_ON = "start_on",
|
||||
SUSPEND = "suspend",
|
||||
UNPAUSE = "unpause",
|
||||
UPDATE_ALLOWED_OPERATIONS = "update_allowed_operations",
|
||||
}
|
||||
|
||||
export enum ON_CRASH_BEHAVIOUR {
|
||||
COREDUMP_AND_DESTROY = "coredump_and_destroy",
|
||||
COREDUMP_AND_RESTART = "coredump_and_restart",
|
||||
DESTROY = "destroy",
|
||||
PRESERVE = "preserve",
|
||||
RENAME_RESTART = "rename_restart",
|
||||
RESTART = "restart",
|
||||
}
|
||||
|
||||
export enum DOMAIN_TYPE {
|
||||
HVM = "hvm",
|
||||
PV = "pv",
|
||||
PVH = "pvh",
|
||||
PV_IN_PVH = "pv_in_pvh",
|
||||
UNSPECIFIED = "unspecified",
|
||||
}
|
||||
|
||||
export enum TRISTATE_TYPE {
|
||||
NO = "no",
|
||||
UNSPECIFIED = "unspecified",
|
||||
YES = "yes",
|
||||
}
|
||||
|
||||
export enum VMPP_BACKUP_TYPE {
|
||||
CHECKPOINT = "checkpoint",
|
||||
SNAPSHOT = "snapshot",
|
||||
}
|
||||
|
||||
export enum VMPP_BACKUP_FREQUENCY {
|
||||
DAILY = "daily",
|
||||
HOURLY = "hourly",
|
||||
WEEKLY = "weekly",
|
||||
}
|
||||
|
||||
export enum VMPP_ARCHIVE_FREQUENCY {
|
||||
ALWAYS_AFTER_BACKUP = "always_after_backup",
|
||||
DAILY = "daily",
|
||||
NEVER = "never",
|
||||
WEEKLY = "weekly",
|
||||
}
|
||||
|
||||
export enum VMPP_ARCHIVE_TARGET_TYPE {
|
||||
CIFS = "cifs",
|
||||
NFS = "nfs",
|
||||
NONE = "none",
|
||||
}
|
||||
|
||||
export enum VMSS_FREQUENCY {
|
||||
DAILY = "daily",
|
||||
HOURLY = "hourly",
|
||||
WEEKLY = "weekly",
|
||||
}
|
||||
|
||||
export enum VMSS_TYPE {
|
||||
CHECKPOINT = "checkpoint",
|
||||
SNAPSHOT = "snapshot",
|
||||
SNAPSHOT_WITH_QUIESCE = "snapshot_with_quiesce",
|
||||
}
|
||||
|
||||
export enum VM_APPLIANCE_OPERATION {
|
||||
CLEAN_SHUTDOWN = "clean_shutdown",
|
||||
HARD_SHUTDOWN = "hard_shutdown",
|
||||
SHUTDOWN = "shutdown",
|
||||
START = "start",
|
||||
}
|
||||
|
||||
export enum HOST_ALLOWED_OPERATION {
|
||||
APPLY_UPDATES = "apply_updates",
|
||||
EVACUATE = "evacuate",
|
||||
POWER_ON = "power_on",
|
||||
PROVISION = "provision",
|
||||
REBOOT = "reboot",
|
||||
SHUTDOWN = "shutdown",
|
||||
VM_MIGRATE = "vm_migrate",
|
||||
VM_RESUME = "vm_resume",
|
||||
VM_START = "vm_start",
|
||||
}
|
||||
|
||||
export enum LATEST_SYNCED_UPDATES_APPLIED_STATE {
|
||||
NO = "no",
|
||||
UNKNOWN = "unknown",
|
||||
YES = "yes",
|
||||
}
|
||||
|
||||
export enum HOST_DISPLAY {
|
||||
DISABLED = "disabled",
|
||||
DISABLE_ON_REBOOT = "disable_on_reboot",
|
||||
ENABLED = "enabled",
|
||||
ENABLE_ON_REBOOT = "enable_on_reboot",
|
||||
}
|
||||
|
||||
export enum HOST_SCHED_GRAN {
|
||||
CORE = "core",
|
||||
CPU = "cpu",
|
||||
SOCKET = "socket",
|
||||
}
|
||||
|
||||
export enum NETWORK_OPERATION {
|
||||
ATTACHING = "attaching",
|
||||
}
|
||||
|
||||
export enum NETWORK_DEFAULT_LOCKING_MODE {
|
||||
DISABLED = "disabled",
|
||||
UNLOCKED = "unlocked",
|
||||
}
|
||||
|
||||
export enum NETWORK_PURPOSE {
|
||||
INSECURE_NBD = "insecure_nbd",
|
||||
NBD = "nbd",
|
||||
}
|
||||
|
||||
export enum VIF_OPERATION {
|
||||
ATTACH = "attach",
|
||||
PLUG = "plug",
|
||||
UNPLUG = "unplug",
|
||||
}
|
||||
|
||||
export enum VIF_LOCKING_MODE {
|
||||
DISABLED = "disabled",
|
||||
LOCKED = "locked",
|
||||
NETWORK_DEFAULT = "network_default",
|
||||
UNLOCKED = "unlocked",
|
||||
}
|
||||
|
||||
export enum VIF_IPV4_CONFIGURATION_MODE {
|
||||
NONE = "None",
|
||||
STATIC = "Static",
|
||||
}
|
||||
|
||||
export enum VIF_IPV6_CONFIGURATION_MODE {
|
||||
NONE = "None",
|
||||
STATIC = "Static",
|
||||
}
|
||||
|
||||
export enum PIF_IGMP_STATUS {
|
||||
DISABLED = "disabled",
|
||||
ENABLED = "enabled",
|
||||
UNKNOWN = "unknown",
|
||||
}
|
||||
|
||||
export enum IP_CONFIGURATION_MODE {
|
||||
DHCP = "DHCP",
|
||||
NONE = "None",
|
||||
STATIC = "Static",
|
||||
}
|
||||
|
||||
export enum IPV6_CONFIGURATION_MODE {
|
||||
AUTOCONF = "Autoconf",
|
||||
DHCP = "DHCP",
|
||||
NONE = "None",
|
||||
STATIC = "Static",
|
||||
}
|
||||
|
||||
export enum PRIMARY_ADDRESS_TYPE {
|
||||
IPV4 = "IPv4",
|
||||
IPV6 = "IPv6",
|
||||
}
|
||||
|
||||
export enum BOND_MODE {
|
||||
ACTIVE_BACKUP = "active-backup",
|
||||
BALANCE_SLB = "balance-slb",
|
||||
LACP = "lacp",
|
||||
}
|
||||
|
||||
export enum STORAGE_OPERATION {
|
||||
DESTROY = "destroy",
|
||||
FORGET = "forget",
|
||||
PBD_CREATE = "pbd_create",
|
||||
PBD_DESTROY = "pbd_destroy",
|
||||
PLUG = "plug",
|
||||
SCAN = "scan",
|
||||
UNPLUG = "unplug",
|
||||
UPDATE = "update",
|
||||
VDI_CLONE = "vdi_clone",
|
||||
VDI_CREATE = "vdi_create",
|
||||
VDI_DATA_DESTROY = "vdi_data_destroy",
|
||||
VDI_DESTROY = "vdi_destroy",
|
||||
VDI_DISABLE_CBT = "vdi_disable_cbt",
|
||||
VDI_ENABLE_CBT = "vdi_enable_cbt",
|
||||
VDI_INTRODUCE = "vdi_introduce",
|
||||
VDI_LIST_CHANGED_BLOCKS = "vdi_list_changed_blocks",
|
||||
VDI_MIRROR = "vdi_mirror",
|
||||
VDI_RESIZE = "vdi_resize",
|
||||
VDI_SET_ON_BOOT = "vdi_set_on_boot",
|
||||
VDI_SNAPSHOT = "vdi_snapshot",
|
||||
}
|
||||
|
||||
export enum SR_HEALTH {
|
||||
HEALTHY = "healthy",
|
||||
RECOVERING = "recovering",
|
||||
}
|
||||
|
||||
export enum VDI_OPERATION {
|
||||
BLOCKED = "blocked",
|
||||
CLONE = "clone",
|
||||
COPY = "copy",
|
||||
DATA_DESTROY = "data_destroy",
|
||||
DESTROY = "destroy",
|
||||
DISABLE_CBT = "disable_cbt",
|
||||
ENABLE_CBT = "enable_cbt",
|
||||
FORCE_UNLOCK = "force_unlock",
|
||||
FORGET = "forget",
|
||||
GENERATE_CONFIG = "generate_config",
|
||||
LIST_CHANGED_BLOCKS = "list_changed_blocks",
|
||||
MIRROR = "mirror",
|
||||
RESIZE = "resize",
|
||||
RESIZE_ONLINE = "resize_online",
|
||||
SET_ON_BOOT = "set_on_boot",
|
||||
SNAPSHOT = "snapshot",
|
||||
UPDATE = "update",
|
||||
}
|
||||
|
||||
export enum VDI_TYPE {
|
||||
CBT_METADATA = "cbt_metadata",
|
||||
CRASHDUMP = "crashdump",
|
||||
EPHEMERAL = "ephemeral",
|
||||
HA_STATEFILE = "ha_statefile",
|
||||
METADATA = "metadata",
|
||||
PVS_CACHE = "pvs_cache",
|
||||
REDO_LOG = "redo_log",
|
||||
RRD = "rrd",
|
||||
SUSPEND = "suspend",
|
||||
SYSTEM = "system",
|
||||
USER = "user",
|
||||
}
|
||||
|
||||
export enum ON_BOOT {
|
||||
PERSIST = "persist",
|
||||
RESET = "reset",
|
||||
}
|
||||
|
||||
export enum VBD_OPERATION {
|
||||
ATTACH = "attach",
|
||||
EJECT = "eject",
|
||||
INSERT = "insert",
|
||||
PAUSE = "pause",
|
||||
PLUG = "plug",
|
||||
UNPAUSE = "unpause",
|
||||
UNPLUG = "unplug",
|
||||
UNPLUG_FORCE = "unplug_force",
|
||||
}
|
||||
|
||||
export enum VBD_TYPE {
|
||||
CD = "CD",
|
||||
DISK = "Disk",
|
||||
FLOPPY = "Floppy",
|
||||
}
|
||||
|
||||
export enum VBD_MODE {
|
||||
RO = "RO",
|
||||
RW = "RW",
|
||||
}
|
||||
|
||||
export enum VTPM_OPERATION {
|
||||
DESTROY = "destroy",
|
||||
}
|
||||
|
||||
export enum PERSISTENCE_BACKEND {
|
||||
XAPI = "xapi",
|
||||
}
|
||||
|
||||
export enum CONSOLE_PROTOCOL {
|
||||
RDP = "rdp",
|
||||
RFB = "rfb",
|
||||
VT100 = "vt100",
|
||||
}
|
||||
|
||||
export enum CLS {
|
||||
CERTIFICATE = "Certificate",
|
||||
HOST = "Host",
|
||||
POOL = "Pool",
|
||||
PVS_PROXY = "PVS_proxy",
|
||||
SR = "SR",
|
||||
VDI = "VDI",
|
||||
VM = "VM",
|
||||
VMPP = "VMPP",
|
||||
VMSS = "VMSS",
|
||||
}
|
||||
|
||||
export enum TUNNEL_PROTOCOL {
|
||||
GRE = "gre",
|
||||
VXLAN = "vxlan",
|
||||
}
|
||||
|
||||
export enum SRIOV_CONFIGURATION_MODE {
|
||||
MANUAL = "manual",
|
||||
MODPROBE = "modprobe",
|
||||
SYSFS = "sysfs",
|
||||
UNKNOWN = "unknown",
|
||||
}
|
||||
|
||||
export enum PGPU_DOM0_ACCESS {
|
||||
DISABLED = "disabled",
|
||||
DISABLE_ON_REBOOT = "disable_on_reboot",
|
||||
ENABLED = "enabled",
|
||||
ENABLE_ON_REBOOT = "enable_on_reboot",
|
||||
}
|
||||
|
||||
export enum ALLOCATION_ALGORITHM {
|
||||
BREADTH_FIRST = "breadth_first",
|
||||
DEPTH_FIRST = "depth_first",
|
||||
}
|
||||
|
||||
export enum VGPU_TYPE_IMPLEMENTATION {
|
||||
GVT_G = "gvt_g",
|
||||
MXGPU = "mxgpu",
|
||||
NVIDIA = "nvidia",
|
||||
NVIDIA_SRIOV = "nvidia_sriov",
|
||||
PASSTHROUGH = "passthrough",
|
||||
}
|
||||
|
||||
export enum PVS_PROXY_STATUS {
|
||||
CACHING = "caching",
|
||||
INCOMPATIBLE_PROTOCOL_VERSION = "incompatible_protocol_version",
|
||||
INCOMPATIBLE_WRITE_CACHE_MODE = "incompatible_write_cache_mode",
|
||||
INITIALISED = "initialised",
|
||||
STOPPED = "stopped",
|
||||
}
|
||||
|
||||
export enum SDN_CONTROLLER_PROTOCOL {
|
||||
PSSL = "pssl",
|
||||
SSL = "ssl",
|
||||
}
|
||||
|
||||
export enum VUSB_OPERATION {
|
||||
ATTACH = "attach",
|
||||
PLUG = "plug",
|
||||
UNPLUG = "unplug",
|
||||
}
|
||||
|
||||
export enum CLUSTER_OPERATION {
|
||||
ADD = "add",
|
||||
DESTROY = "destroy",
|
||||
DISABLE = "disable",
|
||||
ENABLE = "enable",
|
||||
REMOVE = "remove",
|
||||
}
|
||||
|
||||
export enum CLUSTER_HOST_OPERATION {
|
||||
DESTROY = "destroy",
|
||||
DISABLE = "disable",
|
||||
ENABLE = "enable",
|
||||
}
|
||||
|
||||
export enum CERTIFICATE_TYPE {
|
||||
CA = "ca",
|
||||
HOST = "host",
|
||||
HOST_INTERNAL = "host_internal",
|
||||
}
|
||||
@@ -16,6 +16,13 @@ import type {
|
||||
XenApiVm,
|
||||
} from "@/libs/xen-api/xen-api.types";
|
||||
import { buildXoObject, typeToRawType } from "@/libs/xen-api/xen-api.utils";
|
||||
import type { MaybeArray } from "@/types";
|
||||
import type {
|
||||
VmRefsWithMigration,
|
||||
VmRefsWithNameLabel,
|
||||
VmRefsWithPowerState,
|
||||
XenApiMigrationParams,
|
||||
} from "@/types/xen-api";
|
||||
import { JSONRPCClient } from "json-rpc-2.0";
|
||||
import { castArray } from "lodash-es";
|
||||
|
||||
@@ -267,8 +274,6 @@ export default class XenApi {
|
||||
return;
|
||||
}
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
|
||||
if (this.listenedTypes.length === 0) {
|
||||
void this.watch();
|
||||
return;
|
||||
@@ -277,11 +282,7 @@ export default class XenApi {
|
||||
const result: {
|
||||
token: string;
|
||||
events: XenApiEvent<ObjectType, XenApiRecord<any>>[];
|
||||
} = await this.call("event.from", [
|
||||
this.listenedTypes,
|
||||
this.fromToken,
|
||||
5.001,
|
||||
]);
|
||||
} = await this.call("event.from", [this.listenedTypes, this.fromToken, 60]);
|
||||
|
||||
this.fromToken = result.token;
|
||||
|
||||
@@ -291,35 +292,31 @@ export default class XenApi {
|
||||
}
|
||||
|
||||
get vm() {
|
||||
type VmRefs = XenApiVm["$ref"] | XenApiVm["$ref"][];
|
||||
type VmRefsWithPowerState = Record<
|
||||
XenApiVm["$ref"],
|
||||
XenApiVm["power_state"]
|
||||
>;
|
||||
type VmRefsToClone = Record<XenApiVm["$ref"], /* Cloned VM name */ string>;
|
||||
|
||||
return {
|
||||
delete: (vmRefs: VmRefs) =>
|
||||
delete: (vmRefs: MaybeArray<XenApiVm["$ref"]>) =>
|
||||
Promise.all(
|
||||
castArray(vmRefs).map((vmRef) => this.call("VM.destroy", [vmRef]))
|
||||
),
|
||||
start: (vmRefs: VmRefs) =>
|
||||
start: (vmRefs: MaybeArray<XenApiVm["$ref"]>) =>
|
||||
Promise.all(
|
||||
castArray(vmRefs).map((vmRef) =>
|
||||
this.call("VM.start", [vmRef, false, false])
|
||||
)
|
||||
),
|
||||
startOn: (vmRefs: VmRefs, hostRef: XenApiHost["$ref"]) =>
|
||||
startOn: (
|
||||
vmRefs: MaybeArray<XenApiVm["$ref"]>,
|
||||
hostRef: XenApiHost["$ref"]
|
||||
) =>
|
||||
Promise.all(
|
||||
castArray(vmRefs).map((vmRef) =>
|
||||
this.call("VM.start_on", [vmRef, hostRef, false, false])
|
||||
)
|
||||
),
|
||||
pause: (vmRefs: VmRefs) =>
|
||||
pause: (vmRefs: MaybeArray<XenApiVm["$ref"]>) =>
|
||||
Promise.all(
|
||||
castArray(vmRefs).map((vmRef) => this.call("VM.pause", [vmRef]))
|
||||
),
|
||||
suspend: (vmRefs: VmRefs) => {
|
||||
suspend: (vmRefs: MaybeArray<XenApiVm["$ref"]>) => {
|
||||
return Promise.all(
|
||||
castArray(vmRefs).map((vmRef) => this.call("VM.suspend", [vmRef]))
|
||||
);
|
||||
@@ -337,21 +334,21 @@ export default class XenApi {
|
||||
})
|
||||
);
|
||||
},
|
||||
reboot: (vmRefs: VmRefs, force = false) => {
|
||||
reboot: (vmRefs: MaybeArray<XenApiVm["$ref"]>, force = false) => {
|
||||
return Promise.all(
|
||||
castArray(vmRefs).map((vmRef) =>
|
||||
this.call(`VM.${force ? "hard" : "clean"}_reboot`, [vmRef])
|
||||
)
|
||||
);
|
||||
},
|
||||
shutdown: (vmRefs: VmRefs, force = false) => {
|
||||
shutdown: (vmRefs: MaybeArray<XenApiVm["$ref"]>, force = false) => {
|
||||
return Promise.all(
|
||||
castArray(vmRefs).map((vmRef) =>
|
||||
this.call(`VM.${force ? "hard" : "clean"}_shutdown`, [vmRef])
|
||||
)
|
||||
);
|
||||
},
|
||||
clone: (vmRefsToClone: VmRefsToClone) => {
|
||||
clone: (vmRefsToClone: VmRefsWithNameLabel) => {
|
||||
const vmRefs = Object.keys(vmRefsToClone) as XenApiVm["$ref"][];
|
||||
|
||||
return Promise.all(
|
||||
@@ -360,6 +357,72 @@ export default class XenApi {
|
||||
)
|
||||
);
|
||||
},
|
||||
migrate: (
|
||||
vmRefs: MaybeArray<XenApiVm["$ref"]>,
|
||||
destinationHostRef: XenApiHost["$ref"]
|
||||
) => {
|
||||
return Promise.all(
|
||||
castArray(vmRefs).map((vmRef) =>
|
||||
this.call("VM.pool_migrate", [
|
||||
vmRef,
|
||||
destinationHostRef,
|
||||
{ force: "false" },
|
||||
])
|
||||
)
|
||||
);
|
||||
},
|
||||
migrateComplex: (vmRefsToMigrate: VmRefsWithMigration) => {
|
||||
const vmRefs = Object.keys(vmRefsToMigrate) as XenApiVm["$ref"][];
|
||||
|
||||
return Promise.all(
|
||||
vmRefs.map(async (vmRef) => {
|
||||
const migrateData = vmRefsToMigrate[vmRef];
|
||||
|
||||
const params: XenApiMigrationParams = [
|
||||
vmRef,
|
||||
await this.call("host.migrate_receive", [
|
||||
migrateData.destinationHost,
|
||||
migrateData.migrationNetwork,
|
||||
{},
|
||||
]),
|
||||
true, // Live migration
|
||||
migrateData.vdisMap,
|
||||
{}, // vifsMap,
|
||||
{
|
||||
force: migrateData.force ? "true" : "false",
|
||||
},
|
||||
];
|
||||
|
||||
if (!migrateData.bypassAssert) {
|
||||
await this.call("VM.assert_can_migrate", params);
|
||||
}
|
||||
|
||||
const doMigration = async () => {
|
||||
try {
|
||||
await this.call("VM.migrate_send", params);
|
||||
} catch (error: any) {
|
||||
if (error?.code === "TOO_MANY_STORAGE_MIGRATES") {
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
await doMigration();
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
await doMigration();
|
||||
})
|
||||
);
|
||||
},
|
||||
snapshot: (vmRefsToSnapshot: VmRefsWithNameLabel) => {
|
||||
const vmRefs = Object.keys(vmRefsToSnapshot) as XenApiVm["$ref"][];
|
||||
|
||||
return Promise.all(
|
||||
vmRefs.map((vmRef) =>
|
||||
this.call("VM.snapshot", [vmRef, vmRefsToSnapshot[vmRef]])
|
||||
)
|
||||
);
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,56 @@
|
||||
import type {
|
||||
XEN_API_OBJECT_TYPES,
|
||||
POWER_STATE,
|
||||
AFTER_APPLY_GUIDANCE,
|
||||
ALLOCATION_ALGORITHM,
|
||||
BOND_MODE,
|
||||
CERTIFICATE_TYPE,
|
||||
DOMAIN_TYPE,
|
||||
HOST_ALLOWED_OPERATION,
|
||||
HOST_DISPLAY,
|
||||
IP_CONFIGURATION_MODE,
|
||||
IPV6_CONFIGURATION_MODE,
|
||||
LATEST_SYNCED_UPDATES_APPLIED_STATE,
|
||||
NETWORK_DEFAULT_LOCKING_MODE,
|
||||
NETWORK_OPERATION,
|
||||
NETWORK_PURPOSE,
|
||||
ON_BOOT,
|
||||
ON_CRASH_BEHAVIOUR,
|
||||
ON_NORMAL_EXIT,
|
||||
ON_SOFTREBOOT_BEHAVIOR,
|
||||
PERSISTENCE_BACKEND,
|
||||
PGPU_DOM0_ACCESS,
|
||||
PIF_IGMP_STATUS,
|
||||
POOL_ALLOWED_OPERATION,
|
||||
PRIMARY_ADDRESS_TYPE,
|
||||
SRIOV_CONFIGURATION_MODE,
|
||||
STORAGE_OPERATION,
|
||||
TELEMETRY_FREQUENCY,
|
||||
TUNNEL_PROTOCOL,
|
||||
UPDATE_AFTER_APPLY_GUIDANCE,
|
||||
UPDATE_GUIDANCE,
|
||||
UPDATE_SYNC_FREQUENCY,
|
||||
VBD_MODE,
|
||||
VBD_OPERATION,
|
||||
VBD_TYPE,
|
||||
VDI_OPERATION,
|
||||
VDI_TYPE,
|
||||
VGPU_TYPE_IMPLEMENTATION,
|
||||
VIF_IPV4_CONFIGURATION_MODE,
|
||||
VIF_IPV6_CONFIGURATION_MODE,
|
||||
VIF_LOCKING_MODE,
|
||||
VIF_OPERATION,
|
||||
VM_APPLIANCE_OPERATION,
|
||||
VM_OPERATION,
|
||||
} from "@/libs/xen-api/xen-api.utils";
|
||||
VM_POWER_STATE,
|
||||
VMPP_ARCHIVE_FREQUENCY,
|
||||
VMPP_ARCHIVE_TARGET_TYPE,
|
||||
VMPP_BACKUP_FREQUENCY,
|
||||
VMPP_BACKUP_TYPE,
|
||||
VMSS_FREQUENCY,
|
||||
VMSS_TYPE,
|
||||
VTPM_OPERATION,
|
||||
VUSB_OPERATION,
|
||||
} from "@/libs/xen-api/xen-api.enums";
|
||||
import type { XEN_API_OBJECT_TYPES } from "@/libs/xen-api/xen-api.utils";
|
||||
|
||||
type TypeMapping = typeof XEN_API_OBJECT_TYPES;
|
||||
export type ObjectType = keyof TypeMapping;
|
||||
@@ -21,6 +69,12 @@ type ObjectTypeToRecordMapping = {
|
||||
vm: XenApiVm;
|
||||
vm_guest_metrics: XenApiVmGuestMetrics;
|
||||
vm_metrics: XenApiVmMetrics;
|
||||
vbd: XenApiVbd;
|
||||
vdi: XenApiVdi;
|
||||
vif: XenApiVif;
|
||||
pif: XenApiPif;
|
||||
network: XenApiNetwork;
|
||||
pbd: XenApiPbd;
|
||||
};
|
||||
|
||||
export type ObjectTypeToRecord<Type extends ObjectType> =
|
||||
@@ -58,41 +112,488 @@ export type RawXenApiRecord<T extends XenApiRecord<ObjectType>> = Omit<
|
||||
>;
|
||||
|
||||
export interface XenApiPool extends XenApiRecord<"pool"> {
|
||||
cpu_info: {
|
||||
cpu_count: string;
|
||||
};
|
||||
allowed_operations: POOL_ALLOWED_OPERATION[];
|
||||
blobs: Record<string, XenApiBlob["$ref"]>;
|
||||
client_certificate_auth_enabled: boolean;
|
||||
client_certificate_auth_name: string;
|
||||
coordinator_bias: boolean;
|
||||
cpu_info: Record<string, string> & { cpu_count: string };
|
||||
crash_dump_SR: XenApiSr["$ref"];
|
||||
current_operations: Record<string, POOL_ALLOWED_OPERATION>;
|
||||
default_SR: XenApiSr["$ref"];
|
||||
guest_agent_config: Record<string, string>;
|
||||
gui_config: Record<string, string>;
|
||||
ha_allow_overcommit: boolean;
|
||||
ha_cluster_stack: string;
|
||||
ha_configuration: Record<string, string>;
|
||||
ha_enabled: boolean;
|
||||
ha_host_failures_to_tolerate: number;
|
||||
ha_overcommitted: boolean;
|
||||
ha_plan_exists_for: number;
|
||||
ha_statefiles: string[];
|
||||
health_check_config: Record<string, string>;
|
||||
igmp_snooping_enabled: boolean;
|
||||
is_psr_pending: boolean;
|
||||
last_update_sync: string;
|
||||
live_patching_disabled: boolean;
|
||||
master: XenApiHost["$ref"];
|
||||
metadata_VDIs: XenApiVdi["$ref"][];
|
||||
migration_compression: boolean;
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
other_config: Record<string, string>;
|
||||
policy_no_vendor_device: boolean;
|
||||
redo_log_enabled: boolean;
|
||||
redo_log_vdi: XenApiVdi["$ref"];
|
||||
repositories: XenApiRepository["$ref"][];
|
||||
repository_proxy_password: XenApiSecret["$ref"];
|
||||
repository_proxy_url: string;
|
||||
repository_proxy_username: string;
|
||||
restrictions: Record<string, string>;
|
||||
suspend_image_SR: XenApiSr["$ref"];
|
||||
tags: string[];
|
||||
telemetry_frequency: TELEMETRY_FREQUENCY;
|
||||
telemetry_next_collection: string;
|
||||
telemetry_uuid: XenApiSecret["$ref"];
|
||||
tls_verification_enabled: boolean;
|
||||
uefi_certificates: string;
|
||||
update_sync_day: number;
|
||||
update_sync_enabled: boolean;
|
||||
update_sync_frequency: UPDATE_SYNC_FREQUENCY;
|
||||
vswitch_controller: string;
|
||||
wlb_enabled: boolean;
|
||||
wlb_url: string;
|
||||
wlb_username: string;
|
||||
wlb_verify_cert: boolean;
|
||||
}
|
||||
|
||||
export interface XenApiSecret extends XenApiRecord<"secret"> {
|
||||
other_config: Record<string, string>;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface XenApiRepository extends XenApiRecord<"repository"> {
|
||||
binary_url: string;
|
||||
gpgkey_path: string;
|
||||
hash: string;
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
source_url: string;
|
||||
up_to_date: boolean;
|
||||
update: boolean;
|
||||
}
|
||||
|
||||
export interface XenApiHost extends XenApiRecord<"host"> {
|
||||
API_version_major: number;
|
||||
API_version_minor: number;
|
||||
API_version_vendor: string;
|
||||
API_version_vendor_implementation: Record<string, string>;
|
||||
PBDs: XenApiPbd["$ref"][];
|
||||
PCIs: XenApiPci["$ref"][];
|
||||
PGPUs: XenApiPgpu["$ref"][];
|
||||
PIFs: XenApiPif["$ref"][];
|
||||
PUSBs: XenApiPusb["$ref"][];
|
||||
address: string;
|
||||
name_label: string;
|
||||
allowed_operations: HOST_ALLOWED_OPERATION[];
|
||||
bios_strings: Record<string, string>;
|
||||
blobs: Record<string, XenApiBlob["$ref"]>;
|
||||
capabilities: string[];
|
||||
certificates: XenApiCertificate["$ref"][];
|
||||
chipset_info: Record<string, string>;
|
||||
control_domain: XenApiVm["$ref"];
|
||||
cpu_configuration: Record<string, string>;
|
||||
cpu_info: Record<string, string> & { cpu_count: string };
|
||||
crash_dump_sr: XenApiSr["$ref"];
|
||||
crashdumps: XenApiHostCrashdump["$ref"][];
|
||||
current_operations: Record<string, HOST_ALLOWED_OPERATION>;
|
||||
display: HOST_DISPLAY;
|
||||
edition: string;
|
||||
editions: string[];
|
||||
enabled: boolean;
|
||||
external_auth_configuration: Record<string, string>;
|
||||
external_auth_service_name: string;
|
||||
external_auth_type: string;
|
||||
features: XenApiFeature["$ref"][];
|
||||
guest_VCPUs_params: Record<string, string>;
|
||||
ha_network_peers: string[];
|
||||
ha_statefiles: string[];
|
||||
host_CPUs: XenApiHostCpu["$ref"][];
|
||||
hostname: string;
|
||||
https_only: boolean;
|
||||
iscsi_iqn: string;
|
||||
last_software_update: string;
|
||||
latest_synced_updates_applied: LATEST_SYNCED_UPDATES_APPLIED_STATE;
|
||||
license_params: Record<string, string>;
|
||||
license_server: Record<string, string>;
|
||||
local_cache_sr: XenApiSr["$ref"];
|
||||
logging: Record<string, string>;
|
||||
memory_overhead: number;
|
||||
metrics: XenApiHostMetrics["$ref"];
|
||||
multipathing: boolean;
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
other_config: Record<string, string>;
|
||||
patches: XenApiHostPatch["$ref"][];
|
||||
pending_guidances: UPDATE_GUIDANCE[];
|
||||
power_on_config: Record<string, string>;
|
||||
power_on_mode: string;
|
||||
resident_VMs: XenApiVm["$ref"][];
|
||||
cpu_info: { cpu_count: string };
|
||||
software_version: { product_version: string };
|
||||
sched_policy: string;
|
||||
software_version: Record<string, string> & { product_version: string };
|
||||
ssl_legacy: boolean;
|
||||
supported_bootloaders: string[];
|
||||
suspend_image_sr: XenApiSr["$ref"];
|
||||
tags: string[];
|
||||
tls_verification_enabled: boolean;
|
||||
uefi_certificates: string;
|
||||
updates: XenApiPoolUpdate["$ref"][];
|
||||
updates_requiring_reboot: XenApiPoolUpdate["$ref"][];
|
||||
virtual_hardware_platform_versions: number[];
|
||||
}
|
||||
|
||||
export interface XenApiCertificate extends XenApiRecord<"certificate"> {
|
||||
fingerprint: string;
|
||||
host: XenApiHost["$ref"];
|
||||
name: string;
|
||||
not_after: string;
|
||||
not_before: string;
|
||||
type: CERTIFICATE_TYPE;
|
||||
}
|
||||
|
||||
export interface XenApiHostCrashdump extends XenApiRecord<"host_crashdump"> {
|
||||
host: XenApiHost["$ref"];
|
||||
other_config: Record<string, string>;
|
||||
size: number;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export interface XenApiFeature extends XenApiRecord<"feature"> {
|
||||
enabled: boolean;
|
||||
experimental: boolean;
|
||||
host: XenApiHost["$ref"];
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface XenApiHostCpu extends XenApiRecord<"host_cpu"> {
|
||||
family: number;
|
||||
features: string;
|
||||
flags: string;
|
||||
host: XenApiHost["$ref"];
|
||||
model: number;
|
||||
modelname: string;
|
||||
number: number;
|
||||
other_config: Record<string, string>;
|
||||
speed: number;
|
||||
stepping: string;
|
||||
utilisation: number;
|
||||
vendor: string;
|
||||
}
|
||||
|
||||
export interface XenApiPbd extends XenApiRecord<"pbd"> {
|
||||
SR: XenApiSr["$ref"];
|
||||
currently_attached: boolean;
|
||||
device_config: Record<string, string>;
|
||||
host: XenApiHost["$ref"];
|
||||
other_config: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface XenApiPoolUpdate extends XenApiRecord<"pool_update"> {
|
||||
after_apply_guidance: UPDATE_AFTER_APPLY_GUIDANCE[];
|
||||
enforce_homogeneity: boolean;
|
||||
hosts: XenApiHost["$ref"][];
|
||||
installation_size: number;
|
||||
key: string;
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
other_config: Record<string, string>;
|
||||
vdi: XenApiVdi["$ref"];
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface XenApiHostPatch extends XenApiRecord<"host_patch"> {
|
||||
applied: boolean;
|
||||
host: XenApiHost["$ref"];
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
other_config: Record<string, string>;
|
||||
pool_patch: XenApiPoolPatch["$ref"];
|
||||
size: number;
|
||||
timestamp_applied: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface XenApiPoolPatch extends XenApiRecord<"pool_patch"> {
|
||||
after_apply_guidance: AFTER_APPLY_GUIDANCE[];
|
||||
host_patches: XenApiHostPatch["$ref"][];
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
other_config: Record<string, string>;
|
||||
pool_applied: boolean;
|
||||
pool_update: XenApiPoolUpdate["$ref"];
|
||||
size: number;
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface XenApiSr extends XenApiRecord<"sr"> {
|
||||
PBDs: XenApiPbd["$ref"][];
|
||||
VDIs: XenApiVdi["$ref"][];
|
||||
allowed_operations: STORAGE_OPERATION[];
|
||||
blobs: Record<string, XenApiBlob["$ref"]>;
|
||||
clustered: boolean;
|
||||
content_type: string;
|
||||
current_operations: Record<string, STORAGE_OPERATION>;
|
||||
introduced_by: XenApiDrTask["$ref"];
|
||||
is_tools_sr: boolean;
|
||||
local_cache_enabled: boolean;
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
other_config: Record<string, string>;
|
||||
physical_size: number;
|
||||
physical_utilisation: number;
|
||||
shared: boolean;
|
||||
sm_config: Record<string, string>;
|
||||
tags: string[];
|
||||
type: string;
|
||||
virtual_allocation: number;
|
||||
}
|
||||
|
||||
export interface XenApiDrTask extends XenApiRecord<"dr_task"> {
|
||||
introduced_SRs: XenApiSr["$ref"][];
|
||||
}
|
||||
|
||||
export interface XenApiVm extends XenApiRecord<"vm"> {
|
||||
current_operations: Record<string, VM_OPERATION>;
|
||||
guest_metrics: string;
|
||||
metrics: XenApiVmMetrics["$ref"];
|
||||
name_label: string;
|
||||
name_description: string;
|
||||
power_state: POWER_STATE;
|
||||
resident_on: XenApiHost["$ref"];
|
||||
HVM_boot_params: Record<string, string>;
|
||||
HVM_boot_policy: string;
|
||||
HVM_shadow_multiplier: number;
|
||||
NVRAM: Record<string, string>;
|
||||
PCI_bus: string;
|
||||
PV_args: string;
|
||||
PV_bootloader: string;
|
||||
PV_bootloader_args: string;
|
||||
PV_kernel: string;
|
||||
PV_legacy_args: string;
|
||||
PV_ramdisk: string;
|
||||
VBDs: XenApiVbd["$ref"][];
|
||||
VCPUs_at_startup: number;
|
||||
VCPUs_max: number;
|
||||
VCPUs_params: Record<string, string>;
|
||||
VGPUs: XenApiVgpu["$ref"][];
|
||||
VIFs: XenApiVif["$ref"][];
|
||||
VTPMs: XenApiVtpm["$ref"][];
|
||||
VUSBs: XenApiVusb["$ref"][];
|
||||
actions_after_crash: ON_CRASH_BEHAVIOUR;
|
||||
actions_after_reboot: ON_NORMAL_EXIT;
|
||||
actions_after_shutdown: ON_NORMAL_EXIT;
|
||||
actions_after_softreboot: ON_SOFTREBOOT_BEHAVIOR;
|
||||
affinity: XenApiHost["$ref"];
|
||||
allowed_operations: VM_OPERATION[];
|
||||
appliance: XenApiVmAppliance["$ref"];
|
||||
attached_PCIs: XenApiPci["$ref"][];
|
||||
bios_strings: Record<string, string>;
|
||||
blobs: Record<string, XenApiBlob["$ref"]>;
|
||||
blocked_operations: Record<VM_OPERATION, string>;
|
||||
children: XenApiVm["$ref"][];
|
||||
consoles: XenApiConsole["$ref"][];
|
||||
is_control_domain: boolean;
|
||||
crash_dumps: XenApiCrashdump["$ref"][];
|
||||
current_operations: Record<string, VM_OPERATION>;
|
||||
domain_type: DOMAIN_TYPE;
|
||||
domarch: string;
|
||||
domid: number;
|
||||
generation_id: string;
|
||||
guest_metrics: XenApiVmGuestMetrics["$ref"];
|
||||
ha_always_run: boolean;
|
||||
ha_restart_priority: string;
|
||||
hardware_platform_version: number;
|
||||
has_vendor_device: boolean;
|
||||
is_a_snapshot: boolean;
|
||||
is_a_template: boolean;
|
||||
VCPUs_at_startup: number;
|
||||
is_control_domain: boolean;
|
||||
is_default_template: boolean;
|
||||
is_snapshot_from_vmpp: boolean;
|
||||
is_vmss_snapshot: boolean;
|
||||
last_boot_CPU_flags: Record<string, string>;
|
||||
last_booted_record: string;
|
||||
memory_dynamic_max: number;
|
||||
memory_dynamic_min: number;
|
||||
memory_overhead: number;
|
||||
memory_static_max: number;
|
||||
memory_static_min: number;
|
||||
memory_target: number;
|
||||
metrics: XenApiVmMetrics["$ref"];
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
order: number;
|
||||
other_config: Record<string, string>;
|
||||
parent: XenApiVm["$ref"];
|
||||
pending_guidances: UPDATE_GUIDANCE[];
|
||||
platform: Record<string, string>;
|
||||
power_state: VM_POWER_STATE;
|
||||
protection_policy: XenApiVmpp["$ref"];
|
||||
recommendations: string;
|
||||
reference_label: string;
|
||||
requires_reboot: boolean;
|
||||
resident_on: XenApiHost["$ref"];
|
||||
scheduled_to_be_resident_on: XenApiHost["$ref"];
|
||||
shutdown_delay: number;
|
||||
snapshot_info: Record<string, string>;
|
||||
snapshot_metadata: string;
|
||||
snapshot_of: XenApiVm["$ref"];
|
||||
snapshot_schedule: XenApiVmss["$ref"];
|
||||
snapshot_time: string;
|
||||
snapshots: XenApiVm["$ref"][];
|
||||
start_delay: number;
|
||||
suspend_SR: XenApiSr["$ref"];
|
||||
suspend_VDI: XenApiVdi["$ref"];
|
||||
tags: string[];
|
||||
transportable_snapshot_id: string;
|
||||
user_version: number;
|
||||
version: number;
|
||||
xenstore_data: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface XenApiVtpm extends XenApiRecord<"vtpm"> {
|
||||
VM: XenApiVm["$ref"];
|
||||
allowed_operations: VTPM_OPERATION[];
|
||||
backend: XenApiVm["$ref"];
|
||||
current_operations: Record<string, VTPM_OPERATION>;
|
||||
is_protected: boolean;
|
||||
is_unique: boolean;
|
||||
persistence_backend: PERSISTENCE_BACKEND;
|
||||
}
|
||||
|
||||
export interface XenApiVusb extends XenApiRecord<"vusb"> {
|
||||
USB_group: XenApiUsbGroup["$ref"];
|
||||
VM: XenApiVm["$ref"];
|
||||
allowed_operations: VUSB_OPERATION[];
|
||||
current_operations: Record<string, VUSB_OPERATION>;
|
||||
currently_attached: boolean;
|
||||
other_config: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface XenApiUsbGroup extends XenApiRecord<"usb_group"> {
|
||||
PUSBs: XenApiPusb["$ref"][];
|
||||
VUSBs: XenApiVusb["$ref"][];
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
other_config: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface XenApiPusb extends XenApiRecord<"pusb"> {
|
||||
USB_group: XenApiUsbGroup["$ref"];
|
||||
description: string;
|
||||
host: XenApiHost["$ref"];
|
||||
other_config: Record<string, string>;
|
||||
passthrough_enabled: boolean;
|
||||
path: string;
|
||||
product_desc: string;
|
||||
product_id: string;
|
||||
serial: string;
|
||||
speed: number;
|
||||
vendor_desc: string;
|
||||
vendor_id: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface XenApiVgpu extends XenApiRecord<"vgpu"> {
|
||||
GPU_group: XenApiGpuGroup["$ref"];
|
||||
PCI: XenApiPci["$ref"];
|
||||
VM: XenApiVm["$ref"];
|
||||
compatibility_metadata: Record<string, string>;
|
||||
currently_attached: boolean;
|
||||
device: string;
|
||||
extra_args: string;
|
||||
other_config: Record<string, string>;
|
||||
resident_on: XenApiPgpu["$ref"];
|
||||
scheduled_to_be_resident_on: XenApiPgpu["$ref"];
|
||||
type: XenApiVgpuType["$ref"];
|
||||
}
|
||||
|
||||
export interface XenApiGpuGroup extends XenApiRecord<"gpu_group"> {
|
||||
GPU_types: string[];
|
||||
PGPUs: XenApiPgpu["$ref"][];
|
||||
VGPUs: XenApiVgpu["$ref"][];
|
||||
allocation_algorithm: ALLOCATION_ALGORITHM;
|
||||
enabled_VGPU_types: XenApiVgpuType["$ref"][];
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
other_config: Record<string, string>;
|
||||
supported_VGPU_types: XenApiVgpuType["$ref"][];
|
||||
}
|
||||
|
||||
export interface XenApiPgpu extends XenApiRecord<"pgpu"> {
|
||||
GPU_group: XenApiGpuGroup["$ref"];
|
||||
PCI: XenApiPci["$ref"];
|
||||
compatibility_metadata: Record<string, string>;
|
||||
dom0_access: PGPU_DOM0_ACCESS;
|
||||
enabled_VGPU_types: XenApiVgpuType["$ref"][];
|
||||
host: XenApiHost["$ref"];
|
||||
is_system_display_device: boolean;
|
||||
other_config: Record<string, string>;
|
||||
resident_VGPUs: XenApiVgpu["$ref"][];
|
||||
supported_VGPU_max_capacities: Record<XenApiVgpuType["$ref"], number>;
|
||||
supported_VGPU_types: XenApiVgpuType["$ref"][];
|
||||
}
|
||||
|
||||
export interface XenApiVgpuType extends XenApiRecord<"vgpu_type"> {
|
||||
VGPUs: XenApiVgpu["$ref"][];
|
||||
compatible_types_in_vm: XenApiVgpuType["$ref"][];
|
||||
enabled_on_GPU_groups: XenApiGpuGroup["$ref"][];
|
||||
enabled_on_PGPUs: XenApiPgpu["$ref"][];
|
||||
experimental: boolean;
|
||||
framebuffer_size: number;
|
||||
identifier: string;
|
||||
implementation: VGPU_TYPE_IMPLEMENTATION;
|
||||
max_heads: number;
|
||||
max_resolution_x: number;
|
||||
max_resolution_y: number;
|
||||
model_name: string;
|
||||
supported_on_GPU_groups: XenApiGpuGroup["$ref"][];
|
||||
supported_on_PGPUs: XenApiPgpu["$ref"][];
|
||||
vendor_name: string;
|
||||
}
|
||||
|
||||
export interface XenApiVmAppliance extends XenApiRecord<"vm_appliance"> {
|
||||
VMs: XenApiVm["$ref"][];
|
||||
allowed_operations: VM_APPLIANCE_OPERATION[];
|
||||
current_operations: Record<string, VM_APPLIANCE_OPERATION>;
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
}
|
||||
|
||||
export interface XenApiVmpp extends XenApiRecord<"vmpp"> {
|
||||
VMs: XenApiVm["$ref"][];
|
||||
alarm_config: Record<string, string>;
|
||||
archive_frequency: VMPP_ARCHIVE_FREQUENCY;
|
||||
archive_last_run_time: string;
|
||||
archive_schedule: Record<string, string>;
|
||||
archive_target_config: Record<string, string>;
|
||||
archive_target_type: VMPP_ARCHIVE_TARGET_TYPE;
|
||||
backup_frequency: VMPP_BACKUP_FREQUENCY;
|
||||
backup_last_run_time: string;
|
||||
backup_retention_value: number;
|
||||
backup_schedule: Record<string, string>;
|
||||
backup_type: VMPP_BACKUP_TYPE;
|
||||
is_alarm_enabled: boolean;
|
||||
is_archive_running: boolean;
|
||||
is_backup_running: boolean;
|
||||
is_policy_enabled: boolean;
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
recent_alerts: string[];
|
||||
}
|
||||
|
||||
export interface XenApiVmss extends XenApiRecord<"vmss"> {
|
||||
VMs: XenApiVm["$ref"][];
|
||||
enabled: boolean;
|
||||
frequency: VMSS_FREQUENCY;
|
||||
last_run_time: string;
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
retained_snapshots: number;
|
||||
schedule: Record<string, string>;
|
||||
type: VMSS_TYPE;
|
||||
}
|
||||
|
||||
export interface XenApiConsole extends XenApiRecord<"console"> {
|
||||
@@ -131,6 +632,238 @@ export interface XenApiMessage<RelationType extends RawObjectType>
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export interface XenApiVbd extends XenApiRecord<"vbd"> {
|
||||
VDI: XenApiVdi["$ref"];
|
||||
VM: XenApiVm["$ref"];
|
||||
allowed_operations: VBD_OPERATION[];
|
||||
bootable: boolean;
|
||||
current_operations: Record<string, VBD_OPERATION>;
|
||||
currently_attached: boolean;
|
||||
device: string;
|
||||
empty: boolean;
|
||||
metrics: XenApiVbdMetrics["$ref"];
|
||||
mode: VBD_MODE;
|
||||
other_config: Record<string, string>;
|
||||
qos_algorithm_params: Record<string, string>;
|
||||
qos_algorithm_type: string;
|
||||
qos_supported_algorithms: string[];
|
||||
runtime_properties: Record<string, string>;
|
||||
status_code: number;
|
||||
status_detail: string;
|
||||
storage_lock: boolean;
|
||||
type: VBD_TYPE;
|
||||
unpluggable: boolean;
|
||||
userdevice: string;
|
||||
}
|
||||
|
||||
export interface XenApiVbdMetrics extends XenApiRecord<"vbd_metrics"> {
|
||||
io_read_kbs: number;
|
||||
io_write_kbs: number;
|
||||
last_updated: string;
|
||||
other_config: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface XenApiVdi extends XenApiRecord<"vdi"> {
|
||||
SR: XenApiSr["$ref"];
|
||||
VBDs: XenApiVbd["$ref"][];
|
||||
allow_caching: boolean;
|
||||
allowed_operations: VDI_OPERATION[];
|
||||
cbt_enabled: boolean;
|
||||
crash_dumps: XenApiCrashdump["$ref"][];
|
||||
current_operations: Record<string, VDI_OPERATION>;
|
||||
is_a_snapshot: boolean;
|
||||
is_tools_iso: boolean;
|
||||
location: string;
|
||||
managed: boolean;
|
||||
metadata_latest: boolean;
|
||||
metadata_of_pool: XenApiPool["$ref"];
|
||||
missing: boolean;
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
on_boot: ON_BOOT;
|
||||
other_config: Record<string, string>;
|
||||
parent: XenApiVdi["$ref"];
|
||||
physical_utilisation: number;
|
||||
read_only: boolean;
|
||||
sharable: boolean;
|
||||
sm_config: Record<string, string>;
|
||||
snapshot_of: XenApiVdi["$ref"];
|
||||
snapshot_time: string;
|
||||
snapshots: XenApiVdi["$ref"][];
|
||||
storage_lock: boolean;
|
||||
tags: string[];
|
||||
type: VDI_TYPE;
|
||||
virtual_size: number;
|
||||
xenstore_data: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface XenApiCrashdump extends XenApiRecord<"crashdump"> {
|
||||
VDI: XenApiVdi["$ref"];
|
||||
VM: XenApiVm["$ref"];
|
||||
other_config: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface XenApiNetwork extends XenApiRecord<"network"> {
|
||||
MTU: number;
|
||||
PIFs: XenApiPif["$ref"][];
|
||||
VIFs: XenApiVif["$ref"][];
|
||||
allowed_operations: NETWORK_OPERATION[];
|
||||
assigned_ips: Record<XenApiVif["$ref"], string>;
|
||||
blobs: Record<string, XenApiBlob["$ref"]>;
|
||||
bridge: string;
|
||||
current_operations: Record<string, NETWORK_OPERATION>;
|
||||
default_locking_mode: NETWORK_DEFAULT_LOCKING_MODE;
|
||||
managed: boolean;
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
other_config: Record<string, string>;
|
||||
purpose: NETWORK_PURPOSE[];
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
export interface XenApiBlob extends XenApiRecord<"blob"> {
|
||||
last_updated: string;
|
||||
mime_type: string;
|
||||
name_description: string;
|
||||
name_label: string;
|
||||
public: boolean;
|
||||
size: number;
|
||||
}
|
||||
|
||||
export interface XenApiVif extends XenApiRecord<"vif"> {
|
||||
MAC: string;
|
||||
MAC_autogenerated: boolean;
|
||||
MTU: number;
|
||||
VM: XenApiVm["$ref"];
|
||||
allowed_operations: VIF_OPERATION[];
|
||||
current_operations: Record<string, VIF_OPERATION>;
|
||||
currently_attached: boolean;
|
||||
device: string;
|
||||
ipv4_addresses: string[];
|
||||
ipv4_allowed: string[];
|
||||
ipv4_configuration_mode: VIF_IPV4_CONFIGURATION_MODE;
|
||||
ipv4_gateway: string;
|
||||
ipv6_addresses: string[];
|
||||
ipv6_allowed: string[];
|
||||
ipv6_configuration_mode: VIF_IPV6_CONFIGURATION_MODE;
|
||||
ipv6_gateway: string;
|
||||
locking_mode: VIF_LOCKING_MODE;
|
||||
metrics: XenApiVifMetrics["$ref"];
|
||||
network: XenApiNetwork["$ref"];
|
||||
other_config: Record<string, string>;
|
||||
qos_algorithm_params: Record<string, string>;
|
||||
qos_algorithm_type: string;
|
||||
qos_supported_algorithms: string[];
|
||||
runtime_properties: Record<string, string>;
|
||||
status_code: number;
|
||||
status_detail: string;
|
||||
}
|
||||
|
||||
export interface XenApiVifMetrics extends XenApiRecord<"vif_metrics"> {
|
||||
io_read_kbs: number;
|
||||
io_write_kbs: number;
|
||||
last_updated: string;
|
||||
other_config: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface XenApiPif extends XenApiRecord<"pif"> {
|
||||
DNS: string;
|
||||
IP: string;
|
||||
IPv6: string[];
|
||||
MAC: string;
|
||||
MTU: number;
|
||||
PCI: XenApiPci["$ref"];
|
||||
VLAN: number;
|
||||
VLAN_master_of: XenApiVlan["$ref"];
|
||||
VLAN_slave_of: XenApiVlan["$ref"][];
|
||||
bond_master_of: XenApiBond["$ref"][];
|
||||
bond_slave_of: XenApiBond["$ref"];
|
||||
capabilities: string[];
|
||||
currently_attached: boolean;
|
||||
device: string;
|
||||
disallow_unplug: boolean;
|
||||
gateway: string;
|
||||
host: XenApiHost["$ref"];
|
||||
igmp_snooping_status: PIF_IGMP_STATUS;
|
||||
ip_configuration_mode: IP_CONFIGURATION_MODE;
|
||||
ipv6_configuration_mode: IPV6_CONFIGURATION_MODE;
|
||||
ipv6_gateway: string;
|
||||
managed: boolean;
|
||||
management: boolean;
|
||||
metrics: XenApiPifMetrics["$ref"];
|
||||
netmask: string;
|
||||
network: XenApiNetwork["$ref"];
|
||||
other_config: Record<string, string>;
|
||||
physical: boolean;
|
||||
primary_address_type: PRIMARY_ADDRESS_TYPE;
|
||||
properties: Record<string, string>;
|
||||
sriov_logical_PIF_of: XenApiNetworkSriov["$ref"][];
|
||||
sriov_physical_PIF_of: XenApiNetworkSriov["$ref"][];
|
||||
tunnel_access_PIF_of: XenApiTunnel["$ref"][];
|
||||
tunnel_transport_PIF_of: XenApiTunnel["$ref"][];
|
||||
}
|
||||
|
||||
export interface XenApiNetworkSriov extends XenApiRecord<"network_sriov"> {
|
||||
configuration_mode: SRIOV_CONFIGURATION_MODE;
|
||||
logical_PIF: XenApiPif["$ref"];
|
||||
physical_PIF: XenApiPif["$ref"];
|
||||
requires_reboot: boolean;
|
||||
}
|
||||
|
||||
export interface XenApiVlan extends XenApiRecord<"vlan"> {
|
||||
other_config: Record<string, string>;
|
||||
tag: number;
|
||||
tagged_PIF: XenApiPif["$ref"];
|
||||
untagged_PIF: XenApiPif["$ref"];
|
||||
}
|
||||
|
||||
export interface XenApiTunnel extends XenApiRecord<"tunnel"> {
|
||||
access_PIF: XenApiPif["$ref"];
|
||||
other_config: Record<string, string>;
|
||||
protocol: TUNNEL_PROTOCOL;
|
||||
status: Record<string, string>;
|
||||
transport_PIF: XenApiPif["$ref"];
|
||||
}
|
||||
|
||||
export interface XenApiPci extends XenApiRecord<"pci"> {
|
||||
class_name: string;
|
||||
dependencies: XenApiPci["$ref"][];
|
||||
device_name: string;
|
||||
driver_name: string;
|
||||
host: XenApiHost["$ref"];
|
||||
other_config: Record<string, string>;
|
||||
pci_id: string;
|
||||
subsystem_device_name: string;
|
||||
subsystem_vendor_name: string;
|
||||
vendor_name: string;
|
||||
}
|
||||
|
||||
export interface XenApiPifMetrics extends XenApiRecord<"pif_metrics"> {
|
||||
carrier: boolean;
|
||||
device_id: string;
|
||||
device_name: string;
|
||||
duplex: boolean;
|
||||
io_read_kbs: number;
|
||||
io_write_kbs: number;
|
||||
last_updated: string;
|
||||
other_config: Record<string, string>;
|
||||
pci_bus_path: string;
|
||||
speed: number;
|
||||
vendor_id: string;
|
||||
vendor_name: string;
|
||||
}
|
||||
|
||||
export interface XenApiBond extends XenApiRecord<"bond"> {
|
||||
auto_update_mac: boolean;
|
||||
links_up: number;
|
||||
master: XenApiPif["$ref"];
|
||||
mode: BOND_MODE;
|
||||
other_config: Record<string, string>;
|
||||
primary_slave: XenApiPif["$ref"];
|
||||
properties: Record<string, string>;
|
||||
slaves: XenApiPif["$ref"][];
|
||||
}
|
||||
|
||||
export type XenApiEvent<
|
||||
RelationType extends ObjectType,
|
||||
XRecord extends ObjectTypeToRecord<RelationType>,
|
||||
|
||||
@@ -25,6 +25,7 @@ export const XEN_API_OBJECT_TYPES = {
|
||||
pvs_proxy: "PVS_proxy",
|
||||
pvs_server: "PVS_server",
|
||||
pvs_site: "PVS_site",
|
||||
repository: "repository",
|
||||
sdn_controller: "SDN_controller",
|
||||
sm: "SM",
|
||||
sr: "SR",
|
||||
@@ -40,6 +41,7 @@ export const XEN_API_OBJECT_TYPES = {
|
||||
vm: "VM",
|
||||
vmpp: "VMPP",
|
||||
vmss: "VMSS",
|
||||
vm_appliance: "VM_appliance",
|
||||
vm_guest_metrics: "VM_guest_metrics",
|
||||
vm_metrics: "VM_metrics",
|
||||
vusb: "VUSB",
|
||||
@@ -62,6 +64,7 @@ export const XEN_API_OBJECT_TYPES = {
|
||||
subject: "subject",
|
||||
task: "task",
|
||||
tunnel: "tunnel",
|
||||
vtpm: "VTPM",
|
||||
} as const;
|
||||
|
||||
export const rawTypeToType = <RawType extends RawObjectType>(
|
||||
@@ -72,28 +75,6 @@ export const typeToRawType = <Type extends ObjectType>(
|
||||
type: Type
|
||||
): TypeToRawType<Type> => XEN_API_OBJECT_TYPES[type];
|
||||
|
||||
export enum POWER_STATE {
|
||||
RUNNING = "Running",
|
||||
PAUSED = "Paused",
|
||||
HALTED = "Halted",
|
||||
SUSPENDED = "Suspended",
|
||||
}
|
||||
|
||||
export enum VM_OPERATION {
|
||||
START = "start",
|
||||
START_ON = "start_on",
|
||||
RESUME = "resume",
|
||||
UNPAUSE = "unpause",
|
||||
CLONE = "clone",
|
||||
SHUTDOWN = "shutdown",
|
||||
CLEAN_SHUTDOWN = "clean_shutdown",
|
||||
HARD_SHUTDOWN = "hard_shutdown",
|
||||
CLEAN_REBOOT = "clean_reboot",
|
||||
HARD_REBOOT = "hard_reboot",
|
||||
PAUSE = "pause",
|
||||
SUSPEND = "suspend",
|
||||
}
|
||||
|
||||
export const buildXoObject = <T extends XenApiRecord<ObjectType>>(
|
||||
record: RawXenApiRecord<T>,
|
||||
params: { opaqueRef: T["$ref"] }
|
||||
|
||||
@@ -27,10 +27,12 @@
|
||||
"cancel": "Cancel",
|
||||
"change-state": "Change state",
|
||||
"click-to-display-alarms": "Click to display alarms:",
|
||||
"confirm-delete": "You're about to delete {0}",
|
||||
"close": "Close",
|
||||
"coming-soon": "Coming soon!",
|
||||
"community": "Community",
|
||||
"community-name": "{name} community",
|
||||
"confirm-cancel": "Are you sure you want to cancel?",
|
||||
"confirm-delete": "You're about to delete {0}",
|
||||
"console": "Console",
|
||||
"console-unavailable": "Console unavailable",
|
||||
"copy": "Copy",
|
||||
@@ -42,9 +44,9 @@
|
||||
"descending": "descending",
|
||||
"description": "Description",
|
||||
"display": "Display",
|
||||
"do-you-have-needs": "You have needs and/or expectations? Let us know",
|
||||
"documentation": "Documentation",
|
||||
"documentation-name": "{name} documentation",
|
||||
"do-you-have-needs": "You have needs and/or expectations? Let us know",
|
||||
"edit-config": "Edit config",
|
||||
"error-no-data": "Error, can't collect data.",
|
||||
"error-occurred": "An error has occurred",
|
||||
@@ -84,15 +86,19 @@
|
||||
"log-out": "Log out",
|
||||
"login": "Login",
|
||||
"migrate": "Migrate",
|
||||
"migrate-n-vms": "Migrate 1 VM | Migrate {n} VMs",
|
||||
"migration-close-warning": "Warning: If you close this window, failed migration attempts will not be retried.",
|
||||
"n-hosts-awaiting-patch": "{n} host is awaiting this patch | {n} hosts are awaiting this patch",
|
||||
"n-missing": "{n} missing",
|
||||
"n-vms": "1 VM | {n} VMs",
|
||||
"name": "Name",
|
||||
"network": "Network",
|
||||
"network-download": "Download",
|
||||
"network-throughput": "Network throughput",
|
||||
"network-upload": "Upload",
|
||||
"new-features-are-coming": "New features are coming soon!",
|
||||
"news": "News",
|
||||
"news-name": "{name} news",
|
||||
"new-features-are-coming": "New features are coming soon!",
|
||||
"no-alarm-triggered": "No alarm triggered",
|
||||
"no-tasks": "No tasks",
|
||||
"not-found": "Not found",
|
||||
@@ -104,8 +110,10 @@
|
||||
"page-not-found": "This page is not to be found…",
|
||||
"password": "Password",
|
||||
"password-invalid": "Password invalid",
|
||||
"patches": "Patches",
|
||||
"pause": "Pause",
|
||||
"please-confirm": "Please confirm",
|
||||
"please-select": "Please select",
|
||||
"pool-cpu-usage": "Pool CPU Usage",
|
||||
"pool-ram-usage": "Pool RAM Usage",
|
||||
"power-on-for-console": "Power on your VM to access its console",
|
||||
@@ -127,11 +135,15 @@
|
||||
},
|
||||
"resume": "Resume",
|
||||
"save": "Save",
|
||||
"select-destination-host": "Select a destination host",
|
||||
"select-destination-sr": "Select a destination SR",
|
||||
"select-optional-migration-network": "Select a migration network (optional)",
|
||||
"selected-vms-in-execution": "Some selected VMs are running",
|
||||
"send-us-feedback": "Send us feedback",
|
||||
"settings": "Settings",
|
||||
"shutdown": "Shutdown",
|
||||
"snapshot": "Snapshot",
|
||||
"some-selected-vms-can-not-be-migrated": "Some selected VMs can't be migrated",
|
||||
"sort-by": "Sort by",
|
||||
"stacked-cpu-usage": "Stacked CPU usage",
|
||||
"stacked-ram-usage": "Stacked RAM usage",
|
||||
@@ -165,5 +177,12 @@
|
||||
"vcpus-used": "vCPUs used",
|
||||
"version": "Version",
|
||||
"vms": "VMs",
|
||||
"vms-migration-error": {
|
||||
"already-being-migrated": "At least one selected VM is already being migrated",
|
||||
"not-allowed": "Some VMs are not allowed to be migrated",
|
||||
"no-destination-host": "No destination host has been selected",
|
||||
"no-migration-network": "No migration network has been selected",
|
||||
"no-destination-sr": "No destination SR has been selected"
|
||||
},
|
||||
"xo-lite-under-construction": "XOLite is under construction"
|
||||
}
|
||||
|
||||
@@ -25,12 +25,14 @@
|
||||
"back-pool-dashboard": "Revenez au tableau de bord de votre pool",
|
||||
"backup": "Sauvegarde",
|
||||
"cancel": "Annuler",
|
||||
"confirm-delete": "Vous êtes sur le point de supprimer {0}",
|
||||
"change-state": "Changer l'état",
|
||||
"click-to-display-alarms": "Cliquer pour afficher les alarmes :",
|
||||
"close": "Fermer",
|
||||
"coming-soon": "Bientôt disponible !",
|
||||
"community": "Communauté",
|
||||
"community-name": "Communauté {name}",
|
||||
"confirm-cancel": "Êtes-vous sûr de vouloir annuler ?",
|
||||
"confirm-delete": "Vous êtes sur le point de supprimer {0}",
|
||||
"console": "Console",
|
||||
"console-unavailable": "Console indisponible",
|
||||
"copy": "Copier",
|
||||
@@ -42,9 +44,9 @@
|
||||
"descending": "descendant",
|
||||
"description": "Description",
|
||||
"display": "Affichage",
|
||||
"do-you-have-needs": "Vous avez des besoins et/ou des attentes ? Faites le nous savoir",
|
||||
"documentation": "Documentation",
|
||||
"documentation-name": "Documentation {name}",
|
||||
"do-you-have-needs": "Vous avez des besoins et/ou des attentes ? Faites le nous savoir",
|
||||
"edit-config": "Modifier config",
|
||||
"error-no-data": "Erreur, impossible de collecter les données.",
|
||||
"error-occurred": "Une erreur est survenue",
|
||||
@@ -84,15 +86,19 @@
|
||||
"log-out": "Se déconnecter",
|
||||
"login": "Connexion",
|
||||
"migrate": "Migrer",
|
||||
"migrate-n-vms": "Migrer 1 VM | Migrer {n} VMs",
|
||||
"migration-close-warning": "Attention : Si vous fermez cette fenêtre, les tentatives de migration échouées ne seront pas réessayées.",
|
||||
"n-hosts-awaiting-patch": "{n} hôte attend ce patch | {n} hôtes attendent ce patch",
|
||||
"n-missing": "{n} manquant | {n} manquants",
|
||||
"n-vms": "1 VM | {n} VMs",
|
||||
"name": "Nom",
|
||||
"network": "Réseau",
|
||||
"network-download": "Descendant",
|
||||
"network-throughput": "Débit du réseau",
|
||||
"network-upload": "Montant",
|
||||
"new-features-are-coming": "De nouvelles fonctionnalités arrivent bientôt !",
|
||||
"news": "Actualités",
|
||||
"news-name": "Actualités {name}",
|
||||
"new-features-are-coming": "De nouvelles fonctionnalités arrivent bientôt !",
|
||||
"no-alarm-triggered": "Aucune alarme déclenchée",
|
||||
"no-tasks": "Aucune tâche",
|
||||
"not-found": "Non trouvé",
|
||||
@@ -104,8 +110,10 @@
|
||||
"page-not-found": "Cette page est introuvable…",
|
||||
"password": "Mot de passe",
|
||||
"password-invalid": "Mot de passe incorrect",
|
||||
"patches": "Patches",
|
||||
"pause": "Pause",
|
||||
"please-confirm": "Veuillez confirmer",
|
||||
"please-select": "Veuillez sélectionner",
|
||||
"pool-cpu-usage": "Utilisation CPU du Pool",
|
||||
"pool-ram-usage": "Utilisation RAM du Pool",
|
||||
"power-on-for-console": "Allumez votre VM pour accéder à sa console",
|
||||
@@ -127,11 +135,13 @@
|
||||
},
|
||||
"resume": "Reprendre",
|
||||
"save": "Enregistrer",
|
||||
"select-destination-host": "Sélectionnez un hôte de destination",
|
||||
"selected-vms-in-execution": "Certaines VMs sélectionnées sont en cours d'exécution",
|
||||
"send-us-feedback": "Envoyez-nous vos commentaires",
|
||||
"settings": "Paramètres",
|
||||
"shutdown": "Arrêter",
|
||||
"snapshot": "Instantané",
|
||||
"some-selected-vms-can-not-be-migrated": "Certaines VMs sélectionnées ne peuvent pas être migrées",
|
||||
"sort-by": "Trier par",
|
||||
"stacked-cpu-usage": "Utilisation CPU empilée",
|
||||
"stacked-ram-usage": "Utilisation RAM empilée",
|
||||
@@ -165,5 +175,12 @@
|
||||
"vcpus-used": "vCPUs utilisés",
|
||||
"version": "Version",
|
||||
"vms": "VMs",
|
||||
"vms-migration-error": {
|
||||
"already-being-migrated": "Au moins une VM sélectionnée est déjà en cours de migration",
|
||||
"not-allowed": "Certaines VM ne sont pas autorisées à être migrées",
|
||||
"no-destination-host": "Aucun hôte de destination n'a été sélectionné",
|
||||
"no-migration-network": "Aucun réseau de migration n'a été sélectionné",
|
||||
"no-destination-sr": "Aucun SR de destination n'a été sélectionné"
|
||||
},
|
||||
"xo-lite-under-construction": "XOLite est en construction"
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ type StoreToRefs<SS extends Store<any, any, any, any>> = ToRefs<
|
||||
|
||||
type Output<
|
||||
S extends StoreDefinition<any, any, any, any>,
|
||||
Defer extends boolean
|
||||
Defer extends boolean,
|
||||
> = Omit<S, keyof StoreToRefs<S> | IgnoredProperties> &
|
||||
StoreToRefs<S> &
|
||||
(Defer extends true
|
||||
@@ -54,7 +54,7 @@ export const createUseCollection = <
|
||||
infer A
|
||||
>
|
||||
? Store<Id, S, G, A>
|
||||
: never
|
||||
: never,
|
||||
>(
|
||||
useStore: SD
|
||||
) => {
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { XenApiHost } from "@/libs/xen-api/xen-api.types";
|
||||
import { useXenApiStore } from "@/stores/xen-api.store";
|
||||
import { createUseCollection } from "@/stores/xen-api/create-use-collection";
|
||||
import { useHostMetricsStore } from "@/stores/xen-api/host-metrics.store";
|
||||
import type { XenApiPatch } from "@/types/xen-api";
|
||||
import { defineStore } from "pinia";
|
||||
import { computed } from "vue";
|
||||
|
||||
@@ -42,10 +43,36 @@ export const useHostStore = defineStore("xen-api-host", () => {
|
||||
});
|
||||
}) as GetStats<XenApiHost>;
|
||||
|
||||
const fetchMissingPatches = async (
|
||||
hostRef: XenApiHost["$ref"]
|
||||
): Promise<XenApiPatch[]> => {
|
||||
const xenApiStore = useXenApiStore();
|
||||
|
||||
const rawPatchesAsString = await xenApiStore
|
||||
.getXapi()
|
||||
.call<string>("host.call_plugin", [
|
||||
hostRef,
|
||||
"updater.py",
|
||||
"check_update",
|
||||
{},
|
||||
]);
|
||||
|
||||
const rawPatches = JSON.parse(rawPatchesAsString) as Omit<
|
||||
XenApiPatch,
|
||||
"$id"
|
||||
>[];
|
||||
|
||||
return rawPatches.map((rawPatch) => ({
|
||||
...rawPatch,
|
||||
$id: `${rawPatch.name}-${rawPatch.version}`,
|
||||
}));
|
||||
};
|
||||
|
||||
return {
|
||||
...context,
|
||||
runningHosts,
|
||||
getStats,
|
||||
fetchMissingPatches,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
9
@xen-orchestra/lite/src/stores/xen-api/network.store.ts
Normal file
9
@xen-orchestra/lite/src/stores/xen-api/network.store.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { useXenApiStoreSubscribableContext } from "@/composables/xen-api-store-subscribable-context.composable";
|
||||
import { createUseCollection } from "@/stores/xen-api/create-use-collection";
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export const useNetworkStore = defineStore("xen-api-network", () => {
|
||||
return useXenApiStoreSubscribableContext("network");
|
||||
});
|
||||
|
||||
export const useNetworkCollection = createUseCollection(useNetworkStore);
|
||||
9
@xen-orchestra/lite/src/stores/xen-api/pbd.store.ts
Normal file
9
@xen-orchestra/lite/src/stores/xen-api/pbd.store.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { useXenApiStoreSubscribableContext } from "@/composables/xen-api-store-subscribable-context.composable";
|
||||
import { createUseCollection } from "@/stores/xen-api/create-use-collection";
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export const usePbdStore = defineStore("xen-api-pbd", () => {
|
||||
return useXenApiStoreSubscribableContext("pbd");
|
||||
});
|
||||
|
||||
export const usePbdCollection = createUseCollection(usePbdStore);
|
||||
9
@xen-orchestra/lite/src/stores/xen-api/pif.store.ts
Normal file
9
@xen-orchestra/lite/src/stores/xen-api/pif.store.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { useXenApiStoreSubscribableContext } from "@/composables/xen-api-store-subscribable-context.composable";
|
||||
import { createUseCollection } from "@/stores/xen-api/create-use-collection";
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export const usePifStore = defineStore("xen-api-pif", () => {
|
||||
return useXenApiStoreSubscribableContext("pif");
|
||||
});
|
||||
|
||||
export const usePifCollection = createUseCollection(usePifStore);
|
||||
9
@xen-orchestra/lite/src/stores/xen-api/vbd.store.ts
Normal file
9
@xen-orchestra/lite/src/stores/xen-api/vbd.store.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { useXenApiStoreSubscribableContext } from "@/composables/xen-api-store-subscribable-context.composable";
|
||||
import { createUseCollection } from "@/stores/xen-api/create-use-collection";
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export const useVbdStore = defineStore("xen-api-vbd", () => {
|
||||
return useXenApiStoreSubscribableContext("vbd");
|
||||
});
|
||||
|
||||
export const useVbdCollection = createUseCollection(useVbdStore);
|
||||
9
@xen-orchestra/lite/src/stores/xen-api/vdi.store.ts
Normal file
9
@xen-orchestra/lite/src/stores/xen-api/vdi.store.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { useXenApiStoreSubscribableContext } from "@/composables/xen-api-store-subscribable-context.composable";
|
||||
import { createUseCollection } from "@/stores/xen-api/create-use-collection";
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export const useVdiStore = defineStore("xen-api-vdi", () => {
|
||||
return useXenApiStoreSubscribableContext("vdi");
|
||||
});
|
||||
|
||||
export const useVdiCollection = createUseCollection(useVdiStore);
|
||||
@@ -2,12 +2,15 @@ import type { GetStats } from "@/composables/fetch-stats.composable";
|
||||
import { useXenApiStoreSubscribableContext } from "@/composables/xen-api-store-subscribable-context.composable";
|
||||
import { sortRecordsByNameLabel } from "@/libs/utils";
|
||||
import type { VmStats } from "@/libs/xapi-stats";
|
||||
import {
|
||||
type VM_OPERATION,
|
||||
VM_POWER_STATE,
|
||||
} from "@/libs/xen-api/xen-api.enums";
|
||||
import type { XenApiHost, XenApiVm } from "@/libs/xen-api/xen-api.types";
|
||||
import type { VM_OPERATION } from "@/libs/xen-api/xen-api.utils";
|
||||
import { POWER_STATE } from "@/libs/xen-api/xen-api.utils";
|
||||
import { useXenApiStore } from "@/stores/xen-api.store";
|
||||
import { createUseCollection } from "@/stores/xen-api/create-use-collection";
|
||||
import { useHostStore } from "@/stores/xen-api/host.store";
|
||||
import type { MaybeArray } from "@/types";
|
||||
import { castArray } from "lodash-es";
|
||||
import { defineStore } from "pinia";
|
||||
import { computed } from "vue";
|
||||
@@ -23,19 +26,32 @@ export const useVmStore = defineStore("xen-api-vm", () => {
|
||||
.sort(sortRecordsByNameLabel)
|
||||
);
|
||||
|
||||
const isOperationPending = (
|
||||
vm: XenApiVm,
|
||||
operations: VM_OPERATION[] | VM_OPERATION
|
||||
const hasOperation = (
|
||||
vms: MaybeArray<XenApiVm>,
|
||||
operations: MaybeArray<VM_OPERATION>,
|
||||
operationType: "current_operations" | "allowed_operations"
|
||||
) => {
|
||||
const currentOperations = Object.values(vm.current_operations);
|
||||
return castArray(vms).some((vm) => {
|
||||
const currentOperations = Object.values(vm[operationType]);
|
||||
|
||||
return castArray(operations).some((operation) =>
|
||||
currentOperations.includes(operation)
|
||||
);
|
||||
return castArray(operations).some((operation) =>
|
||||
currentOperations.includes(operation)
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
const isOperationPending = (
|
||||
vms: XenApiVm | XenApiVm[],
|
||||
operations: MaybeArray<VM_OPERATION>
|
||||
) => hasOperation(vms, operations, "current_operations");
|
||||
|
||||
const isOperationAllowed = (
|
||||
vms: MaybeArray<XenApiVm>,
|
||||
operations: MaybeArray<VM_OPERATION>
|
||||
) => hasOperation(vms, operations, "allowed_operations");
|
||||
|
||||
const runningVms = computed(() =>
|
||||
records.value.filter((vm) => vm.power_state === POWER_STATE.RUNNING)
|
||||
records.value.filter((vm) => vm.power_state === VM_POWER_STATE.RUNNING)
|
||||
);
|
||||
|
||||
const recordsByHostRef = computed(() => {
|
||||
@@ -90,6 +106,7 @@ export const useVmStore = defineStore("xen-api-vm", () => {
|
||||
...context,
|
||||
records,
|
||||
isOperationPending,
|
||||
isOperationAllowed,
|
||||
runningVms,
|
||||
recordsByHostRef,
|
||||
getStats,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
prop('error').type('string').widget(),
|
||||
prop('help').type('string').widget().preset('256 by default'),
|
||||
prop('disabled').type('boolean').widget().ctx(),
|
||||
prop('light').bool().widget(),
|
||||
slot().help('Contains the input'),
|
||||
]"
|
||||
>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
```vue-template
|
||||
<UiModal v-model="isOpen">
|
||||
<BasicModalLayout>
|
||||
Here is a basic modal...
|
||||
</BasicModalLayout>
|
||||
</UiModal>
|
||||
```
|
||||
|
||||
```vue-script
|
||||
const { isOpen } = useModal();
|
||||
```
|
||||
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<ComponentStory
|
||||
v-slot="{ settings }"
|
||||
:params="[
|
||||
slot(),
|
||||
setting('defaultSlotContent').preset('Modal content').widget(text()),
|
||||
]"
|
||||
>
|
||||
<BasicModalLayout>
|
||||
{{ settings.defaultSlotContent }}
|
||||
</BasicModalLayout>
|
||||
</ComponentStory>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import ComponentStory from "@/components/component-story/ComponentStory.vue";
|
||||
import BasicModalLayout from "@/components/ui/modals/layouts/BasicModalLayout.vue";
|
||||
import { setting, slot } from "@/libs/story/story-param";
|
||||
import { text } from "@/libs/story/story-widget";
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped></style>
|
||||
@@ -0,0 +1,21 @@
|
||||
```vue-template
|
||||
<UiModal v-model="isOpen">
|
||||
<ConfirmModalLayout :icon="faShip">
|
||||
<template #title>Do you confirm?</template>
|
||||
<template #subtitle>You should be sure about this</template>
|
||||
<template #buttons>
|
||||
<UiButton outlined @click="close">I prefer not</UiButton>
|
||||
<UiButton @click="accept">Yes, I'm sure!</UiButton>
|
||||
</template>
|
||||
</ConfirmModalLayout>
|
||||
</UiModal>
|
||||
```
|
||||
|
||||
```vue-script
|
||||
const { isOpen, close } = useModal();
|
||||
|
||||
const accept = async () => {
|
||||
// do something
|
||||
close();
|
||||
}
|
||||
```
|
||||
@@ -1,45 +1,32 @@
|
||||
<template>
|
||||
<ComponentStory
|
||||
v-slot="{ properties, settings }"
|
||||
:params="[
|
||||
colorProp(),
|
||||
iconProp(),
|
||||
event('close').preset(close),
|
||||
slot('default'),
|
||||
slot('title'),
|
||||
slot('subtitle'),
|
||||
slot('icon'),
|
||||
slot('default'),
|
||||
slot('buttons').help('Meant to receive UiButton components'),
|
||||
setting('title').preset('Modal Title').widget(),
|
||||
setting('subtitle').preset('Modal Subtitle').widget(),
|
||||
]"
|
||||
v-slot="{ properties, settings }"
|
||||
>
|
||||
<UiButton type="button" @click="open">Open Modal</UiButton>
|
||||
|
||||
<UiModal v-bind="properties" v-if="isOpen">
|
||||
<ConfirmModalLayout v-bind="properties">
|
||||
<template #title>{{ settings.title }}</template>
|
||||
<template #subtitle>{{ settings.subtitle }}</template>
|
||||
<template #buttons>
|
||||
<UiButton @click="close">Discard</UiButton>
|
||||
<UiButton outlined>Discard</UiButton>
|
||||
<UiButton>Go</UiButton>
|
||||
</template>
|
||||
</UiModal>
|
||||
</ConfirmModalLayout>
|
||||
</ComponentStory>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import ComponentStory from "@/components/component-story/ComponentStory.vue";
|
||||
import ConfirmModalLayout from "@/components/ui/modals/layouts/ConfirmModalLayout.vue";
|
||||
import UiButton from "@/components/ui/UiButton.vue";
|
||||
import UiModal from "@/components/ui/UiModal.vue";
|
||||
import useModal from "@/composables/modal.composable";
|
||||
import {
|
||||
colorProp,
|
||||
event,
|
||||
iconProp,
|
||||
setting,
|
||||
slot,
|
||||
} from "@/libs/story/story-param";
|
||||
|
||||
const { open, close, isOpen } = useModal();
|
||||
import { iconProp, setting, slot } from "@/libs/story/story-param";
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped></style>
|
||||
@@ -0,0 +1,25 @@
|
||||
```vue-template
|
||||
<UiModal v-model="isOpen">
|
||||
<FormModalLayout :icon="faShip" @submit.prevent="handleSubmit">
|
||||
<template #title>Migrate 3 VMs/template>
|
||||
|
||||
<template #default>
|
||||
<!-- Form content goes here... -->
|
||||
</template>
|
||||
|
||||
<template #buttons>
|
||||
<UiButton outlined @click="close">Cancel</UiButton>
|
||||
<UiButton type="submit">Migrate 3 VMs</UiButton>
|
||||
</template>
|
||||
</ConfirmModalLayout>
|
||||
</UiModal>
|
||||
```
|
||||
|
||||
```vue-script
|
||||
const { isOpen, close } = useModal();
|
||||
|
||||
const handleSubmit = async () => {
|
||||
// Handling form submission...
|
||||
close();
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<ComponentStory
|
||||
v-slot="{ properties }"
|
||||
:params="[iconProp(), slot('title'), slot('default'), slot('buttons')]"
|
||||
>
|
||||
<FormModalLayout :icon="faRoute" v-bind="properties">
|
||||
<template #title>Migrate 3 VMs</template>
|
||||
|
||||
<div>
|
||||
<FormInputWrapper
|
||||
label="Select a destination host"
|
||||
learn-more-url="http://..."
|
||||
light
|
||||
>
|
||||
<FormInput />
|
||||
</FormInputWrapper>
|
||||
|
||||
<FormInputWrapper
|
||||
label="Select a migration network (optional)"
|
||||
learn-more-url="http://..."
|
||||
light
|
||||
>
|
||||
<FormInput />
|
||||
</FormInputWrapper>
|
||||
|
||||
<FormInputWrapper
|
||||
help="Individual selection for each VDI is not available on multiple VMs migration."
|
||||
label="Select a destination SR"
|
||||
learn-more-url="http://..."
|
||||
light
|
||||
>
|
||||
<FormInput />
|
||||
</FormInputWrapper>
|
||||
</div>
|
||||
|
||||
<template #buttons>
|
||||
<UiButton outlined>Cancel</UiButton>
|
||||
<UiButton>Migrate 3 VMs</UiButton>
|
||||
</template>
|
||||
</FormModalLayout>
|
||||
</ComponentStory>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import ComponentStory from "@/components/component-story/ComponentStory.vue";
|
||||
import FormInput from "@/components/form/FormInput.vue";
|
||||
import FormInputWrapper from "@/components/form/FormInputWrapper.vue";
|
||||
import FormModalLayout from "@/components/ui/modals/layouts/FormModalLayout.vue";
|
||||
import UiButton from "@/components/ui/UiButton.vue";
|
||||
import { iconProp, slot } from "@/libs/story/story-param";
|
||||
import { faRoute } from "@fortawesome/free-solid-svg-icons";
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped></style>
|
||||
@@ -0,0 +1,19 @@
|
||||
A basic modal container containing 3 slots: `header`, `default` and `footer`.
|
||||
|
||||
Tag will be `div` by default but can be changed with the `tag` prop.
|
||||
|
||||
Color can be changed with the `color` prop.
|
||||
|
||||
To keep the content centered vertically, header and footer will always have the same height.
|
||||
|
||||
Modal content has an max height + overflow to prevent the modal growing out of the screen.
|
||||
|
||||
Modal containers can be nested.
|
||||
|
||||
```vue-template
|
||||
<ModalContainer>
|
||||
<template #header>Header</template>
|
||||
<template #default>Content</template>
|
||||
<template #header>Footer</template>
|
||||
</ModalContainer>
|
||||
```
|
||||
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<ComponentStory
|
||||
v-slot="{ properties, settings }"
|
||||
:params="[
|
||||
prop('tag').str().default('div').widget(),
|
||||
colorProp(),
|
||||
slot('header'),
|
||||
slot(),
|
||||
slot('footer'),
|
||||
setting('headerSlotContent')
|
||||
.preset('Header')
|
||||
.widget(text())
|
||||
.help('Content for default slot'),
|
||||
setting('defaultSlotContent')
|
||||
.preset('Content')
|
||||
.widget(text())
|
||||
.help('Content for default slot'),
|
||||
setting('footerSlotContent')
|
||||
.preset('Footer')
|
||||
.widget(text())
|
||||
.help('Content for default slot'),
|
||||
setting('showNested')
|
||||
.preset(false)
|
||||
.widget(boolean())
|
||||
.help('Show nested modal'),
|
||||
]"
|
||||
>
|
||||
<ModalContainer v-bind="properties">
|
||||
<template #header>
|
||||
{{ settings.headerSlotContent }}
|
||||
</template>
|
||||
|
||||
<template #default>
|
||||
{{ settings.defaultSlotContent }}
|
||||
<ModalContainer v-if="settings.showNested" color="error">
|
||||
Nested modal
|
||||
</ModalContainer>
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
{{ settings.footerSlotContent }}
|
||||
</template>
|
||||
</ModalContainer>
|
||||
</ComponentStory>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import ComponentStory from "@/components/component-story/ComponentStory.vue";
|
||||
import ModalContainer from "@/components/ui/modals/ModalContainer.vue";
|
||||
import { colorProp, prop, setting, slot } from "@/libs/story/story-param";
|
||||
import { boolean, text } from "@/libs/story/story-widget";
|
||||
</script>
|
||||
21
@xen-orchestra/lite/src/stories/modals/ui-modal.story.md
Normal file
21
@xen-orchestra/lite/src/stories/modals/ui-modal.story.md
Normal file
@@ -0,0 +1,21 @@
|
||||
This component only handle the modal backdrop and content positioning.
|
||||
|
||||
You can use any pre-made layouts, create your own or use the `ModalContainer` component.
|
||||
|
||||
It is meant to be used with `useModal` composable.
|
||||
|
||||
```vue-template
|
||||
<button @click="open">Delete all items</button>
|
||||
|
||||
<UiModal v-model="isOpen">
|
||||
<ModalContainer...>
|
||||
<!-- <ConfirmModalLayout ...> (Or you can use a pre-made layout) -->
|
||||
</UiModal>
|
||||
```
|
||||
|
||||
```vue-script
|
||||
import { faRemove } from "@fortawesome/free-solid-svg-icons";
|
||||
import { useModal } from "@composable/modal.composable";
|
||||
|
||||
const { open, close, isOpen } = useModal().
|
||||
```
|
||||
24
@xen-orchestra/lite/src/stories/modals/ui-modal.story.vue
Normal file
24
@xen-orchestra/lite/src/stories/modals/ui-modal.story.vue
Normal file
@@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<ComponentStory
|
||||
:params="[
|
||||
model()
|
||||
.required()
|
||||
.type('boolean')
|
||||
.help('Whether the modal is opened or not'),
|
||||
colorProp().ctx(),
|
||||
slot().help('Place your ModalContainer here'),
|
||||
]"
|
||||
>
|
||||
<button type="button" @click="open">Open modal</button>
|
||||
<UiModal v-model="isOpen" />
|
||||
</ComponentStory>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import ComponentStory from "@/components/component-story/ComponentStory.vue";
|
||||
import UiModal from "@/components/ui/modals/UiModal.vue";
|
||||
import useModal from "@/composables/modal.composable";
|
||||
import { colorProp, model, slot } from "@/libs/story/story-param";
|
||||
|
||||
const { isOpen, open } = useModal();
|
||||
</script>
|
||||
@@ -2,9 +2,9 @@
|
||||
<ComponentStory
|
||||
:params="[
|
||||
prop('state')
|
||||
.enum(...Object.values(POWER_STATE))
|
||||
.enum(...Object.values(VM_POWER_STATE))
|
||||
.required()
|
||||
.preset(POWER_STATE.RUNNING)
|
||||
.preset(VM_POWER_STATE.RUNNING)
|
||||
.widget(),
|
||||
]"
|
||||
v-slot="{ properties }"
|
||||
@@ -17,7 +17,7 @@
|
||||
import PowerStateIcon from "@/components/PowerStateIcon.vue";
|
||||
import ComponentStory from "@/components/component-story/ComponentStory.vue";
|
||||
import { prop } from "@/libs/story/story-param";
|
||||
import { POWER_STATE } from "@/libs/xen-api/xen-api.utils";
|
||||
import { VM_POWER_STATE } from "@/libs/xen-api/xen-api.enums";
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped></style>
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
```vue-template
|
||||
<button @click="open">Delete all items</button>
|
||||
|
||||
<UiModal v-if="isOpen" @close="close" :icon="faRemove">
|
||||
<template #title>You are about to delete 12 items</template>
|
||||
<template #subtitle>They'll be gone forever</template>
|
||||
<template #buttons>
|
||||
<UiButton @click="delete" color="error">Yes, delete</UiButton>
|
||||
<UiButton @click="close">Cancel</UiButton>
|
||||
</template>
|
||||
</UiModal>
|
||||
```
|
||||
|
||||
```vue-script
|
||||
import { faRemove } from "@fortawesome/free-solid-svg-icons";
|
||||
import { useModal } from "@composable/modal.composable";
|
||||
|
||||
const { open, close, isOpen } = useModal().
|
||||
```
|
||||
@@ -1 +1,3 @@
|
||||
export type Color = "info" | "error" | "warning" | "success";
|
||||
|
||||
export type MaybeArray<T> = T | T[];
|
||||
|
||||
@@ -47,3 +47,7 @@ export const IK_BUTTON_GROUP_TRANSPARENT = Symbol() as InjectionKey<
|
||||
export const IK_CARD_GROUP_VERTICAL = Symbol() as InjectionKey<boolean>;
|
||||
|
||||
export const IK_INPUT_ID = Symbol() as InjectionKey<ComputedRef<string>>;
|
||||
|
||||
export const IK_MODAL_CLOSE = Symbol() as InjectionKey<() => void>;
|
||||
|
||||
export const IK_MODAL_NESTED = Symbol() as InjectionKey<boolean>;
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import type {
|
||||
RawObjectType,
|
||||
XenApiHost,
|
||||
XenApiMessage,
|
||||
XenApiNetwork,
|
||||
XenApiSr,
|
||||
XenApiVdi,
|
||||
XenApiVm,
|
||||
} from "@/libs/xen-api/xen-api.types";
|
||||
|
||||
export type XenApiAlarmType =
|
||||
@@ -21,3 +26,48 @@ export interface XenApiAlarm<RelationType extends RawObjectType>
|
||||
triggerLevel: number;
|
||||
type: XenApiAlarmType;
|
||||
}
|
||||
|
||||
export type XenApiPatch = {
|
||||
$id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
license: string;
|
||||
release: string;
|
||||
size: number;
|
||||
url: string;
|
||||
version: string;
|
||||
changelog: {
|
||||
date: number;
|
||||
description: string;
|
||||
author: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type XenApiMigrationToken = Record<string, string>;
|
||||
|
||||
export type XenApiMigrationParams = [
|
||||
XenApiVm["$ref"],
|
||||
XenApiMigrationToken,
|
||||
boolean,
|
||||
Record<XenApiVdi["$ref"], XenApiSr["$ref"]>,
|
||||
Record<any, never>,
|
||||
{ force: "true" | "false" },
|
||||
];
|
||||
|
||||
export type VmRefsWithPowerState = Record<
|
||||
XenApiVm["$ref"],
|
||||
XenApiVm["power_state"]
|
||||
>;
|
||||
|
||||
export type VmRefsWithNameLabel = Record<XenApiVm["$ref"], string>;
|
||||
|
||||
export type VmMigrationData = {
|
||||
destinationHost: XenApiHost["$ref"];
|
||||
migrationNetwork: XenApiNetwork["$ref"];
|
||||
destinationSr: XenApiSr["$ref"];
|
||||
vdisMap: Record<XenApiVdi["$ref"], XenApiSr["$ref"]>;
|
||||
force?: boolean;
|
||||
bypassAssert?: boolean;
|
||||
};
|
||||
|
||||
export type VmRefsWithMigration = Record<XenApiVm["$ref"], VmMigrationData>;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<UiCardGroup>
|
||||
<PoolDashboardStatus />
|
||||
<PoolDashboardAlarms class="alarms" />
|
||||
<UiCardComingSoon title="Patches" />
|
||||
<PoolDashboardHostsPatches />
|
||||
</UiCardGroup>
|
||||
<UiCardGroup>
|
||||
<UiCardGroup>
|
||||
@@ -36,12 +36,12 @@ import PoolDashboardTasks from "@/components/pool/dashboard/PoolDashboardTasks.v
|
||||
import PoolCpuUsageChart from "@/components/pool/dashboard/cpuUsage/PoolCpuUsageChart.vue";
|
||||
import PoolDashboardCpuProvisioning from "@/components/pool/dashboard/PoolDashboardCpuProvisioning.vue";
|
||||
import PoolDashboardCpuUsage from "@/components/pool/dashboard/PoolDashboardCpuUsage.vue";
|
||||
import PoolDashboardHostsPatches from "@/components/pool/dashboard/PoolDashboardHostsPatches.vue";
|
||||
import PoolDashboardNetworkChart from "@/components/pool/dashboard/PoolDashboardNetworkChart.vue";
|
||||
import PoolDashboardRamUsage from "@/components/pool/dashboard/PoolDashboardRamUsage.vue";
|
||||
import PoolDashboardStatus from "@/components/pool/dashboard/PoolDashboardStatus.vue";
|
||||
import PoolDashboardStorageUsage from "@/components/pool/dashboard/PoolDashboardStorageUsage.vue";
|
||||
import PoolDashboardRamUsageChart from "@/components/pool/dashboard/ramUsage/PoolRamUsage.vue";
|
||||
import UiCardComingSoon from "@/components/ui/UiCardComingSoon.vue";
|
||||
import UiCardGroup from "@/components/ui/UiCardGroup.vue";
|
||||
import { useHostCollection } from "@/stores/xen-api/host.store";
|
||||
import { useVmCollection } from "@/stores/xen-api/vm.store";
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
:available-filters="filters"
|
||||
:available-sorts="filters"
|
||||
:collection="vms"
|
||||
id-property="$ref"
|
||||
>
|
||||
<template #head-row>
|
||||
<ColumnHeader :icon="faPowerOff" />
|
||||
@@ -23,7 +22,15 @@
|
||||
<td>
|
||||
<PowerStateIcon :state="vm.power_state" />
|
||||
</td>
|
||||
<td>{{ vm.name_label }}</td>
|
||||
<td>
|
||||
<div class="vm-name">
|
||||
<UiSpinner
|
||||
v-if="isMigrating(vm)"
|
||||
v-tooltip="'This VM is being migrated'"
|
||||
/>
|
||||
{{ vm.name_label }}
|
||||
</div>
|
||||
</td>
|
||||
<td>{{ vm.name_description }}</td>
|
||||
</template>
|
||||
</CollectionTable>
|
||||
@@ -36,11 +43,14 @@ import ColumnHeader from "@/components/ColumnHeader.vue";
|
||||
import PowerStateIcon from "@/components/PowerStateIcon.vue";
|
||||
import UiCard from "@/components/ui/UiCard.vue";
|
||||
import UiCardTitle from "@/components/ui/UiCardTitle.vue";
|
||||
import UiSpinner from "@/components/ui/UiSpinner.vue";
|
||||
import VmsActionsBar from "@/components/vm/VmsActionsBar.vue";
|
||||
import { useVmCollection } from "@/stores/xen-api/vm.store";
|
||||
import { POWER_STATE } from "@/libs/xen-api/xen-api.utils";
|
||||
import { vTooltip } from "@/directives/tooltip.directive";
|
||||
import { VM_OPERATION, VM_POWER_STATE } from "@/libs/xen-api/xen-api.enums";
|
||||
import type { XenApiVm } from "@/libs/xen-api/xen-api.types";
|
||||
import { usePageTitleStore } from "@/stores/page-title.store";
|
||||
import { useUiStore } from "@/stores/ui.store";
|
||||
import { useVmCollection } from "@/stores/xen-api/vm.store";
|
||||
import type { Filters } from "@/types/filter";
|
||||
import { faPowerOff } from "@fortawesome/free-solid-svg-icons";
|
||||
import { storeToRefs } from "pinia";
|
||||
@@ -52,7 +62,7 @@ const { t } = useI18n();
|
||||
const titleStore = usePageTitleStore();
|
||||
titleStore.setTitle(t("vms"));
|
||||
|
||||
const { records: vms } = useVmCollection();
|
||||
const { records: vms, isOperationPending } = useVmCollection();
|
||||
const { isMobile, isDesktop } = storeToRefs(useUiStore());
|
||||
|
||||
const filters: Filters = {
|
||||
@@ -62,17 +72,29 @@ const filters: Filters = {
|
||||
label: t("power-state"),
|
||||
icon: faPowerOff,
|
||||
type: "enum",
|
||||
choices: Object.values(POWER_STATE),
|
||||
choices: Object.values(VM_POWER_STATE),
|
||||
},
|
||||
};
|
||||
|
||||
const selectedVmsRefs = ref([]);
|
||||
|
||||
titleStore.setCount(() => selectedVmsRefs.value.length);
|
||||
|
||||
const isMigrating = (vm: XenApiVm) =>
|
||||
isOperationPending(vm, [
|
||||
VM_OPERATION.POOL_MIGRATE,
|
||||
VM_OPERATION.MIGRATE_SEND,
|
||||
]);
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.pool-vms-view {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.vm-name {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -110,19 +110,19 @@ const template = computed(() => {
|
||||
]"
|
||||
>
|
||||
<${componentName} v-bind="properties"${
|
||||
slotsNames.length > 0
|
||||
? `>\n ${slotsNames
|
||||
.map((name) =>
|
||||
name === "default"
|
||||
? `{{ settings.${camel(name)}SlotContent }}`
|
||||
: `<template #${name}>{{ settings.${camel(
|
||||
name
|
||||
)}SlotContent }}</template>`
|
||||
)
|
||||
.join("\n ")}
|
||||
slotsNames.length > 0
|
||||
? `>\n ${slotsNames
|
||||
.map((name) =>
|
||||
name === "default"
|
||||
? `{{ settings.${camel(name)}SlotContent }}`
|
||||
: `<template #${name}>{{ settings.${camel(
|
||||
name
|
||||
)}SlotContent }}</template>`
|
||||
)
|
||||
.join("\n ")}
|
||||
</${componentName}>`
|
||||
: ` />`
|
||||
}
|
||||
: ` />`
|
||||
}
|
||||
</ComponentStory>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import UiSpinner from "@/components/ui/UiSpinner.vue";
|
||||
import { useConsoleCollection } from "@/stores/xen-api/console.store";
|
||||
import { useVmCollection } from "@/stores/xen-api/vm.store";
|
||||
import type { XenApiVm } from "@/libs/xen-api/xen-api.types";
|
||||
import { POWER_STATE, VM_OPERATION } from "@/libs/xen-api/xen-api.utils";
|
||||
import { VM_POWER_STATE, VM_OPERATION } from "@/libs/xen-api/xen-api.enums";
|
||||
import { usePageTitleStore } from "@/stores/page-title.store";
|
||||
import { useUiStore } from "@/stores/ui.store";
|
||||
import { faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
|
||||
@@ -77,7 +77,7 @@ const hasError = computed(() => hasVmError.value || hasConsoleError.value);
|
||||
const vm = computed(() => getVmByUuid(route.params.uuid as XenApiVm["uuid"]));
|
||||
|
||||
const isVmRunning = computed(
|
||||
() => vm.value?.power_state === POWER_STATE.RUNNING
|
||||
() => vm.value?.power_state === VM_POWER_STATE.RUNNING
|
||||
);
|
||||
|
||||
const vmConsole = computed(() => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@xen-orchestra/proxy",
|
||||
"version": "0.26.33",
|
||||
"version": "0.26.34",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"description": "XO Proxy used to remotely execute backup jobs",
|
||||
"keywords": [
|
||||
@@ -32,7 +32,7 @@
|
||||
"@vates/decorate-with": "^2.0.0",
|
||||
"@vates/disposable": "^0.1.4",
|
||||
"@xen-orchestra/async-map": "^0.1.2",
|
||||
"@xen-orchestra/backups": "^0.42.0",
|
||||
"@xen-orchestra/backups": "^0.42.1",
|
||||
"@xen-orchestra/fs": "^4.1.0",
|
||||
"@xen-orchestra/log": "^0.6.0",
|
||||
"@xen-orchestra/mixin": "^0.1.0",
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
"pw": "^0.0.4",
|
||||
"xdg-basedir": "^4.0.0",
|
||||
"xo-lib": "^0.11.1",
|
||||
"xo-vmdk-to-vhd": "^2.5.5"
|
||||
"xo-vmdk-to-vhd": "^2.5.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"@xen-orchestra/log": "^0.6.0",
|
||||
"lodash": "^4.17.21",
|
||||
"node-fetch": "^3.3.0",
|
||||
"vhd-lib": "^4.5.0"
|
||||
"vhd-lib": "^4.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
"json-rpc-protocol": "^0.13.2",
|
||||
"lodash": "^4.17.15",
|
||||
"promise-toolbox": "^0.21.0",
|
||||
"vhd-lib": "^4.5.0",
|
||||
"vhd-lib": "^4.6.0",
|
||||
"xo-common": "^0.8.0"
|
||||
},
|
||||
"private": false,
|
||||
|
||||
@@ -9,7 +9,7 @@ import peekFooterFromStream from 'vhd-lib/peekFooterFromVhdStream.js'
|
||||
|
||||
import AggregateError from './_AggregateError.mjs'
|
||||
|
||||
const { warn } = createLogger('xo:xapi:sr')
|
||||
const { error, warn } = createLogger('xo:xapi:sr')
|
||||
|
||||
const OC_MAINTENANCE = 'xo:maintenanceState'
|
||||
|
||||
@@ -146,6 +146,22 @@ class Sr {
|
||||
}
|
||||
}
|
||||
|
||||
async reclaimSpace(srRef) {
|
||||
const result = await this.call('host.call_plugin', this.pool.master, 'trim', 'do_trim', {
|
||||
sr_uuid: await this.getField('SR', srRef, 'uuid'),
|
||||
})
|
||||
|
||||
// Error example:
|
||||
// <?xml version="1.0" ?><trim_response><key_value_pair><key>errcode</key><value>TrimException</value></key_value_pair><key_value_pair><key>errmsg</key><value>blkdiscard: /dev/VG_XenStorage-f5775872-b5e7-98e5-488a-7194efdaf8f6/f5775872-b5e7-98e5-488a-7194efdaf8f6_trim_lv: BLKDISCARD ioctl failed: Operation not supported</value></key_value_pair></trim_response>
|
||||
const errMatch = result?.match(/<key>errcode<\/key><value>(.*?)<\/value>.*<key>errmsg<\/key><value>(.*?)<\/value>/)
|
||||
if (errMatch) {
|
||||
error(result)
|
||||
const err = new Error(errMatch[2])
|
||||
err.code = errMatch[1]
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
async importVdi(
|
||||
$defer,
|
||||
ref,
|
||||
|
||||
636
AGPL.txt
Normal file
636
AGPL.txt
Normal file
@@ -0,0 +1,636 @@
|
||||
# Copyright (C) 2012 - 2023 VATES SAS
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
35
CHANGELOG.md
35
CHANGELOG.md
@@ -1,5 +1,40 @@
|
||||
# ChangeLog
|
||||
|
||||
## **next**
|
||||
|
||||
### Enhancements
|
||||
|
||||
- [Netbox] Don't delete VMs that have been created manually in XO-synced cluster [Forum#7639](https://xcp-ng.org/forum/topic/7639) (PR [#7008](https://github.com/vatesfr/xen-orchestra/pull/7008))
|
||||
- [Kubernetes] _Search domains_ field is now optional [#7028](https://github.com/vatesfr/xen-orchestra/pull/7028)
|
||||
- [Patches] Support new XenServer Updates system. See [our documentation](https://xen-orchestra.com/docs/updater.html#xenserver-updates). (PR [#7044](https://github.com/vatesfr/xen-orchestra/pull/7044))
|
||||
- [REST API] Hosts' audit and system logs can be downloaded [#3968](https://github.com/vatesfr/xen-orchestra/issues/3968) (PR [#7048](https://github.com/vatesfr/xen-orchestra/pull/7048))
|
||||
- [Host/Advanced] New button to download system logs [#3968](https://github.com/vatesfr/xen-orchestra/issues/3968) (PR [#7048](https://github.com/vatesfr/xen-orchestra/pull/7048))
|
||||
- [Home/Hosts, Pools] Display host brand and version (PR [#7027](https://github.com/vatesfr/xen-orchestra/pull/7027))
|
||||
- [SR] Ability to reclaim space [#1204](https://github.com/vatesfr/xen-orchestra/issues/1204) (PR [#7054](https://github.com/vatesfr/xen-orchestra/pull/7054))
|
||||
- [XOA] New button to restart XO Server directly from the UI (PR [#7056](https://github.com/vatesfr/xen-orchestra/pull/7056))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
- [Backup/Restore] Fix `Cannot read properties of undefined (reading 'id')` error when restoring via an XO Proxy (PR [#7026](https://github.com/vatesfr/xen-orchestra/pull/7026))
|
||||
- [Google/GitHub Auth] Fix `Internal Server Error` (xo-server: `Cannot read properties of undefined (reading 'id')`) when logging in with Google or GitHub [Forum#7729](https://xcp-ng.org/forum/topic/7729) (PRs [#7031](https://github.com/vatesfr/xen-orchestra/pull/7031) [#7032](https://github.com/vatesfr/xen-orchestra/pull/7032))
|
||||
- [Jobs] Fix schedules not being displayed on first load [#6968](https://github.com/vatesfr/xen-orchestra/issues/6968) (PR [#7034](https://github.com/vatesfr/xen-orchestra/pull/7034))
|
||||
- [OVA Export] Fix support of disks with more than 8.2GiB of content (PR [#7047](https://github.com/vatesfr/xen-orchestra/pull/7047))
|
||||
- [Backup] Fix `VHDFile implementation is not compatible with encrypted remote` when using VHD directory with encryption (PR [#7045](https://github.com/vatesfr/xen-orchestra/pull/7045))
|
||||
- [Backup/Mirror] Fix `xo:fs:local WARN lock compromised` when mirroring a Backup Repository to a local/NFS/SMB repository ([#7043](https://github.com/vatesfr/xen-orchestra/pull/7043))
|
||||
- [Ova import] Fix importing VM with collision in disk position (PR [#7051](https://github.com/vatesfr/xen-orchestra/pull/7051)) (issue [7046](https://github.com/vatesfr/xen-orchestra/issues/7046))
|
||||
|
||||
### Released packages
|
||||
|
||||
- vhd-lib 4.6.0
|
||||
- @xen-orchestra/backups 0.42.1
|
||||
- @xen-orchestra/proxy 0.26.34
|
||||
- xo-vmdk-to-vhd 2.5.6
|
||||
- xo-server 5.123.0
|
||||
- xo-server-auth-github 0.3.1
|
||||
- xo-server-auth-google 0.3.1
|
||||
- xo-server-netbox 1.3.0
|
||||
- xo-web 5.125.0
|
||||
|
||||
## **5.86.1** (2023-09-07)
|
||||
|
||||
<img id="latest" src="https://badgen.net/badge/channel/latest/yellow" alt="Channel: latest" />
|
||||
|
||||
@@ -7,13 +7,12 @@
|
||||
|
||||
> Users must be able to say: “Nice enhancement, I'm eager to test it”
|
||||
|
||||
- [Netbox] Don't delete VMs that have been created manually in XO-synced cluster [Forum#7639](https://xcp-ng.org/forum/topic/7639) (PR [#7008](https://github.com/vatesfr/xen-orchestra/pull/7008))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
||||
|
||||
- [Backup/Restore] Fix `Cannot read properties of undefined (reading 'id')` error when restoring via an XO Proxy (PR [#7026](https://github.com/vatesfr/xen-orchestra/pull/7026))
|
||||
- [Backup/Mirror] Fix backup report not being sent (PR [#7049](https://github.com/vatesfr/xen-orchestra/pull/7049))
|
||||
- [New VM] Only add MBR to cloud-init drive on Windows VMs to avoid booting issues (e.g. with Talos) (PR [#7050](https://github.com/vatesfr/xen-orchestra/pull/7050))
|
||||
|
||||
### Packages to release
|
||||
|
||||
@@ -31,7 +30,7 @@
|
||||
|
||||
<!--packages-start-->
|
||||
|
||||
- xo-server-backup-reports patch
|
||||
- xo-server patch
|
||||
- xo-server-netbox minor
|
||||
|
||||
<!--packages-end-->
|
||||
|
||||
7
ISC.txt
Normal file
7
ISC.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
ISC License
|
||||
|
||||
Copyright 2012 - 2023 VATES SAS
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
90
LICENSE.md
Normal file
90
LICENSE.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# LICENSE INFORMATION
|
||||
|
||||
Vates SAS develops and releases the Xen Orchestra suite of components mostly under the (A)GPL v3. The other license used is the ISC.
|
||||
(A)GPL v3 may be found here: https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
ISC License may be found here: https://www.isc.org/licenses/
|
||||
The texts of the two licenses are inserted at the root of this repo.
|
||||
Below is the list of the various components and their corresponding licenses, AGPL or ISC.
|
||||
|
||||
- @xen-orchestra/audit-core - AGPL-3.0-or-later
|
||||
- @xen-orchestra/babel-config - AGPL-3.0-or-later
|
||||
- @xen-orchestra/backups - AGPL-3.0-or-later
|
||||
- @xen-orchestra/backups-cli - AGPL-3.0-or-later
|
||||
- @xen-orchestra/cr-seed-cli - AGPL-3.0-or-later
|
||||
- @xen-orchestra/fs - AGPL-3.0-or-later
|
||||
- @xen-orchestra/lite - AGPL-3.0-or-later
|
||||
- @xen-orchestra/mixins - AGPL-3.0-or-later
|
||||
- @xen-orchestra/proxy - AGPL-3.0-or-later
|
||||
- @xen-orchestra/proxy-cli - AGPL-3.0-or-later
|
||||
- @xen-orchestra/upload-ova - AGPL-3.0-or-later
|
||||
- @xen-orchestra/xapi - AGPL-3.0-or-later
|
||||
- vhd-lib - AGPL-3.0-or-later
|
||||
- xo-acl-resolver - AGPL-3.0-or-later
|
||||
- xo-cli - AGPL-3.0-or-later
|
||||
- xo-collection - AGPL-3.0-or-later
|
||||
- xo-common - AGPL-3.0-or-later
|
||||
- xo-import-servers-csv - AGPL-3.0-or-later
|
||||
- xo-lib - AGPL-3.0-or-later
|
||||
- xo-remote-parser - AGPL-3.0-or-later
|
||||
- xo-server - AGPL-3.0-or-later
|
||||
- xo-server-audit - AGPL-3.0-or-later
|
||||
- xo-server-auth-github - AGPL-3.0-or-later
|
||||
- xo-server-auth-google - AGPL-3.0-or-later
|
||||
- xo-server-auth-ldap - AGPL-3.0-or-later
|
||||
- xo-server-auth-oidc - AGPL-3.0-or-later
|
||||
- xo-server-auth-saml - AGPL-3.0-or-later
|
||||
- xo-server-backup-reports - AGPL-3.0-or-later
|
||||
- xo-server-load-balancer - AGPL-3.0-or-later
|
||||
- xo-server-netbox - AGPL-3.0-or-later
|
||||
- xo-server-perf-alert - AGPL-3.0-or-later
|
||||
- xo-server-sdn-controller - AGPL-3.0-or-later
|
||||
- xo-server-test - AGPL-3.0-or-later
|
||||
- xo-server-test-plugin - AGPL-3.0-or-later
|
||||
- xo-server-transport-email - AGPL-3.0-or-later
|
||||
- xo-server-transport-icinga2 - AGPL-3.0-or-later
|
||||
- xo-server-transport-nagios - AGPL-3.0-or-later
|
||||
- xo-server-transport-slack - AGPL-3.0-or-later
|
||||
- xo-server-transport-xmpp - AGPL-3.0-or-later
|
||||
- xo-server-usage-report - AGPL-3.0-or-later
|
||||
- xo-server-web-hooks - AGPL-3.0-or-later
|
||||
- xo-vmdk-to-vhd - AGPL-3.0-or-later
|
||||
- xo-web - AGPL-3.0-or-later
|
||||
|
||||
- @vates/async-each - ISC
|
||||
- @vates/cached-dns.lookup - ISC
|
||||
- @vates/coalesce-calls - ISC
|
||||
- @vates/compose - ISC
|
||||
- @vates/decorate-with - ISC
|
||||
- @vates/diff - ISC
|
||||
- @vates/disposable - ISC
|
||||
- @vates/event-listeners-manager - ISC
|
||||
- @vates/fuse-vhd - ISC
|
||||
- @vates/multi-key-map - ISC
|
||||
- @vates/nbd-client - ISC
|
||||
- @vates/node-vsphere-soap - MIT
|
||||
- @vates/otp - ISC
|
||||
- @vates/parse-duration - ISC
|
||||
- @vates/predicates - ISC
|
||||
- @vates/read-chunk - ISC
|
||||
- @vates/stream-reader - ISC
|
||||
- @vates/task - ISC
|
||||
- @vates/toggle-scripts - ISC
|
||||
- @xen-orchestra/async-map - ISC
|
||||
- @xen-orchestra/cron - ISC
|
||||
- @xen-orchestra/defined - ISC
|
||||
- @xen-orchestra/emit-async - ISC
|
||||
- @xen-orchestra/cron - ISC
|
||||
- @xen-orchestra/defined - ISC
|
||||
- @xen-orchestra/emit-async - ISC
|
||||
- @xen-orchestra/log - ISC
|
||||
- @xen-orchestra/mixin - ISC
|
||||
- @xen-orchestra/openflow - ISC
|
||||
- @xen-orchestra/self-signed - ISC
|
||||
- @xen-orchestra/template - ISC
|
||||
- complex-matcher - ISC
|
||||
- value-matcher - ISC
|
||||
- vhd-cli - ISC
|
||||
- xapi-explore-sr - ISC
|
||||
- xen-api - ISC
|
||||
- xapi-explore-sr - ISC
|
||||
- xen-api - ISC
|
||||
BIN
docs/assets/auth-github-form.png
Normal file
BIN
docs/assets/auth-github-form.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 65 KiB |
BIN
docs/assets/auth-github-secret.png
Normal file
BIN
docs/assets/auth-github-secret.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 35 KiB |
BIN
docs/assets/xs-client-id-download.png
Normal file
BIN
docs/assets/xs-client-id-download.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
BIN
docs/assets/xs-client-id-upload.png
Normal file
BIN
docs/assets/xs-client-id-upload.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.3 KiB |
@@ -654,7 +654,7 @@ List of the VMs with more than the recommended amount of snapshots (3). There is
|
||||
|
||||
### Duplicated MAC addresses
|
||||
|
||||
Machines with the same MAC addresses on a network will result in unexpected behavior if they run simultaneously.
|
||||
Machines with the same MAC addresses on a network will result in unexpected behavior if they run simultaneously.
|
||||
|
||||
### Guest Tools status
|
||||
|
||||
|
||||
@@ -125,3 +125,21 @@ If you can't fetch updates, perform a few checks from your XOA:
|
||||
- if not, check your `/etc/resolv.conf` file and modify it if necessary (give a correct DNS server)
|
||||
- use `ifconfig` to check your network configuration
|
||||
- check your firewall(s) and allow XOA to reach xen-orchestra.com (port 443)
|
||||
|
||||
## XenServer Updates
|
||||
|
||||
Starting September 2023, XenServer Updates require authentication:
|
||||
|
||||
1. Make sure your XenServer hosts have [the proper licenses](https://docs.xenserver.com/en-us/citrix-hypervisor/overview-licensing.html)
|
||||
|
||||
2. Go to any XenServer Update URL like [this one](https://support.citrix.com/article/CTX277443/hotfix-xs81e006-for-citrix-hypervisor-81) and log in to check that your account has permissions to download updates. You should see a "Download" button.
|
||||
|
||||
3. Go to this URL: [https://support.citrix.com/xencenterclientiddownload](https://support.citrix.com/xencenterclientiddownload) and click "Download Client ID"
|
||||
|
||||

|
||||
|
||||
4. In Xen Orchestra, go to your User Settings page (bottom left-hand corner) and upload the file `xencenter_client_id.json` you just downloaded from the "XenServer Client ID" section
|
||||
|
||||

|
||||
|
||||
5. Go to a pool's "Patches" page. You can now install XenServer Updates. If you get a `LICENCE_RESTRICTION` error, it means that [you're missing XenServer licenses on your hosts](https://docs.xenserver.com/en-us/citrix-hypervisor/overview-licensing.html).
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user