You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by raja sekhar <ra...@gmail.com> on 2015/08/17 20:42:15 UTC

Usage Records are still generating even VM removed.

Hi All,

The usage records are still generating even if the vm is removed from
cloudstack.
The actual scenario is:
The xenserver host went to alert state and the vms in it are not accessible.
we have removed the vms from backend by updating vm_instance,volume table.
can any one help me what is the exact table to update?
i am using cloudstack 4.2

waiting for your valuable suggestions.


regards,
rajasekhar.

Re: Usage Records are still generating even VM removed.

Posted by raja sekhar <ra...@gmail.com>.
Hi Rajini,

I got this information from db and just did the following commands.when
compared to testvm as you told VM.STOP event is missed.
i updated the stop event manually in  both cloud and usage databases, but
still the usage records are generating, is there any thing i missed?

old records:

mysql> use cloud_usage
mysql> select * from usage_event where resource_name='appserver'\G
*************************** 10. row ***************************
           id: 12104
         type: VM.START
   account_id: 29
      created: 2014-04-11 06:01:46
      zone_id: 1
  resource_id: 311
resource_name: AppServer
  offering_id: 34
  template_id: 257
         size: NULL
resource_type: XenServer
    processed: 1
 virtual_size: NULL
*************************** 11. row ***************************
           id: 12530
         type: VM.START
   account_id: 29
      created: 2014-04-28 15:21:13
      zone_id: 1
  resource_id: 311
resource_name: AppServer
  offering_id: 34
  template_id: 257
         size: NULL
resource_type: XenServer
    processed: 1
 virtual_size: NULL
*************************** 12. row ***************************
           id: 30714
         type: VM.DESTROY
   account_id: 29
      created: 2015-03-17 14:31:24
      zone_id: 1
  resource_id: 311
resource_name: AppServer
  offering_id: 34
  template_id: 257
         size: NULL
resource_type: XenServer
    processed: 1
 virtual_size: NULL

*new updated records:*

mysql> select * from usage_event where resource_name='appserver'\G
*************************** 16. row ***************************
           id: 12104
         type: VM.START
   account_id: 29
      created: 2014-04-11 06:01:46
      zone_id: 1
  resource_id: 311
resource_name: AppServer
  offering_id: 34
  template_id: 257
         size: NULL
resource_type: XenServer
    processed: 1
 virtual_size: NULL
*************************** 17. row ***************************
           id: 12530
         type: VM.STOP
   account_id: 29
      created: 2015-08-21 13:15:10
      zone_id: 1
  resource_id: 311
resource_name: AppServer
  offering_id: 34
  template_id: 257
         size: NULL
resource_type: XenServer
    processed: 1
 virtual_size: NULL
*************************** 18. row ***************************
           id: 30714
         type: VM.DESTROY
   account_id: 29
      created: 2015-08-21 13:15:17
      zone_id: 1
  resource_id: 311
resource_name: AppServer
  offering_id: 34
  template_id: 257
         size: NULL
resource_type: XenServer
    processed: 1
 virtual_size: NULL



Regards,
rajasekhar.



On Wed, Aug 19, 2015 at 11:22 AM, Rajani Karuturi <ra...@apache.org> wrote:

