Copilot commented on code in PR #13907:
URL: https://github.com/apache/cloudstack/pull/13907#discussion_r3802514671
##########
ui/src/core/lazy_lib/icons_use.js:
##########
@@ -182,6 +182,7 @@ import {
UserSwitchOutlined,
UploadOutlined,
VerticalAlignBottomOutlined,
+ VerticalAlignMiddleOutlined,
VerticalAlignTopOutlined,
VerticalAlignMiddleOutlined,
WarningOutlined,
Review Comment:
`VerticalAlignMiddleOutlined` is imported twice in this file, which will
cause a duplicate identifier error during the UI build. Remove one of the
duplicate imports.
This issue also appears on line 361 of the same file.
##########
ui/src/views/compute/AddInstanceBootGroupMember.vue:
##########
@@ -0,0 +1,168 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+<template>
+ <div class="form-layout" v-ctrl-enter="handleSubmit">
+ <a-form
+ :ref="formRef"
+ :model="form"
+ :rules="rules"
+ :loading="loading"
+ layout="vertical"
+ @finish="handleSubmit">
+ <a-form-item name="membertype" ref="membertype">
+ <template #label>
+ <tooltip-label :title="$t('label.member.type')" />
+ </template>
+ <a-radio-group
+ v-model:value="form.membertype"
+ @change="onMemberTypeChange">
+ <a-radio value="VirtualMachine">{{ $t('label.instance') }}</a-radio>
+ <a-radio value="InstanceGroup">{{ $t('label.instance.group')
}}</a-radio>
+ </a-radio-group>
+ </a-form-item>
+ <a-form-item name="virtualmachineid" ref="virtualmachineid"
v-if="form.membertype === 'VirtualMachine'">
+ <template #label>
+ <tooltip-label :title="$t('label.instance')" />
+ </template>
+ <infinite-scroll-select
+ api="listVirtualMachines"
+ :apiParams="{ listall: true }"
+ resourceType="virtualmachine"
+ defaultIcon="desktop-outlined"
+ @change-option-value="onMemberSelected" />
+ </a-form-item>
+ <a-form-item name="instancegroupid" ref="memberid" v-else>
+ <template #label>
+ <tooltip-label :title="$t('label.instance.group')" />
+ </template>
+ <infinite-scroll-select
+ api="listInstanceGroups"
+ :apiParams="{ listall: true }"
+ resourceType="instancegroup"
+ defaultIcon="gold-outlined"
+ @change-option-value="onMemberSelected" />
+ </a-form-item>
+ <a-form-item name="order" ref="order">
+ <template #label>
+ <tooltip-label :title="$t('label.boot.order')"
:tooltip="apiParams.order.description" />
+ </template>
+ <a-input-number
+ v-model:value="form.order"
+ style="width: 100%"
+ :min="0" />
+ </a-form-item>
+ <div :span="24" class="action-button">
+ <a-button @click="closeAction">{{ $t('label.cancel') }}</a-button>
+ <a-button :loading="loading" ref="submit" type="primary"
@click="handleSubmit">{{ $t('label.ok') }}</a-button>
+ </div>
+ </a-form>
+ </div>
+</template>
+
+<script>
+import { ref, reactive, toRaw } from 'vue'
+import { postAPI } from '@/api'
+import TooltipLabel from '@/components/widgets/TooltipLabel'
+import InfiniteScrollSelect from '@/components/widgets/InfiniteScrollSelect'
+
+export default {
+ name: 'AddInstanceBootGroupMember',
+ components: {
+ TooltipLabel,
+ InfiniteScrollSelect
+ },
+ props: {
+ resource: {
+ type: Object,
+ required: true
+ }
+ },
+ inject: ['parentFetchData'],
+ data () {
+ return {
+ loading: false
+ }
+ },
+ beforeCreate () {
+ this.apiParams = this.$getApiParams('addMemberToInstanceBootGroup')
+ },
+ created () {
+ this.initForm()
+ },
+ methods: {
+ initForm () {
+ this.formRef = ref()
+ this.form = reactive({
+ membertype: 'VirtualMachine',
+ order: 0
+ })
+ this.rules = reactive({
+ order: [{ required: true, type: 'number', message:
`${this.$t('message.error.required.input')}` }]
+ })
Review Comment:
The form only validates `order`; users can submit without selecting a
VM/instance group, resulting in an API call with a missing
`virtualmachineid`/`instancegroupid` and a server-side error. Add conditional
validation so the selected member is required based on `membertype`.
##########
core/src/main/java/org/apache/cloudstack/vm/bootgroup/readiness/InstanceReadinessCheckAnswer.java:
##########
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.vm.bootgroup.readiness;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+public class InstanceReadinessCheckAnswer extends Answer {
+
+ public static final String STDOUT = "stdout";
+ public static final String STDERR = "stderr";
+ public static final String EXITCODE = "exitcode";
+
+ public InstanceReadinessCheckAnswer(InstanceReadinessCheckCommand cmd,
boolean result, String details) {
+ super(cmd, result, details);
+ }
+
+ public Map<String, String> getExecutionDetails() {
+ final Map<String, String> executionDetails = new HashMap<>();
+ if (getResult() && StringUtils.isNotEmpty(getDetails())) {
+ final String[] parts = getDetails().split("&&");
+ if (parts.length >= 3) {
+ executionDetails.put(STDOUT, parts[0].trim());
Review Comment:
`getExecutionDetails()` only parses the `stdout&&stderr&&exitcode` format
when `getResult()` is true. However, `executeInVR(...)` typically sets
result=false when the script exits non-zero (e.g. ping failure / port closed),
which means this method will not parse the output and will instead report
exitcode=-1 with a combined stderr blob. Parse whenever the delimiter is
present, regardless of `getResult()`, and fall back only when the expected
delimiter isn't present.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]