Introduction

Let user know the total, external, internal network I/O data traffic for individual virtual machine.

Purpose

For now, user can get a external data traffic for a virtual network from virtual router.
As user we also want to know the data traffic for a virtual machine, including external and internal data traffic.

Target Branch

4.2

Feature Specifications

  • Agent manager get and report the total network usage of VM from hypervisor.
  • Agent manager get and report the external network usage of VM from virtual router.
  • store the network network I/O statistics into db
  • analyse the network usage in usage server.
  • update statistics when deployVM, destroyVM, stopVM, migrateVM, rebootVM. startVM(no need), recoverVM(no need), restoreVM, assignVM
  • update statistics when stopRouter, startRouter, rebootRouter, destroyRouter. restartNetwork.

Hypervisors

KVM

Changes

new tables in database

  • cloud.vm_network_statistics
  • cloud_usage.vm_network_statistics
  • cloud_usage.usage_vm_network

changes in cloud-api

  • com.cloud.vm.VmNetworkStats (new)
  • com.cloud.agent.api.VmNetworkStatsEntry (new)
  • com.cloud.agent.api.GetVmNetworkStatsAnswer (new)
  • com.cloud.agent.api.GetVmNetworkStatsCommand (new)
  • com.cloud.agent.api.NetworkUsageAnswer
  • com.cloud.agent.api.NetworkUsageCommand

new classes in cloud-core

  • com.cloud.user.VmNetworkStatisticsVO
  • com.cloud.user.dao.VmNetworkStatisticsDao
  • com.cloud.user.dao.VmNetworkStatisticsDaoImpl

changes in cloud-server

  • com.cloud.network.router.VirtualNetworkApplianceManagerImpl.NetworkUsageTask
  • com.cloud.network.router.VirtualNetworkApplianceManagerImpl.NetworkStatsUpdateTask
  • com.cloud.network.router.VirtualNetworkApplianceManagerImpl.prepareStop
  • com.cloud.network.router.VirtualNetworkApplianceManagerImpl.processStopOrRebootAnswer
  • com.cloud.network.router.VpcVirtualNetworkApplianceManagerImpl
  • com.cloud.configuration.DefaultComponentLibrary.populateDaos
  • com.cloud.vm.VirtualMachineManagerImpl
  • com.cloud.vm.UserVmManager
  • com.cloud.vm.UserVmManagerImpl.finalizeDeployment
  • com.cloud.vm.UserVmManagerImpl.finalizeExpunge
  • com.cloud.user.dao.VmNetworkStatisticsDao (new)
  • com.cloud.user.dao.VmNetworkStatisticsDaoImpl (new)
  • com.cloud.api.commands.GetUsageRecordsCmd
  • com.cloud.upgrade.DatabaseUpgradeChecker
  • com.cloud.upgrade.Upgrade401to402 (new)
  • com.cloud.usage.UsageNetworkVO
  • com.cloud.usage.UsageVmNetworkVO (new)

changes in cloud-plugin-hypervisor-kvm

  • com.cloud.hypervisor.kvm.resource.LibvirtComputingResource.execute(NetworkUsageCommand)
  • com.cloud.hypervisor.kvm.resource.LibvirtComputingResource.execute(GetVmNetworkStatsCommand) (new)

changes in cloud-usage

  • com.cloud.usage.dao.UsageDao
  • com.cloud.usage.dao.UsageDaoImpl
  • com.cloud.usage.dao.UsageVmNetworkDao (new)
  • com.cloud.usage.dao.UsageVmNetworkDaoImpl (new)
  • com.cloud.usage.UsageVmNetworkVO (new)
  • com.cloud.usage.parser.VmNetworkUsageParser (new)
  • com.cloud.usage.UsageTypes
  • com.cloud.usage.UsageManagerImpl.parse(UsageJobVO, long, long)
  • com.cloud.usage.UsageManagerImpl.createVmNetworkHelperEntry (new)

changes in scripts

  • patches/systemvm/debian/config/opt/cloud/bin/netusage.sh
  • patches/systemvm/debian/config/opt/cloud/bin/vpc_netusage.sh

changes in configuration

  • usage/conf/usage-components.xml.in
  • server/test/async-job-component.xml
  • setup/db/db/schema-401to402.sql (new)
  • setup/db/db/schema-401to402-cleanup.sql (new)

UI flow

None.

References

Appendix

  • Appendix A:
  • Appendix B:
  • No labels