> can you compare events for both the vms using
> select * from usage_event where type like 'VM%' and resource_id in (311,
> 752);
> May be a stop event is missing.
>
> the same table is also present in cloud_usage database. compare the events
> in that table as well.
>
>
> ~Rajani
>
> On Wed, Aug 19, 2015 at 4:42 AM, raja sekhar <ra...@gmail.com>
> wrote:
>
> > Hi Rajani,
> >
> > Thanks for your reply.
> > i have created one testvm and manually destroyed from cloud ui.
> > the db entry in events table is:
> >
> > select * from usage_event where type='VM.DESTROY'\G
> > *************************** 519. row ***************************
> >            id: 36520
> >          type: VM.DESTROY
> >    account_id: 62
> >       created: 2015-07-21 07:53:45
> >       zone_id: 1
> >   resource_id: 752
> > resource_name: testvm
> >   offering_id: 78
> >   template_id: 333
> >          size: NULL
> > resource_type: XenServer
> >     processed: 1
> >  virtual_size: NULL
> >
> > *i compared these entries to my vm:*
> >
> > select * from usage_event where resource_name='appserver'\G
> > *************************** 18. row ***************************
> >            id: 30714
> >          type: VM.DESTROY
> >    account_id: 29
> >       created: 2015-03-17 14:31:24
> >       zone_id: 1
> >   resource_id: 311
> > resource_name: AppServer
> >   offering_id: 34
> >   template_id: 257
> >          size: NULL
> > resource_type: XenServer
> >     processed: 1
> >  virtual_size: NULL
> >
> > *i found that these two tables are same.*
> > *below are the few tables of the vm.*
> > *please suggest me what is the exact table to stop usage records.*
> >
> > select * from cloud_usage where vm_name='AppServer'\G
> > *************************** 1289. row ***************************
> >             id: 679340
> >        zone_id: 1
> >     account_id: 29
> >      domain_id: 12
> >    description: AppServer running time (ServiceOffering: 34) (Template:
> > 257)
> >  usage_display: 24 Hrs
> >     usage_type: 1
> >      raw_usage: 24
> > vm_instance_id: 311
> >        vm_name: AppServer
> >    offering_id: 34
> >    template_id: 257
> >       usage_id: 311
> >           type: XenServer
> >           size: NULL
> >     network_id: NULL
> >     start_date: 2015-08-17 00:00:00
> >       end_date: 2015-08-17 23:59:59
> >   virtual_size: NULL
> >
> > select * from vm_instance where name='appserver'\G
> > *************************** 2. row ***************************
> >                   id: 311
> >                 name: AppServer
> >                 uuid: 0802d513-0bda-43d5-9600-20f705ca1ed7
> >        instance_name: i-29-311-VM
> >                state: Expunging
> >       vm_template_id: 257
> >          guest_os_id: 54
> >  private_mac_address: 02:00:4a:a8:00:04
> >   private_ip_address: 10.10.10.17
> >               pod_id: 1
> >       data_center_id: 1
> >              host_id: NULL
> >         last_host_id: 14
> >             proxy_id: 299
> >    proxy_assign_time: 2013-08-26 21:11:17
> >         vnc_password: uPk1EIH5AmWi+djshYFcg7BtBXVzYHgQ866UT0/nV28=
> >           ha_enabled: 0
> >        limit_cpu_use: 0
> >         update_count: 33
> >          update_time: 2015-03-17 14:32:35
> >              created: 2013-08-23 01:28:39
> >              removed: 2015-08-14 12:57:21
> >                 type: User
> >              vm_type: User
> >           account_id: 29
> >            domain_id: 12
> >  service_offering_id: 34
> >       reservation_id: 99128765-61b1-4e9f-b703-f20715a10a78
> >      hypervisor_type: XenServer
> >     disk_offering_id: NULL
> >                  cpu: NULL
> >                  ram: NULL
> >                owner: 29
> >                speed: 1024
> >            host_name: AppServer
> >         display_name: AppServer
> >        desired_state: NULL
> > dynamically_scalable: 0
> >           display_vm: 1
> >
> > mysql> select * from volumes where instance_id=311\G
> > *************************** 1. row ***************************
> >                         id: 427
> >                 account_id: 29
> >                  domain_id: 12
> >                    pool_id: 208
> >               last_pool_id: NULL
> >                instance_id: 311
> >                  device_id: 0
> >                       name: ROOT-311
> >                       uuid: c253355e-a33c-4590-9b5e-74f7fa0c32cc
> >                       size: 53687091200
> >                     folder: lvm
> >                       path: ed119650-671e-4328-9ff2-2aefaac625a9
> >                     pod_id: 1
> >             data_center_id: 1
> >                 iscsi_name: NULL
> >                    host_ip: NULL
> >                volume_type: ROOT
> >                  pool_type: LVM
> >           disk_offering_id: 34
> >                template_id: 257
> > first_snapshot_backup_uuid: NULL
> >                recreatable: 0
> >                    created: 2013-08-23 01:28:39
> >                   attached: NULL
> >                    updated: 2015-03-17 14:32:35
> >                    removed: 2015-05-03 02:57:00
> >                      state: Destroy
> >                 chain_info: NULL
> >               update_count: 1025
> >                  disk_type: NULL
> >     vm_snapshot_chain_size: NULL
> >                     iso_id: NULL
> >             display_volume: 1
> >                     format: VHD
> >                   min_iops: NULL
> >                   max_iops: NULL
> >
> >
> > regards,
> > rajasekhar.
> >
> > On Tue, Aug 18, 2015 at 11:49 AM, Rajani Karuturi <ra...@apache.org>
> > wrote:
> >
> > > update the usage_event table with VM.DESTROY event for this vm.
> > > I would say create a vm, destroy it and observer the entries in
> > usage_event
> > > table. create a similar entry for the manually destroyed vm.
> > >
> > >
> > > ~Rajani
> > >
> > > On Tue, Aug 18, 2015 at 12:12 AM, raja sekhar <rajsekhar.467@gmail.com
> >
> > > wrote:
> > >
> > > > Hi All,
> > > >
> > > > The usage records are still generating even if the vm is removed from
> > > > cloudstack.
> > > > The actual scenario is:
> > > > The xenserver host went to alert state and the vms in it are not
> > > > accessible.
> > > > we have removed the vms from backend by updating vm_instance,volume
> > > table.
> > > > can any one help me what is the exact table to update?
> > > > i am using cloudstack 4.2
> > > >
> > > > waiting for your valuable suggestions.
> > > >
> > > >
> > > > regards,
> > > > rajasekhar.
> > > >
> > >
> >
>

