Tomas Jelinek has uploaded a new change for review. Change subject: engine: migration progress ......................................................................
engine: migration progress The goal is to show in webadmin the migration progress of the VM. VDSM already returns as a statistic the migration progress. This is the engine part of the migration progress feature. Change-Id: I5e909b1577a26f83bf46ff14694f0ca66c32076a Bug-Url: https://bugzilla.redhat.com/1083049 Signed-off-by: Tomas Jelinek <[email protected]> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatistics.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStatisticsDaoDbFacadeImpl.java M backend/manager/modules/dal/src/test/resources/fixtures.xml M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java M packaging/dbscripts/create_views.sql A packaging/dbscripts/upgrade/03_05_0300_add_migration_progress_percent_to_vm_dynamic.sql M packaging/dbscripts/vms_sp.sql 10 files changed, 49 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/26/26826/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java index 8f529ac..b9beb8c 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java @@ -770,6 +770,14 @@ this.vmStatistics.setusage_mem_percent(value); } + public Integer getMigrationProgressPercent() { + return this.vmStatistics.getMigrationProgressPercent(); + } + + public void setMigrationProgressPercent(Integer value) { + this.vmStatistics.setMigrationProgressPercent(value); + } + public Integer getUsageCpuPercent() { return this.vmStatistics.getusage_cpu_percent(); } @@ -1296,6 +1304,9 @@ } // -------- memory -------------- setUsageMemPercent(vmStatistics.getusage_mem_percent()); + + // -------- migration -------------- + setMigrationProgressPercent(vmStatistics.getMigrationProgressPercent()); } /** diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatistics.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatistics.java index 14425d1..f747804 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatistics.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatistics.java @@ -34,6 +34,7 @@ result = prime * result + ((usage_cpu_percentField == null) ? 0 : usage_cpu_percentField.hashCode()); result = prime * result + ((usage_mem_percentField == null) ? 0 : usage_mem_percentField.hashCode()); result = prime * result + ((usage_network_percentField == null) ? 0 : usage_network_percentField.hashCode()); + result = prime * result + ((migrationProgressPercent == null) ? 0 : migrationProgressPercent.hashCode()); result = prime * result + ((disksUsage == null) ? 0 : disksUsage.hashCode()); result = prime * result + ((vm_guidField == null) ? 0 : vm_guidField.hashCode()); return result; @@ -58,6 +59,7 @@ && ObjectUtils.objectsEqual(roundedElapsedTimeField, other.roundedElapsedTimeField) && ObjectUtils.objectsEqual(usage_cpu_percentField, other.usage_cpu_percentField) && ObjectUtils.objectsEqual(usage_mem_percentField, other.usage_mem_percentField) + && ObjectUtils.objectsEqual(migrationProgressPercent, other.migrationProgressPercent) && ObjectUtils.objectsEqual(usage_network_percentField, other.usage_network_percentField) && ObjectUtils.objectsEqual(disksUsage, other.disksUsage) && ObjectUtils.objectsEqual(vm_guidField, other.vm_guidField)); @@ -140,6 +142,16 @@ this.usage_mem_percentField = value; } + private Integer migrationProgressPercent; + + public Integer getMigrationProgressPercent() { + return migrationProgressPercent; + } + + public void setMigrationProgressPercent(Integer migrationProgressPercent) { + this.migrationProgressPercent = migrationProgressPercent; + } + private String disksUsage; /** diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java index 829861c..8d80311 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java @@ -336,6 +336,7 @@ entity.setUsageNetworkPercent((Integer) rs.getObject("usage_network_percent")); entity.setUsageMemPercent((Integer) rs.getObject("usage_mem_percent")); entity.setUsageCpuPercent((Integer) rs.getObject("usage_cpu_percent")); + entity.setMigrationProgressPercent((Integer) rs.getObject("migration_progress_percent")); entity.setRunOnVds(getGuid(rs, "run_on_vds")); entity.setMigratingToVds(getGuid(rs, "migrating_to_vds")); entity.setAppList(rs.getString("app_list")); diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStatisticsDaoDbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStatisticsDaoDbFacadeImpl.java index 1c6b31d..9b3257e 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStatisticsDaoDbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStatisticsDaoDbFacadeImpl.java @@ -39,6 +39,8 @@ statistics.getusage_cpu_percent()) .addValue("usage_mem_percent", statistics.getusage_mem_percent()) + .addValue("migration_progress_percent", + statistics.getMigrationProgressPercent()) .addValue("usage_network_percent", statistics.getusage_network_percent()) .addValue("disks_usage", @@ -59,6 +61,8 @@ .getObject("usage_cpu_percent")); entity.setusage_mem_percent((Integer) rs .getObject("usage_mem_percent")); + entity.setMigrationProgressPercent((Integer) rs + .getObject("migration_progress_percent")); entity.setusage_network_percent((Integer) rs .getObject("usage_network_percent")); entity.setDisksUsage((String) rs @@ -80,6 +84,7 @@ .addValue("elapsed_time", entity.getelapsed_time()) .addValue("usage_cpu_percent", entity.getusage_cpu_percent()) .addValue("usage_mem_percent", entity.getusage_mem_percent()) + .addValue("migration_progress_percent", entity.getMigrationProgressPercent()) .addValue("usage_network_percent", entity.getusage_network_percent()) .addValue("disks_usage", entity.getDisksUsage()) .addValue("vm_guid", entity.getId()); diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml b/backend/manager/modules/dal/src/test/resources/fixtures.xml index 8e7e773..9ad8aa3 100644 --- a/backend/manager/modules/dal/src/test/resources/fixtures.xml +++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml @@ -3271,6 +3271,7 @@ <column>usage_network_percent</column> <column>usage_mem_percent</column> <column>usage_cpu_percent</column> + <column>migration_progress_percent</column> <column>_update_date</column> <row> @@ -3281,6 +3282,7 @@ <value>0</value> <value>0</value> <value>17</value> + <value>60</value> <null /> </row> <row> @@ -3291,6 +3293,7 @@ <value>0</value> <value>0</value> <value>17</value> + <value>60</value> <null /> </row> <row> @@ -3301,6 +3304,7 @@ <value>0</value> <value>0</value> <value>17</value> + <value>60</value> <null /> </row> <row> @@ -3311,6 +3315,7 @@ <value>0</value> <value>0</value> <value>17</value> + <value>60</value> <null /> </row> <row> @@ -3321,6 +3326,7 @@ <value>0</value> <value>0</value> <value>17</value> + <value>60</value> <null /> </row> <row> @@ -3331,6 +3337,7 @@ <value>0</value> <value>0</value> <value>17</value> + <value>60</value> <null /> </row> <row> @@ -3341,6 +3348,7 @@ <value>0</value> <value>0</value> <value>17</value> + <value>60</value> <null /> </row> </table> diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java index cf2098f..8fa99ca 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java @@ -347,6 +347,9 @@ // ------------- vm memory statistics ----------------------- vm.setusage_mem_percent(AssignIntValue(xmlRpcStruct, VdsProperties.vm_usage_mem_percent)); vm.setVmBalloonInfo(getBalloonInfo(xmlRpcStruct)); + + // ------------- vm migration statistics ----------------------- + vm.setMigrationProgressPercent(AssignIntValue(xmlRpcStruct, VdsProperties.vm_migration_progress_percent)); } private static VmBalloonInfo getBalloonInfo(Map<String, Object> xmlRpcStruct) { diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java index 03d1d75..2dbbc98 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java @@ -201,6 +201,7 @@ public static final String VM_IP = "guestIPs"; public static final String VM_FQDN = "guestFQDN"; public static final String vm_usage_mem_percent = "memUsage"; + public static final String vm_migration_progress_percent = "migrationProgress"; public static final String vm_host = "guestName"; public static final String app_list = "appsList"; public static final String guest_os = "guestOs"; diff --git a/packaging/dbscripts/create_views.sql b/packaging/dbscripts/create_views.sql index 26a7aab..9e635c3 100644 --- a/packaging/dbscripts/create_views.sql +++ b/packaging/dbscripts/create_views.sql @@ -618,7 +618,7 @@ vm_dynamic.display_secure_port as display_secure_port, vm_dynamic.utc_diff as utc_diff, vm_dynamic.last_vds_run_on as last_vds_run_on, vm_dynamic.client_ip as client_ip,vm_dynamic.guest_requested_memory as guest_requested_memory, vm_static.time_zone as time_zone, vm_statistics.cpu_user as cpu_user, vm_statistics.cpu_sys as cpu_sys, vm_statistics.elapsed_time as elapsed_time, vm_statistics.usage_network_percent as usage_network_percent, - vm_statistics.usage_mem_percent as usage_mem_percent, vm_statistics.usage_cpu_percent as usage_cpu_percent, vds_static.vds_name as run_on_vds_name, vds_groups.cpu_name as vds_group_cpu_name, + vm_statistics.usage_mem_percent as usage_mem_percent, vm_statistics.migration_progress_percent as migration_progress_percent, vm_statistics.usage_cpu_percent as usage_cpu_percent, vds_static.vds_name as run_on_vds_name, vds_groups.cpu_name as vds_group_cpu_name, vm_static.default_display_type as default_display_type, vm_static.priority as priority,vm_static.iso_path as iso_path, vm_static.origin as origin, vds_groups.compatibility_version as vds_group_compatibility_version, vm_static.initrd_url as initrd_url, vm_static.kernel_url as kernel_url, vm_static.kernel_params as kernel_params, vm_dynamic.pause_status as pause_status, vm_dynamic.exit_message as exit_message, vm_dynamic.exit_status as exit_status,vm_static.migration_support as migration_support,vm_static.predefined_properties as predefined_properties,vm_static.userdefined_properties as userdefined_properties,vm_static.min_allocated_mem as min_allocated_mem, vm_dynamic.hash as hash, vm_static.cpu_pinning as cpu_pinning, vm_static.db_generation as db_generation, vm_static.host_cpu_flags as host_cpu_flags, vm_static.tunnel_migration as tunnel_migration, vm_static.vnc_keyboard_layout as vnc_keyboard_layout, vm_static.is_run_and_pause as is_run_and_pause, vm_static.created_by_user_id as created_by_user_id, @@ -658,7 +658,7 @@ vms.session, vms.num_of_sockets * vms.cpu_per_socket AS num_of_cpus, vms.display_ip, vms.display_type, vms.kvm_enable, vms.boot_sequence, vms.display_secure_port, vms.utc_diff, vms.last_vds_run_on, vms.client_ip, vms.guest_requested_memory, vms.time_zone, vms.cpu_user, vms.cpu_sys, vms.elapsed_time, - vms.usage_network_percent, vms.usage_mem_percent, vms.usage_cpu_percent, vms.run_on_vds_name, + vms.usage_network_percent, vms.usage_mem_percent, vms.migration_progress_percent, vms.usage_cpu_percent, vms.run_on_vds_name, vms.vds_group_cpu_name, tags_vm_map_view.tag_name, tags_vm_map_view.tag_id, vms.default_display_type, vms.priority, vms.vds_group_compatibility_version, vms.initrd_url, vms.kernel_url, vms.kernel_params, vms.pause_status, vms.exit_status, vms.exit_message, vms.min_allocated_mem, storage_domain_static.id AS storage_id, diff --git a/packaging/dbscripts/upgrade/03_05_0300_add_migration_progress_percent_to_vm_dynamic.sql b/packaging/dbscripts/upgrade/03_05_0300_add_migration_progress_percent_to_vm_dynamic.sql new file mode 100644 index 0000000..98bad8a --- /dev/null +++ b/packaging/dbscripts/upgrade/03_05_0300_add_migration_progress_percent_to_vm_dynamic.sql @@ -0,0 +1 @@ +select fn_db_add_column('vm_statistics', 'migration_progress_percent', 'integer default 0'); diff --git a/packaging/dbscripts/vms_sp.sql b/packaging/dbscripts/vms_sp.sql index b751d7a..c8f160f 100644 --- a/packaging/dbscripts/vms_sp.sql +++ b/packaging/dbscripts/vms_sp.sql @@ -145,14 +145,15 @@ v_elapsed_time DECIMAL(18,0) , v_usage_cpu_percent INTEGER , v_usage_mem_percent INTEGER , + v_migration_progress_percent INTEGER , v_usage_network_percent INTEGER , v_disks_usage TEXT, v_vm_guid UUID) RETURNS VOID AS $procedure$ BEGIN -INSERT INTO vm_statistics(cpu_sys, cpu_user, elapsed_time, usage_cpu_percent, usage_mem_percent, usage_network_percent, disks_usage, vm_guid) - VALUES(v_cpu_sys, v_cpu_user, v_elapsed_time, v_usage_cpu_percent, v_usage_mem_percent, v_usage_network_percent, v_disks_usage, v_vm_guid); +INSERT INTO vm_statistics(cpu_sys, cpu_user, elapsed_time, usage_cpu_percent, usage_mem_percent, migration_progress_percent, usage_network_percent, disks_usage, vm_guid) + VALUES(v_cpu_sys, v_cpu_user, v_elapsed_time, v_usage_cpu_percent, v_usage_mem_percent, v_migration_progress_percent, v_usage_network_percent, v_disks_usage, v_vm_guid); END; $procedure$ LANGUAGE plpgsql; @@ -164,6 +165,7 @@ v_cpu_user DECIMAL(18,0) , v_elapsed_time DECIMAL(18,0) , v_usage_cpu_percent INTEGER , + v_migration_progress_percent INTEGER , v_usage_mem_percent INTEGER , v_usage_network_percent INTEGER , v_disks_usage TEXT , @@ -173,7 +175,7 @@ BEGIN UPDATE vm_statistics SET cpu_sys = v_cpu_sys,cpu_user = v_cpu_user,elapsed_time = v_elapsed_time, - usage_cpu_percent = v_usage_cpu_percent,usage_mem_percent = v_usage_mem_percent, + usage_cpu_percent = v_usage_cpu_percent,usage_mem_percent = v_usage_mem_percent, migration_progress_percent = v_migration_progress_percent, usage_network_percent = v_usage_network_percent,disks_usage = v_disks_usage, _update_date = LOCALTIMESTAMP WHERE vm_guid = v_vm_guid; END; $procedure$ -- To view, visit http://gerrit.ovirt.org/26826 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5e909b1577a26f83bf46ff14694f0ca66c32076a Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Tomas Jelinek <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
