fix: the host name should show service.host instead of hypervisor_hostname, pages involved are as follows:

Management Platform: Virtual Machine Manager, Virtual Machine Manager Details, Migration, Live Migration

Change-Id: Icb8b9ed8bb61fb6c715193f1c48bd1c2da45316f
This commit is contained in:
zhangke 2022-03-10 11:28:08 +08:00 committed by Jingwei.Zhang
parent 1dcdd82a06
commit 05b28c9344
7 changed files with 39 additions and 48 deletions

View File

@ -36,7 +36,7 @@ export class HypervisorDetail extends Base {
const info = [ const info = [
{ {
title: t('Hostname'), title: t('Hostname'),
dataIndex: 'hypervisor_hostname', dataIndex: 'service_host',
}, },
{ {
title: t('Type'), title: t('Type'),

View File

@ -46,7 +46,7 @@ export class Hypervisors extends Base {
const columns = [...hypervisorColumns]; const columns = [...hypervisorColumns];
columns[0] = { columns[0] = {
title: t('ID/Name'), title: t('ID/Name'),
dataIndex: 'hypervisor_hostname', dataIndex: 'service_host',
routeName: 'hypervisorDetailAdmin', routeName: 'hypervisorDetailAdmin',
isLink: true, isLink: true,
}; };

View File

@ -22,7 +22,6 @@ import {
isPaused, isPaused,
} from 'resources/instance'; } from 'resources/instance';
import globalHypervisorStore from 'stores/nova/hypervisor'; import globalHypervisorStore from 'stores/nova/hypervisor';
import globalComputeHostStore from 'stores/nova/compute-host';
import { hypervisorColumns, hypervisorFilters } from 'resources/hypervisor'; import { hypervisorColumns, hypervisorFilters } from 'resources/hypervisor';
@inject('rootStore') @inject('rootStore')
@ -36,7 +35,6 @@ export default class LiveMigrate extends ModalAction {
this.store = globalServerStore; this.store = globalServerStore;
this.hypervisorStore = globalHypervisorStore; this.hypervisorStore = globalHypervisorStore;
this.getHypervisors(); this.getHypervisors();
this.getComputeHosts();
} }
get name() { get name() {
@ -61,26 +59,13 @@ export default class LiveMigrate extends ModalAction {
return it.hypervisor_type !== 'ironic'; return it.hypervisor_type !== 'ironic';
}) })
.map((it) => { .map((it) => {
const computeHost = this.computeHosts.find(
(host) => host.host === it.hypervisor_hostname
);
return { return {
...it, ...it,
key: it.id, key: it.id,
name: it.hypervisor_hostname,
computeHost,
}; };
}); });
} }
getComputeHosts() {
globalComputeHostStore.fetchList({ binary: 'nova-compute' });
}
get computeHosts() {
return globalComputeHostStore.list.data || [];
}
get tips() { get tips() {
return t( return t(
'Choose a host to live migrate instance to. If not selected, the scheduler will auto select target host.' 'Choose a host to live migrate instance to. If not selected, the scheduler will auto select target host.'
@ -128,9 +113,7 @@ export default class LiveMigrate extends ModalAction {
label: t('Target Compute Host'), label: t('Target Compute Host'),
type: 'select-table', type: 'select-table',
data: this.hypervisors, data: this.hypervisors,
isLoading: isLoading: this.hypervisorStore.list.isLoading,
this.hypervisorStore.list.isLoading &&
globalComputeHostStore.list.isLoading,
isMulti: false, isMulti: false,
extra: t( extra: t(
'If nova-compute on the host is disabled, it will be forbidden to be selected as the target host.' 'If nova-compute on the host is disabled, it will be forbidden to be selected as the target host.'
@ -138,8 +121,7 @@ export default class LiveMigrate extends ModalAction {
filterParams: hypervisorFilters, filterParams: hypervisorFilters,
columns: hypervisorColumns, columns: hypervisorColumns,
disabledFunc: (record) => disabledFunc: (record) =>
record.name === host || record.service_host === host || record.status !== 'enabled',
(record.computeHost && record.computeHost.status === 'disabled'),
}, },
{ {
name: 'option', name: 'option',
@ -157,7 +139,7 @@ export default class LiveMigrate extends ModalAction {
} = values; } = values;
const { id } = this.item; const { id } = this.item;
const body = { const body = {
host: host ? host.selectedRows[0].name : null, host: host ? host.selectedRows[0].service_host : null,
block_migration: blockMigrate || 'auto', block_migration: blockMigrate || 'auto',
}; };
return this.store.migrateLive({ id, body }); return this.store.migrateLive({ id, body });

View File

@ -22,7 +22,6 @@ import {
isStopped, isStopped,
} from 'resources/instance'; } from 'resources/instance';
import globalHypervisorStore from 'stores/nova/hypervisor'; import globalHypervisorStore from 'stores/nova/hypervisor';
import globalComputeHostStore from 'stores/nova/compute-host';
import { hypervisorColumns, hypervisorFilters } from 'resources/hypervisor'; import { hypervisorColumns, hypervisorFilters } from 'resources/hypervisor';
@inject('rootStore') @inject('rootStore')
@ -36,7 +35,6 @@ export default class LiveMigrate extends ModalAction {
this.store = globalServerStore; this.store = globalServerStore;
this.hypervisorStore = globalHypervisorStore; this.hypervisorStore = globalHypervisorStore;
this.getHypervisors(); this.getHypervisors();
this.getComputeHosts();
} }
get name() { get name() {
@ -61,26 +59,13 @@ export default class LiveMigrate extends ModalAction {
return it.hypervisor_type !== 'ironic'; return it.hypervisor_type !== 'ironic';
}) })
.map((it) => { .map((it) => {
const computeHost = this.computeHosts.find(
(host) => host.host === it.hypervisor_hostname
);
return { return {
...it, ...it,
key: it.id, key: it.id,
name: it.hypervisor_hostname,
computeHost,
}; };
}); });
} }
getComputeHosts() {
globalComputeHostStore.fetchList({ binary: 'nova-compute' });
}
get computeHosts() {
return globalComputeHostStore.list.data || [];
}
get tips() { get tips() {
return t( return t(
'Choose a host to migrate instance to. If not selected, the scheduler will auto select target host.' 'Choose a host to migrate instance to. If not selected, the scheduler will auto select target host.'
@ -125,9 +110,7 @@ export default class LiveMigrate extends ModalAction {
label: t('Target Compute Host'), label: t('Target Compute Host'),
type: 'select-table', type: 'select-table',
data: this.hypervisors, data: this.hypervisors,
isLoading: isLoading: this.hypervisorStore.list.isLoading,
this.hypervisorStore.list.isLoading &&
globalComputeHostStore.list.isLoading,
isMulti: false, isMulti: false,
extra: t( extra: t(
'If nova-compute on the host is disabled, it will be forbidden to be selected as the target host.' 'If nova-compute on the host is disabled, it will be forbidden to be selected as the target host.'
@ -135,8 +118,7 @@ export default class LiveMigrate extends ModalAction {
filterParams: hypervisorFilters, filterParams: hypervisorFilters,
columns: hypervisorColumns, columns: hypervisorColumns,
disabledFunc: (record) => disabledFunc: (record) =>
record.name === host || record.service_host === host || record.status !== 'enabled',
(record.computeHost && record.computeHost.status === 'disabled'),
}, },
]; ];
} }
@ -147,7 +129,7 @@ export default class LiveMigrate extends ModalAction {
let body = null; let body = null;
if (selectedRows.length > 0) { if (selectedRows.length > 0) {
body = { body = {
host: selectedRows[0].name, host: selectedRows[0]?.service_host,
}; };
} }
return this.store.migrate({ id, body }); return this.store.migrate({ id, body });

View File

@ -35,6 +35,24 @@ export class SystemStep extends Base {
this.getServerGroups(); this.getServerGroups();
} }
get hypervisorColumns() {
const columns = [...hypervisorColumns];
columns[0] = {
title: t('Hostname'),
dataIndex: 'hypervisor_hostname',
};
return columns;
}
get hypervisorFilters() {
const columns = [...hypervisorFilters];
columns[0] = {
label: t('Hostname'),
name: 'hypervisor_hostname',
};
return columns;
}
get title() { get title() {
return 'SystemStep'; return 'SystemStep';
} }
@ -283,8 +301,8 @@ export class SystemStep extends Base {
extra: t( extra: t(
'You can manually specify a physical node to create an instance.' 'You can manually specify a physical node to create an instance.'
), ),
columns: hypervisorColumns, columns: this.hypervisorColumns,
filterParams: hypervisorFilters, filterParams: this.hypervisorFilters,
}, },
{ {
name: 'serverGroup', name: 'serverGroup',

View File

@ -19,7 +19,7 @@ import { Tooltip } from 'antd';
export const hypervisorColumns = [ export const hypervisorColumns = [
{ {
title: t('Hostname'), title: t('Hostname'),
dataIndex: 'hypervisor_hostname', dataIndex: 'service_host',
}, },
{ {
title: t('Type'), title: t('Type'),
@ -84,7 +84,7 @@ export const hypervisorColumns = [
export const hypervisorFilters = [ export const hypervisorFilters = [
{ {
label: t('Hostname'), label: t('Hostname'),
name: 'hypervisor_hostname', name: 'service_host',
}, },
{ {
label: t('Type'), label: t('Type'),

View File

@ -34,6 +34,15 @@ export class HypervisorStore extends Base {
return true; return true;
} }
get mapper() {
return (data) => {
return {
...data,
service_host: data?.service?.host || '',
};
};
}
// get mapper() { // get mapper() {
// return (item) => { // return (item) => {
// item.vcpus_used_percent = ((item.vcpus_used / item.vcpus) * 100).toFixed(2); // item.vcpus_used_percent = ((item.vcpus_used / item.vcpus) * 100).toFixed(2);