Re: Usage Records are still generating even VM removed.

Posted by Rajani Karuturi <ra...@apache.org>.
can you compare events for both the vms using
select * from usage_event where type like 'VM%' and resource_id in (311,
752);
May be a stop event is missing.

the same table is also present in cloud_usage database. compare the events
in that table as well.


~Rajani

On Wed, Aug 19, 2015 at 4:42 AM, raja sekhar <ra...@gmail.com>
wrote:

> Hi Rajani,
>
> Thanks for your reply.
> i have created one testvm and manually destroyed from cloud ui.
> the db entry in events table is:
>
> select * from usage_event where type='VM.DESTROY'\G
> *************************** 519. row ***************************
>            id: 36520
>          type: VM.DESTROY
>    account_id: 62
>       created: 2015-07-21 07:53:45
>       zone_id: 1
>   resource_id: 752
> resource_name: testvm
>   offering_id: 78
>   template_id: 333
>          size: NULL
> resource_type: XenServer
>     processed: 1
>  virtual_size: NULL
>
> *i compared these entries to my vm:*
>
> select * from usage_event where resource_name='appserver'\G
> *************************** 18. row ***************************
>            id: 30714
>          type: VM.DESTROY
>    account_id: 29
>       created: 2015-03-17 14:31:24
>       zone_id: 1
>   resource_id: 311
> resource_name: AppServer
>   offering_id: 34
>   template_id: 257
>          size: NULL
> resource_type: XenServer
>     processed: 1
>  virtual_size: NULL
>
> *i found that these two tables are same.*
> *below are the few tables of the vm.*
> *please suggest me what is the exact table to stop usage records.*
>
> select * from cloud_usage where vm_name='AppServer'\G
> *************************** 1289. row ***************************
>             id: 679340
>        zone_id: 1
>     account_id: 29
>      domain_id: 12
>    description: AppServer running time (ServiceOffering: 34) (Template:
> 257)
>  usage_display: 24 Hrs
>     usage_type: 1
>      raw_usage: 24
> vm_instance_id: 311
>        vm_name: AppServer
>    offering_id: 34
>    template_id: 257
>       usage_id: 311
>           type: XenServer
>           size: NULL
>     network_id: NULL
>     start_date: 2015-08-17 00:00:00
>       end_date: 2015-08-17 23:59:59
>   virtual_size: NULL
>
> select * from vm_instance where name='appserver'\G
> *************************** 2. row ***************************
>                   id: 311
>                 name: AppServer
>                 uuid: 0802d513-0bda-43d5-9600-20f705ca1ed7
>        instance_name: i-29-311-VM
>                state: Expunging
>       vm_template_id: 257
>          guest_os_id: 54
>  private_mac_address: 02:00:4a:a8:00:04
>   private_ip_address: 10.10.10.17
>               pod_id: 1
>       data_center_id: 1
>              host_id: NULL
>         last_host_id: 14
>             proxy_id: 299
>    proxy_assign_time: 2013-08-26 21:11:17
>         vnc_password: uPk1EIH5AmWi+djshYFcg7BtBXVzYHgQ866UT0/nV28=
>           ha_enabled: 0
>        limit_cpu_use: 0
>         update_count: 33
>          update_time: 2015-03-17 14:32:35
>              created: 2013-08-23 01:28:39
>              removed: 2015-08-14 12:57:21
>                 type: User
>              vm_type: User
>           account_id: 29
>            domain_id: 12
>  service_offering_id: 34
>       reservation_id: 99128765-61b1-4e9f-b703-f20715a10a78
>      hypervisor_type: XenServer
>     disk_offering_id: NULL
>                  cpu: NULL
>                  ram: NULL
>                owner: 29
>                speed: 1024
>            host_name: AppServer
>         display_name: AppServer
>        desired_state: NULL
> dynamically_scalable: 0
>           display_vm: 1
>
> mysql> select * from volumes where instance_id=311\G
> *************************** 1. row ***************************
>                         id: 427
>                 account_id: 29
>                  domain_id: 12
>                    pool_id: 208
>               last_pool_id: NULL
>                instance_id: 311
>                  device_id: 0
>                       name: ROOT-311
>                       uuid: c253355e-a33c-4590-9b5e-74f7fa0c32cc
>                       size: 53687091200
>                     folder: lvm
>                       path: ed119650-671e-4328-9ff2-2aefaac625a9
>                     pod_id: 1
>             data_center_id: 1
>                 iscsi_name: NULL
>                    host_ip: NULL
>                volume_type: ROOT
>                  pool_type: LVM
>           disk_offering_id: 34
>                template_id: 257
> first_snapshot_backup_uuid: NULL
>                recreatable: 0
>                    created: 2013-08-23 01:28:39
>                   attached: NULL
>                    updated: 2015-03-17 14:32:35
>                    removed: 2015-05-03 02:57:00
>                      state: Destroy
>                 chain_info: NULL
>               update_count: 1025
>                  disk_type: NULL
>     vm_snapshot_chain_size: NULL
>                     iso_id: NULL
>             display_volume: 1
>                     format: VHD
>                   min_iops: NULL
>                   max_iops: NULL
>
>
> regards,
> rajasekhar.
>
> On Tue, Aug 18, 2015 at 11:49 AM, Rajani Karuturi <ra...@apache.org>
> wrote:
>
> > update the usage_event table with VM.DESTROY event for this vm.
> > I would say create a vm, destroy it and observer the entries in
> usage_event
> > table. create a similar entry for the manually destroyed vm.
> >
> >
> > ~Rajani
> >
> > On Tue, Aug 18, 2015 at 12:12 AM, raja sekhar <ra...@gmail.com>
> > wrote:
> >
> > > Hi All,
> > >
> > > The usage records are still generating even if the vm is removed from
> > > cloudstack.
> > > The actual scenario is:
> > > The xenserver host went to alert state and the vms in it are not
> > > accessible.
> > > we have removed the vms from backend by updating vm_instance,volume
> > table.
> > > can any one help me what is the exact table to update?
> > > i am using cloudstack 4.2
> > >
> > > waiting for your valuable suggestions.
> > >
> > >
> > > regards,
> > > rajasekhar.
> > >
> >
>

