nvazquez opened a new issue #3858: findHostsForMigration API returns an 
empty/incomplete host list
URL: https://github.com/apache/cloudstack/issues/3858
 
 
   ##### ISSUE TYPE
   
    * Bug Report
   
   ##### COMPONENT NAME
   ~~~
   API, UI
   ~~~
   
   ##### CLOUDSTACK VERSION
   ~~~
   4.11.2, 4.13
   ~~~
   
   ##### CONFIGURATION
   N/A
   
   ##### OS / ENVIRONMENT
   Environment with multiple Vmware hosts
   
   ##### SUMMARY
   Invoking the 'findHostsForMigration' API returns an empty list or incomplete 
list of hosts.
   
   There are some cases in big environments in which the UI or API does not 
retrieve hosts on the findHostsForMigration API. 
   
   Looking at the implementation and enabling TRACE on the management server 
logs:
   
   - When keyword is not passed: 
   ````
   020-01-31 16:44:22,387 TRACE [c.c.u.d.T.Statement] 
(qtp1213349904-288:ctx-511ad0c7 ctx-217dbc2e) (logid:aa340f83) Preparing: 
SELECT COUNT(*) FROM host WHERE host.type LIKE ?  AND host.data_center_id = ?  
AND host.hypervisor_type = ?  AND host.hypervisor_version >= ?   AND 
host.removed IS NULL 
   2020-01-31 16:44:22,387 TRACE [c.c.u.d.T.Statement] 
(qtp1213349904-288:ctx-511ad0c7 ctx-217dbc2e) (logid:aa340f83) Closing: 
com.mysql.jdbc.JDBC4PreparedStatement@1eb4c682: SELECT host.id, 
host.disconnected, host.name, host.status, host.type, host.private_ip_address, 
host.private_mac_address, host.private_netmask, host.public_netmask, 
host.public_ip_address, host.public_mac_address, host.storage_ip_address, 
host.cluster_id, host.storage_netmask, host.storage_mac_address, 
host.storage_ip_address_2, host.storage_netmask_2, host.storage_mac_address_2, 
host.hypervisor_type, host.proxy_port, host.resource, host.fs_type, 
host.available, host.setup, host.resource_state, host.hypervisor_version, 
host.update_count, host.uuid, host.data_center_id, host.pod_id, 
host.cpu_sockets, host.cpus, host.url, host.speed, host.ram, host.parent, 
host.guid, host.capabilities, host.total_size, host.last_ping, 
host.mgmt_server_id, host.dom0_memory, host.version, host.created, host.removed 
FROM host WHERE host.type LIKE '%Routing'  AND host.data_center_id = 7  AND 
host.hypervisor_type = 'VMware'  AND host.hypervisor_version >= _binary'6.5'  
AND host.removed IS NULL  ORDER BY host.id ASC  LIMIT 0, 20
   ````
   
   - When providing a keyword:
   ````
   020-01-31 16:44:22,387 TRACE [c.c.u.d.T.Statement] 
(qtp1213349904-288:ctx-511ad0c7 ctx-217dbc2e) (logid:aa340f83) Preparing: 
SELECT COUNT(*) FROM host WHERE host.type LIKE ?  AND host.data_center_id = ?  
AND host.hypervisor_type = ?  AND host.hypervisor_version >= ?  AND  (host.name 
LIKE ?  OR host.status LIKE ?  OR host.type LIKE ? )  AND host.removed IS NULL 
   2020-01-31 16:44:22,387 TRACE [c.c.u.d.T.Statement] 
(qtp1213349904-288:ctx-511ad0c7 ctx-217dbc2e) (logid:aa340f83) Closing: 
com.mysql.jdbc.JDBC4PreparedStatement@1eb4c682: SELECT host.id, 
host.disconnected, host.name, host.status, host.type, host.private_ip_address, 
host.private_mac_address, host.private_netmask, host.public_netmask, 
host.public_ip_address, host.public_mac_address, host.storage_ip_address, 
host.cluster_id, host.storage_netmask, host.storage_mac_address, 
host.storage_ip_address_2, host.storage_netmask_2, host.storage_mac_address_2, 
host.hypervisor_type, host.proxy_port, host.resource, host.fs_type, 
host.available, host.setup, host.resource_state, host.hypervisor_version, 
host.update_count, host.uuid, host.data_center_id, host.pod_id, 
host.cpu_sockets, host.cpus, host.url, host.speed, host.ram, host.parent, 
host.guid, host.capabilities, host.total_size, host.last_ping, 
host.mgmt_server_id, host.dom0_memory, host.version, host.created, host.removed 
FROM host WHERE host.type LIKE '%Routing'  AND host.data_center_id = 7  AND 
host.hypervisor_type = 'VMware'  AND host.hypervisor_version >= _binary'6.5'  
AND  (host.name LIKE _binary'%qt%'  OR host.status LIKE '%qt%'  OR host.type 
LIKE '%qt%' )  AND host.removed IS NULL  ORDER BY host.id ASC  LIMIT 0, 20
   ````
   
   The issue is that the query is limited to 20 hosts which are ordered by ID. 
In case the suitable hosts appear after in the list retrieved from these 
queries, those won't be displayed.
   
   ##### STEPS TO REPRODUCE
   There are 2 possible scenarios:
   - Create VM
   - Click on migrate VM
   - The popup dialog displays an empty list of hosts
   
   Scenario 2: using keyword:
   - Create VM
   - Click on migrate VM
   - Verify no hosts is displayed
   - Enter keyword on the search text field
   - Verify hosts are displayed
   
   ##### EXPECTED RESULTS
   ~~~
   List of hosts indicating suitable/not suitable
   ~~~
   
   ##### ACTUAL RESULTS
   ~~~
   Empty list
   ~~~
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to