Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5104,7 +5104,6 @@ public VmStatsEntry getVmStat(final Connect conn, final String vmName) throws Li
try {
result = dm.qemuAgentCommand(QemuCommand.buildQemuCommand(QemuCommand.AGENT_NETWORK_GET_INTERFACES, null), 2, 0);
if (StringUtils.isNotBlank(result) && !(result.startsWith("error"))) {
LOGGER.debug(dm.getName() + " >> " + result);
JsonArray arrData = (JsonArray) new JsonParser().parse(result).getAsJsonObject().get("return");
for (JsonElement je : arrData) {
JsonElement nicName = je.getAsJsonObject().get("name") == null ? null : je.getAsJsonObject().get("name");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public Answer execute(final GetVmStatsCommand command, final LibvirtComputingRes
}

vmStatsNameMap.put(vmName, statEntry);
} catch (LibvirtException e) {
logger.warn("Can't get vm stats: " + e.toString() + ", continue");
} catch (Exception e) {
logger.warn("Can't get vm stats for [{}], continue", vmName, e);
}
}
return new GetVmStatsAnswer(command, vmStatsNameMap);
Expand Down
44 changes: 21 additions & 23 deletions server/src/main/java/com/cloud/server/StatsCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@
import com.cloud.agent.api.VmStatsEntryBase;
import com.cloud.agent.api.VolumeStatsEntry;
import com.cloud.api.ApiSessionListener;
import com.cloud.api.query.dao.UserVmJoinDao;
import com.cloud.api.query.vo.UserVmJoinVO;
import com.cloud.capacity.CapacityManager;
import com.cloud.cluster.ClusterManager;
import com.cloud.cluster.ClusterManagerListener;
Expand All @@ -127,6 +125,8 @@
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.Network;
import com.cloud.network.as.AutoScaleManager;
import com.cloud.network.dao.NetworkDao;
import com.cloud.network.dao.NetworkVO;
import com.cloud.org.Cluster;
import com.cloud.resource.ResourceManager;
import com.cloud.resource.ResourceState;
Expand Down Expand Up @@ -362,6 +362,8 @@ public String toString() {
@Inject
private NicDao _nicDao;
@Inject
private NetworkDao _networkDao;
@Inject
private VlanDao _vlanDao;
@Inject
private AutoScaleManager _asManager;
Expand All @@ -384,8 +386,6 @@ public String toString() {
VirtualMachineManager virtualMachineManager;
@Inject
AlertManager _alertMgr;
@Inject
protected UserVmJoinDao userVmJoinDao;


private final ConcurrentHashMap<String, ManagementServerHostStats> managementServerHostStats = new ConcurrentHashMap<>();
Expand Down Expand Up @@ -1441,19 +1441,6 @@ protected void runInContext() {
List<HostVO> hosts = _hostDao.search(sc, null);
logger.debug(String.format("VmStatsCollector is running to process VMs across %d UP hosts", hosts.size()));

List<UserVmJoinVO> listL2netVMs = userVmJoinDao.listGuestTypeVMs(Network.GuestType.L2);
Map<Long, List<String>> l2NicMacsByVmId = new HashMap<>();

for (UserVmJoinVO vm : listL2netVMs) {
if (StringUtils.isBlank(vm.getMacAddress())) {
continue;
}
List<String> l2NicMacs = l2NicMacsByVmId.computeIfAbsent(vm.getId(), k -> new ArrayList<>());
if (!l2NicMacs.contains(vm.getMacAddress())) {
l2NicMacs.add(vm.getMacAddress());
}
}

Map<Object, Object> metrics = new HashMap<>();
for (HostVO host : hosts) {
Date timestamp = new Date();
Expand All @@ -1476,14 +1463,25 @@ protected void runInContext() {

Map<String, String> agentNicMap = statsForCurrentIteration.getNicAddrMap();
if (agentNicMap != null) {
List<String> l2NicMacs = l2NicMacsByVmId.get(vmId);
if (CollectionUtils.isNotEmpty(l2NicMacs)) {
for (String macAddress : l2NicMacs) {
NicVO nicVO = _nicDao.findByMacAddress(macAddress);
if (nicVO == null) {
Map<String, String> normalizedAgentNicMap = new HashMap<>();
for (Map.Entry<String, String> entry : agentNicMap.entrySet()) {
if (StringUtils.isNotBlank(entry.getKey())) {
normalizedAgentNicMap.put(StringUtils.lowerCase(entry.getKey()), entry.getValue());
}
}

List<NicVO> nics = _nicDao.listByVmId(vmId);
if (CollectionUtils.isNotEmpty(nics)) {
for (NicVO nicVO : nics) {
NetworkVO network = _networkDao.findById(nicVO.getNetworkId());
if (network == null || network.getGuestType() != Network.GuestType.L2) {
continue;
}
String macAddress = StringUtils.lowerCase(nicVO.getMacAddress());
if (StringUtils.isBlank(macAddress)) {
continue;
}
String guestIpAddress = agentNicMap.get(macAddress);
String guestIpAddress = normalizedAgentNicMap.get(macAddress);
if (StringUtils.equals(nicVO.getIPv4Address(), guestIpAddress)) {
continue;
}
Expand Down
18 changes: 17 additions & 1 deletion ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,32 @@

<script>
import enUS from 'ant-design-vue/lib/locale-provider/en_US'
import koKRSource from 'ant-design-vue/lib/locale-provider/ko_KR'
import { AppDeviceEnquire } from '@/utils/mixin'

const koKR = {
...koKRSource,
Table: {
...koKRSource.Table,
sortTitle: '정렬',
triggerDesc: '내림차순으로 정렬',
triggerAsc: '오름차순으로 정렬',
cancelSort: '정렬 취소'
}
}

export default {
mixins: [AppDeviceEnquire],
data () {
return {
locale: enUS,
configs: {}
}
},
computed: {
locale () {
return this.$i18n.locale === 'ko_KR' ? koKR : enUS
}
},
created () {
window.less.modifyVars(this.$config.theme)
console.log('config and theme applied')
Expand Down
Loading