Uploaded image for project: 'CloudStack'
  1. CloudStack
  2. CLOUDSTACK-9096

Deleted projects cannot be billed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.5.2
    • None
    • Usage
    • Security Level: Public (Anyone can view this level - this is the default.)

    Description

      Deleted projects cannot be billed because usage data is not available any more from the moment of project deletion. If the project is deleted in the middle of the month all usage data of this month is lost:

      If you delete a project
      1. the database record in cloud.project_view is removed
      2. the name field in the cloud.projects table is set to NULL, thus the original project name is completely lost.
      3. the usage records for this project are not available any more via api/cloudmonkey
      (4. the usage records are still in the database and available via vm_name for example)

      Example:
      Project 'usagetest01' created on 2015-11-30
      VM 'x1' created in this project.

      Cloudmonkey:
      > list projects listall=true name=usagetest01
      count = 1
      project:
      id = a6446311-eaf9-440c-bea5-f6df0d11665f
      name = usagetest01
      account = admin
      ...
      > list virtualmachines projectid=a6446311-eaf9-440c-bea5-f6df0d11665f listall=true name=x1
      count = 1
      virtualmachine:
      id = c11f7276-9613-40bb-82f7-655b8c76d9e4
      name = x1
      ...
      > list usagerecords projectid=a6446311-eaf9-440c-bea5-f6df0d11665f startdate=2015-11-30 enddate=2015-11-30
      (no usage data yet as expected)

      On the next day (2015-12-01) usage data is available:
      > list usagerecords projectid=a6446311-eaf9-440c-bea5-f6df0d11665f startdate=2015-11-30 enddate=2015-11-30
      count = 8
      usagerecord:
      name = x1
      description = x1 running time (ServiceOffering: 1) (Template: 201)
      ...
      ===========================================================
      name = x1
      description = x1 allocated (ServiceOffering: 1) (Template: 201)
      ...
      ===========================================================
      ...

      Project deleted on 2015-12-01.

      Now the project cannot be found in the database view any more:

      mysql> select * from cloud.project_view where name like 'usagetest01'\G
      Empty set (0.00 sec)

      mysql> select * from cloud.project_view where uuid like 'a6446311-eaf9-440c-bea5-f6df0d11665f'\G
      Empty set (0.00 sec)

      But with the uuid we still find it in the table:
      mysql> select * from cloud.projects where uuid like 'a6446311-eaf9-440c-bea5-f6df0d11665f'\G
      id: 38
      name: NULL
      uuid: a6446311-eaf9-440c-bea5-f6df0d11665f
      display_text: Usage-Test 01
      project_account_id: 76
      domain_id: 1
      created: 2015-11-30 08:40:10
      removed: 2015-12-01 08:57:05
      state: Disabled
      1 row in set (0.00 sec)

      But name is NULL, only display_text is still set!

      No usage records available any more via api/cloudmonkey:

      > list usagerecords projectid=a6446311-eaf9-440c-bea5-f6df0d11665f startdate=2015-11-30 enddate=2015-11-30
      Error 431: Unable to find project by id 38
      cserrorcode = 4350
      errorcode = 431
      errortext = Unable to find project by id 38
      uuidList:

      But the usage data is still in the database, e.g.
      mysql> select * from cloud_usage where vm_name like 'x1'\G
      id: 51895
      zone_id: 1
      account_id: 76
      domain_id: 1
      description: x1 running time (ServiceOffering: 1) (Template: 201)
      usage_display: 13.146667 Hrs
      usage_type: 1
      raw_usage: 13.146666526794434
      ...
      id: 51896
      zone_id: 1
      account_id: 76
      domain_id: 1
      description: x1 allocated (ServiceOffering: 1) (Template: 201)
      usage_display: 13.165278 Hrs
      usage_type: 2
      raw_usage: 13.165278434753418
      ...
      2 rows in set (0.00 sec)

      Summary:
      We need a way to access the project name and the usage data of deleted projects at least for the current month.

      Attachments

        Activity

          People

            Unassigned Unassigned
            NK Norbert Klein
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: