fix: fix the resize of magnum cluster

1. specify the request header `OpenStack-API-Version: container-infra latest` to fix response code 406
2. fix the nodes_to_remove according to the api ref document

Change-Id: Ibf5760e88d7772facc4960f0f1f947444dfc227f
This commit is contained in:
xusongfu 2023-02-13 18:00:34 +08:00
parent d5d14d7637
commit 974427c3d8
4 changed files with 21 additions and 15 deletions

View File

@ -1732,6 +1732,8 @@
"Please enter right format key value!": "Please enter right format key value!",
"Please enter right format memory page value!": "Please enter right format memory page value!",
"Please enter right format trait!": "Please enter right format trait!",
"Please enter the correct id": "Please enter the correct id",
"Please enter the server id to be reduced, and separate different id with \",\"": "Please enter the server id to be reduced, and separate different id with \",\"",
"Please fill in the peer network segment and subnet mask of CIDR format, the written subnets should be under the same router, one per line.": "Please fill in the peer network segment and subnet mask of CIDR format, the written subnets should be under the same router, one per line.",
"Please input": "Please input",
"Please input ICMP code(0-255)": "Please input ICMP code(0-255)",

View File

@ -1732,6 +1732,8 @@
"Please enter right format key value!": "请输入正确格式的键值",
"Please enter right format memory page value!": "请输入正确格式的内存页值",
"Please enter right format trait!": "请输入正确格式的特性!",
"Please enter the correct id": "请输入正确的ID",
"Please enter the server id to be reduced, and separate different id with \",\"": "请输入指定缩减的server ID并且不同ID之间用 ',' 分隔",
"Please fill in the peer network segment and subnet mask of CIDR format, the written subnets should be under the same router, one per line.": "请填写CIDR格式的对端网段且填写的网段需在同一个路由下每行一个。",
"Please input": "请输入",
"Please input ICMP code(0-255)": "请输入ICMP编码(0-255)",

View File

@ -116,14 +116,6 @@ export class Resize extends ModalAction {
return ['changed_node_count'];
}
get nodeAddressOptions() {
const { node_addresses = [] } = this.item;
return node_addresses.map((it) => ({
label: it,
value: it,
}));
}
get formItems() {
const { changed_node_count } = this.state;
const { node_count = 0 } = this.item;
@ -162,9 +154,17 @@ export class Resize extends ModalAction {
{
name: 'nodes_to_remove',
label: t('Nodes To Remove'),
type: 'select',
mode: 'multiple',
options: this.nodeAddressOptions,
type: 'textarea',
placeholder: t(
'Please enter the server id to be reduced, and separate different id with ","'
),
validator: (rule, value) => {
const pattern = /^[0-9a-zA-Z]+([0-9a-zA-Z,-][0-9a-zA-Z]+)*$/;
if (value && !pattern.test(value)) {
return Promise.reject(new Error(t('Please enter the correct id')));
}
return Promise.resolve();
},
display: changed_node_count < node_count,
},
];
@ -177,11 +177,11 @@ export class Resize extends ModalAction {
node_count: changed_node_count,
nodes_to_remove: [],
};
if (nodes_to_remove && nodes_to_remove.length) {
body.nodes_to_remove = nodes_to_remove;
if (nodes_to_remove) {
body.nodes_to_remove = nodes_to_remove.split(',');
}
this.store.resize({ id: this.item.id }, body);
return this.store.resize({ id: this.item.id }, body);
};
}

View File

@ -58,7 +58,9 @@ export class ClustersStore extends Base {
@action
async resize({ id }, newbody) {
return this.client.resize(id, newbody);
return this.client.resize(id, newbody, null, {
headers: { 'OpenStack-API-Version': 'container-infra latest' },
});
}
async upgrade({ id }, body) {