On 10/28/2013 03:16 PM, Sandro Bonazzola wrote:
> Hi,
> I need to do some testing on log-collector for solving
> Bug 1014379 - When calling the API the LC does not provide a max value, 
> limiting the returned results to 100 by default.
> How may I have the engine listing more than 100 hypervisors? (I don't really 
> need them to be up, just need them to be listed)
> 
> 

I have used the attached insert_many_hosts function in the past, you may
find it useful. However the InsertVds function that it uses is currently
broken, so it wont work without the attached patch (the InsertVds
function isn't currently used, should probably be removed).

-- 
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
create or replace function insert_many_hosts(how_many integer) returns void
as $$
declare
  host_id uuid;
  host_name varchar;
  host_ip varchar;
  cluster_id uuid;
begin
  for i in 0..how_many loop
    select uuid_generate_v1() into host_id;
    select 'host' || i into host_name;
    select '192.168.122.' || i into host_ip;
    select vds_group_id into cluster_id from vds_groups where name = 'Default';

    perform InsertVds(
      host_id,    -- v_vds_id
      host_name,  -- v_host_name
      null,       -- v_free_text_comment
      host_ip,    -- v_ip
      null,       -- v_vds_unique_id
      54321,      -- v_port
      cluster_id, -- v_vds_group_id
      host_name,  -- v_vds_name
      't',        -- v_server_SSL_enabled
      0,          -- v_vds_type
      100,        -- v_vds_strength
      null,       -- v_pm_type
      null,       -- v_pm_user
      null,       -- v_pm_password
      null,       -- v_pm_port
      '',         -- v_pm_options
      'f',        -- v_pm_enabled
      null,       -- v_pm_proxy_preferences
      null,       -- v_pm_secondary_ip
      null,       -- v_pm_secondary_type
      null,       -- v_pm_secondary_user
      null,       -- v_pm_secondary_password
      null,       -- v_pm_secondary_port
      null,       -- v_pm_secondary_options
      null,       -- v_pm_secondary_concurrent
      1,          -- v_vds_spm_priority
      null,       -- v_console_address
      22,         -- v_ssh_port
      'root'      -- v_ssh_username
    );
  end loop;

end; $$
language plpgsql;
diff --git a/packaging/dbscripts/vds_sp.sql b/packaging/dbscripts/vds_sp.sql
index fbf9aea..c37c5a7 100644
--- a/packaging/dbscripts/vds_sp.sql
+++ b/packaging/dbscripts/vds_sp.sql
@@ -718,15 +718,15 @@ RETURNS VOID
 BEGIN
 
    BEGIN
-      INSERT INTO vds_static(vds_id,host_name, free_text_comment, ip, 
vds_unique_id, port, ds_group_id, vds_name, server_SSL_enabled,
+      INSERT INTO vds_static(vds_id,host_name, free_text_comment, ip, 
vds_unique_id, port, vds_group_id, vds_name, server_SSL_enabled,
                              
vds_type,vds_strength,pm_type,pm_user,pm_password, pm_port, pm_options, 
pm_enabled,
                              pm_secondary_ip, pm_secondary_type, 
pm_secondary_user,
                              pm_secondary_password, pm_secondary_port, 
pm_secondary_options, pm_secondary_concurrent,
                              pm_proxy_preferences, vds_spm_priority, 
console_address, ssh_port, ssh_username)
        VALUES(v_vds_id,v_host_name, v_free_text_comment, v_ip, 
v_vds_unique_id, v_port, v_vds_group_id, v_vds_name, v_server_SSL_enabled,
                v_vds_type, 
v_vds_strength,v_pm_type,v_pm_user,v_pm_password,v_pm_port, v_pm_options, 
v_pm_enabled,
-               pm_secondary_ip, pm_secondary_type, pm_secondary_user,
-               pm_secondary_password, pm_secondary_port, pm_secondary_options, 
pm_secondary_concurrent,v_pm_proxy_preferences,
+               v_pm_secondary_ip, v_pm_secondary_type, v_pm_secondary_user,
+               v_pm_secondary_password, v_pm_secondary_port, 
v_pm_secondary_options, v_pm_secondary_concurrent,v_pm_proxy_preferences,
                v_vds_spm_priority, v_console_address, v_ssh_port, 
v_ssh_username);
 
       INSERT INTO vds_dynamic(vds_id, status) VALUES(v_vds_id, 0);
_______________________________________________
Engine-devel mailing list
Engine-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-devel

Reply via email to