Re: Usage Records are still generating even VM removed.

Posted by raja sekhar <ra...@gmail.com>.
Hi Rajani,

Thanks for your reply.
i have created one testvm and manually destroyed from cloud ui.
the db entry in events table is:

select * from usage_event where type='VM.DESTROY'\G
*************************** 519. row ***************************
           id: 36520
         type: VM.DESTROY
   account_id: 62
      created: 2015-07-21 07:53:45
      zone_id: 1
  resource_id: 752
resource_name: testvm
  offering_id: 78
  template_id: 333
         size: NULL
resource_type: XenServer
    processed: 1
 virtual_size: NULL

*i compared these entries to my vm:*

select * from usage_event where resource_name='appserver'\G
*************************** 18. row ***************************
           id: 30714
         type: VM.DESTROY
   account_id: 29
      created: 2015-03-17 14:31:24
      zone_id: 1
  resource_id: 311
resource_name: AppServer
  offering_id: 34
  template_id: 257
         size: NULL
resource_type: XenServer
    processed: 1
 virtual_size: NULL

*i found that these two tables are same.*
*below are the few tables of the vm.*
*please suggest me what is the exact table to stop usage records.*

select * from cloud_usage where vm_name='AppServer'\G
*************************** 1289. row ***************************
            id: 679340
       zone_id: 1
    account_id: 29
     domain_id: 12
   description: AppServer running time (ServiceOffering: 34) (Template: 257)
 usage_display: 24 Hrs
    usage_type: 1
     raw_usage: 24
vm_instance_id: 311
       vm_name: AppServer
   offering_id: 34
   template_id: 257
      usage_id: 311
          type: XenServer
          size: NULL
    network_id: NULL
    start_date: 2015-08-17 00:00:00
      end_date: 2015-08-17 23:59:59
  virtual_size: NULL

