You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2023/01/10 10:08:01 UTC

[GitHub] [cloudstack] soreana opened a new issue, #7074: VMs without uuid are not listing in the list virtual machines api call when ids parameter used.

soreana opened a new issue, #7074:
URL: https://github.com/apache/cloudstack/issues/7074

   ##### ISSUE TYPE
   <!-- Pick one below and delete the rest -->
    * Bug Report
   
   ##### COMPONENT NAME
   <!--
   Categorize the issue, e.g. API, VR, VPN, UI, etc.
   -->
   ~~~
   API
   ~~~
   
   ##### CLOUDSTACK VERSION
   <!--
   New line separated list of affected versions, commit ID for issues on main branch.
   -->
   
   ~~~
   4.17
   ~~~
   
   
   ##### SUMMARY
   <!-- Explain the problem/feature briefly -->
   
   Some of our old VMs data were missing in our dashboards. After digging that a little bit further we noticed a strange behaviour in the CloudStack 4.17. We have old VMs in our data center which don't have an UUID. Their uuid's field in DB is a long value. For simplicity I will call this vm `NO-UUID` from now on.
   
   When I call `list virtualmachines` with `id` of `NO-UUID` it returns the correct VM. But when I pass `NO-UUID`'s id in the `ids` it returns nothing. Check the following cmk outputs for more info.
   
   The issue exists with the remaining listing as well.
   
   ##### EXPECTED RESULTS
   <!-- What did you expect to happen when running the steps above? -->
   
   list virtualmachines returns the same results when it called with `id` or `ids`.
   
   ~~~
   (local)  > list virtualmachines ids=11289 listall=true filter=id
   {
     "count": 1,
     "virtualmachine": [
       {
         "id": "11289"
       }
     ]
   }
   (local)  > list virtualmachines id=11289 listall=true filter=id
   {
     "count": 1,
     "virtualmachine": [
       {
         "id": "11289"
       }
     ]
   }
   (local)  >
   ~~~
   
   ##### ACTUAL RESULTS
   <!-- What actually happened? -->
   
   list virtualmachines returns nothing with `ids` but it returns the vm with `id`.
   
   <!-- Paste verbatim command output between quotes below -->
   ~~~
   (local)  > list virtualmachines ids=11289 listall=true filter=id
   (local)  > list virtualmachines id=11289 listall=true filter=id
   {
     "count": 1,
     "virtualmachine": [
       {
         "id": "11289"
       }
     ]
   }
   (local)  >
   ~~~
   


-- 
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: commits-unsubscribe@cloudstack.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cloudstack] weizhouapache commented on issue #7074: VMs without uuid are not listing in the list virtual machines api call when ids parameter used.

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on issue #7074:
URL: https://github.com/apache/cloudstack/issues/7074#issuecomment-1382002406

   @soreana 
   good you have solved the issue.
   
   actually it can be done by a simple sql
   
   `UPDATE vm_instance SET uuid=UUID() WHERE uuid=CAST(id AS CHAR);`
   
   you can trust that uuid is unique.
   
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cloudstack] soreana commented on issue #7074: VMs without uuid are not listing in the list virtual machines api call when ids parameter used.

Posted by GitBox <gi...@apache.org>.
soreana commented on issue #7074:
URL: https://github.com/apache/cloudstack/issues/7074#issuecomment-1381994424

   @weizhouapache 
   
   We followed the following procedure, which solved our issue.
   
   0. Create a database backup
   1. Get the VMs data in a (id, uuid, account_id, display_name) format
       1.1 generate a file containing all the failed VMs.
           select id,uuid,account_id, display_name from vm_instance where id = uuid and removed is null INTO OUTFILE '/tmp/incorrect_uuid.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' ;
   2. Generate a uuid for each row in a (id, old_uuid, new_uuid, account_id, display_name) format
       2.1 Check if the uuid is unique
       2.2 If not unique generate a new one
   3. Generate a sql file to update  CloudStack DB and other application that were dependent on the UUID of the VM.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cloudstack] soreana commented on issue #7074: VMs without uuid are not listing in the list virtual machines api call when ids parameter used.

Posted by GitBox <gi...@apache.org>.
soreana commented on issue #7074:
URL: https://github.com/apache/cloudstack/issues/7074#issuecomment-1377025966

   Is it safe to generate a UUID and  update the uuid field in `db`?


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cloudstack] weizhouapache commented on issue #7074: VMs without uuid are not listing in the list virtual machines api call when ids parameter used.

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on issue #7074:
URL: https://github.com/apache/cloudstack/issues/7074#issuecomment-1377020728

   @soreana 
   `ids` support only uuid. 
   
   it is not a good idea to use long value `id`. You'd better use uuid instead of id.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cloudstack] weizhouapache commented on issue #7074: VMs without uuid are not listing in the list virtual machines api call when ids parameter used.

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on issue #7074:
URL: https://github.com/apache/cloudstack/issues/7074#issuecomment-1377121954

   > @weizhouapache Unfortunately they don't have an `uuid`. See the following db output.
   > 
   > ```
   > mysql> select id,uuid from user_vm_view where id = 11289 limit 1;
   > +-------+-------+
   > | id    | uuid  |
   > +-------+-------+
   > | 11289 | 11289 |
   > +-------+-------+
   > 1 row in set (0.01 sec)
   > ```
   
   @soreana 
   hmm, it looks the vm was created more than 10 years ago (before cloudstack 4.1.0).
   engine/schema/src/main/resources/META-INF/db/schema-40to410.sql:UPDATE `cloud`.`vm_instance` set uuid=id WHERE uuid is NULL;
   
   I think it is ok to regenerate uuid.
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cloudstack] soreana commented on issue #7074: VMs without uuid are not listing in the list virtual machines api call when ids parameter used.

Posted by GitBox <gi...@apache.org>.
soreana commented on issue #7074:
URL: https://github.com/apache/cloudstack/issues/7074#issuecomment-1377187727

   @weizhouapache Thanks a lot.
   
   I will update the uuid. I will close the ticket after confirming the expected behaviour.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cloudstack] soreana closed issue #7074: VMs without uuid are not listing in the list virtual machines api call when ids parameter used.

Posted by GitBox <gi...@apache.org>.
soreana closed issue #7074: VMs without uuid are not listing in the list virtual machines api call when ids parameter used.
URL: https://github.com/apache/cloudstack/issues/7074


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cloudstack] soreana commented on issue #7074: VMs without uuid are not listing in the list virtual machines api call when ids parameter used.

Posted by GitBox <gi...@apache.org>.
soreana commented on issue #7074:
URL: https://github.com/apache/cloudstack/issues/7074#issuecomment-1382008631

   @weizhouapache
   
   That is cool, I didn't know that, thanks 👍 


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cloudstack] soreana commented on issue #7074: VMs without uuid are not listing in the list virtual machines api call when ids parameter used.

Posted by GitBox <gi...@apache.org>.
soreana commented on issue #7074:
URL: https://github.com/apache/cloudstack/issues/7074#issuecomment-1377023966

   @weizhouapache Unfortunately they don't have an `uuid`.  See the following db output.
   
   ```
   mysql> select id,uuid from user_vm_view where id = 11289 limit 1;
   +-------+-------+
   | id    | uuid  |
   +-------+-------+
   | 11289 | 11289 |
   +-------+-------+
   1 row in set (0.01 sec)
   ```


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org