select * from vm_instance where name='appserver'\G
*************************** 2. row ***************************
                  id: 311
                name: AppServer
                uuid: 0802d513-0bda-43d5-9600-20f705ca1ed7
       instance_name: i-29-311-VM
               state: Expunging
      vm_template_id: 257
         guest_os_id: 54
 private_mac_address: 02:00:4a:a8:00:04
  private_ip_address: 10.10.10.17
              pod_id: 1
      data_center_id: 1
             host_id: NULL
        last_host_id: 14
            proxy_id: 299
   proxy_assign_time: 2013-08-26 21:11:17
        vnc_password: uPk1EIH5AmWi+djshYFcg7BtBXVzYHgQ866UT0/nV28=
          ha_enabled: 0
       limit_cpu_use: 0
        update_count: 33
         update_time: 2015-03-17 14:32:35
             created: 2013-08-23 01:28:39
             removed: 2015-08-14 12:57:21
                type: User
             vm_type: User
          account_id: 29
           domain_id: 12
 service_offering_id: 34
      reservation_id: 99128765-61b1-4e9f-b703-f20715a10a78
     hypervisor_type: XenServer
    disk_offering_id: NULL
                 cpu: NULL
                 ram: NULL
               owner: 29
               speed: 1024
           host_name: AppServer
        display_name: AppServer
       desired_state: NULL
dynamically_scalable: 0
          display_vm: 1

mysql> select * from volumes where instance_id=311\G
*************************** 1. row ***************************
                        id: 427
                account_id: 29
                 domain_id: 12
                   pool_id: 208
              last_pool_id: NULL
               instance_id: 311
                 device_id: 0
                      name: ROOT-311
                      uuid: c253355e-a33c-4590-9b5e-74f7fa0c32cc
                      size: 53687091200
                    folder: lvm
                      path: ed119650-671e-4328-9ff2-2aefaac625a9
                    pod_id: 1
            data_center_id: 1
                iscsi_name: NULL
                   host_ip: NULL
               volume_type: ROOT
                 pool_type: LVM
          disk_offering_id: 34
               template_id: 257
first_snapshot_backup_uuid: NULL
               recreatable: 0
                   created: 2013-08-23 01:28:39
                  attached: NULL
                   updated: 2015-03-17 14:32:35
                   removed: 2015-05-03 02:57:00
                     state: Destroy
                chain_info: NULL
              update_count: 1025
                 disk_type: NULL
    vm_snapshot_chain_size: NULL
                    iso_id: NULL
            display_volume: 1
                    format: VHD
                  min_iops: NULL
                  max_iops: NULL


regards,
rajasekhar.

On Tue, Aug 18, 2015 at 11:49 AM, Rajani Karuturi <ra...@apache.org> wrote:

> update the usage_event table with VM.DESTROY event for this vm.
> I would say create a vm, destroy it and observer the entries in usage_event
> table. create a similar entry for the manually destroyed vm.
>
>
> ~Rajani
>
> On Tue, Aug 18, 2015 at 12:12 AM, raja sekhar <ra...@gmail.com>
> wrote:
>
> > Hi All,
> >
> > The usage records are still generating even if the vm is removed from
> > cloudstack.
> > The actual scenario is:
> > The xenserver host went to alert state and the vms in it are not
> > accessible.
> > we have removed the vms from backend by updating vm_instance,volume
> table.
> > can any one help me what is the exact table to update?
> > i am using cloudstack 4.2
> >
> > waiting for your valuable suggestions.
> >
> >
> > regards,
> > rajasekhar.
> >
>

Re: Usage Records are still generating even VM removed.

Posted by Rajani Karuturi <ra...@apache.org>.
update the usage_event table with VM.DESTROY event for this vm.
I would say create a vm, destroy it and observer the entries in usage_event
table. create a similar entry for the manually destroyed vm.


~Rajani

On Tue, Aug 18, 2015 at 12:12 AM, raja sekhar <ra...@gmail.com>
wrote:

> Hi All,
>
> The usage records are still generating even if the vm is removed from
> cloudstack.
> The actual scenario is:
> The xenserver host went to alert state and the vms in it are not
> accessible.
> we have removed the vms from backend by updating vm_instance,volume table.
> can any one help me what is the exact table to update?
> i am using cloudstack 4.2
>
> waiting for your valuable suggestions.
>
>
> regards,
> rajasekhar.
>

Re: Usage Records are still generating even VM removed.

Posted by Rajani Karuturi <ra...@apache.org>.
update the usage_event table with VM.DESTROY event for this vm.
I would say create a vm, destroy it and observer the entries in usage_event
table. create a similar entry for the manually destroyed vm.


~Rajani

On Tue, Aug 18, 2015 at 12:12 AM, raja sekhar <ra...@gmail.com>
wrote:

> Hi All,
>
> The usage records are still generating even if the vm is removed from
> cloudstack.
> The actual scenario is:
> The xenserver host went to alert state and the vms in it are not
> accessible.
> we have removed the vms from backend by updating vm_instance,volume table.
> can any one help me what is the exact table to update?
> i am using cloudstack 4.2
>
> waiting for your valuable suggestions.
>
>
> regards,
> rajasekhar.
>