Moti Asayag has uploaded a new change for review.

Change subject: engine: Add vnic profile name to VmNetworkInterface
......................................................................

engine: Add vnic profile name to VmNetworkInterface

The patch adds the vnic profile name to VmNetworkInterface
so clients can get information on the vnic profile without
querying the engine for that info.

Change-Id: Ie9d4a6676a7ad244ef32c6e0bc3eb5b6ed69da25
Signed-off-by: Moti Asayag <masa...@redhat.com>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNetworkInterface.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VmNetworkInterfaceDaoDbFacadeImpl.java
M packaging/dbscripts/create_views.sql
3 files changed, 18 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/67/17367/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNetworkInterface.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNetworkInterface.java
index c6df784..bf4598f 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNetworkInterface.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNetworkInterface.java
@@ -11,6 +11,7 @@
 
     private static final long serialVersionUID = -6110269859408208756L;
     private String networkName;
+    private String vnicProfileName;
     private boolean portMirroring;
     private String vmName;
     private boolean plugged = true;
@@ -41,6 +42,14 @@
 
     public String getNetworkName() {
         return networkName;
+    }
+
+    public String getVnicProfileName() {
+        return vnicProfileName;
+    }
+
+    public void setVnicProfileName(String vnicProfileName) {
+        this.vnicProfileName = vnicProfileName;
     }
 
     public void setVmName(String vmName) {
@@ -83,6 +92,8 @@
                 .append(getId())
                 .append(", networkName=")
                 .append(getNetworkName())
+                .append(", vnicProfileName=")
+                .append(getVnicProfileName())
                 .append(", vnicProfileId=")
                 .append(getVnicProfileId())
                 .append(", speed=")
@@ -114,6 +125,7 @@
         final int prime = 31;
         int result = super.hashCode();
         result = prime * result + ((getNetworkName() == null) ? 0 : 
getNetworkName().hashCode());
+        result = prime * result + ((getVnicProfileName() == null) ? 0 : 
getVnicProfileName().hashCode());
         result = prime * result + (isPortMirroring() ? 1231 : 1237);
         result = prime * result + ((getVmName() == null) ? 0 : 
getVmName().hashCode());
         result = prime * result + (isPlugged() ? 1231 : 1237);
@@ -136,6 +148,9 @@
         if (!ObjectUtils.objectsEqual(other.getNetworkName(), 
other.getNetworkName())) {
             return false;
         }
+        if (!ObjectUtils.objectsEqual(other.getVnicProfileName(), 
other.getVnicProfileName())) {
+            return false;
+        }
         if (isPortMirroring() != other.isPortMirroring()) {
             return false;
         }
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VmNetworkInterfaceDaoDbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VmNetworkInterfaceDaoDbFacadeImpl.java
index de87896..13db953 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VmNetworkInterfaceDaoDbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VmNetworkInterfaceDaoDbFacadeImpl.java
@@ -94,6 +94,7 @@
             
entity.getStatistics().setTransmitDropRate(rs.getDouble("tx_drop"));
             
entity.getStatistics().setStatus(InterfaceStatus.forValue(rs.getInt("iface_status")));
             entity.setNetworkName(rs.getString("network_name"));
+            entity.setVnicProfileName(rs.getString("vnic_profile_name"));
             entity.setPlugged(rs.getBoolean("is_plugged"));
             entity.setCustomProperties(SerializationFactory.getDeserializer()
                     .deserializeOrCreateNew(rs.getString("custom_properties"), 
LinkedHashMap.class));
diff --git a/packaging/dbscripts/create_views.sql 
b/packaging/dbscripts/create_views.sql
index 065c431..09fe6ef 100644
--- a/packaging/dbscripts/create_views.sql
+++ b/packaging/dbscripts/create_views.sql
@@ -840,7 +840,7 @@
       vm_interface.mac_addr, network.name AS network_name, vm_interface.name, 
vm_interface.vnic_profile_id, vm_static.vm_guid, vm_interface.vmt_guid,
       vm_static.vm_name, vm_interface.id, 0 AS boot_protocol, 0 AS is_vds, 
vm_device.is_plugged,
       vm_device.custom_properties, vnic_profiles.port_mirroring AS 
port_mirroring, vm_interface.linked,
-      vm_static.vds_group_id AS vds_group_id, vm_static.entity_type AS 
vm_entity_type
+      vm_static.vds_group_id AS vds_group_id, vm_static.entity_type AS 
vm_entity_type, vnic_profiles.name AS vnic_profile_name
   FROM vm_interface_statistics
   JOIN vm_interface ON vm_interface_statistics.id = vm_interface.id
   JOIN vm_static ON vm_interface.vm_guid = vm_static.vm_guid
@@ -852,7 +852,7 @@
       vm_interface.mac_addr, network.name AS network_name, vm_interface.name, 
vm_interface.vnic_profile_id, NULL::uuid as vm_guid,
       vm_interface.vmt_guid, vm_templates.vm_name AS vm_name, vm_interface.id, 
0 AS boot_protocol, 0 AS is_vds,
       vm_device.is_plugged as is_plugged, vm_device.custom_properties as 
custom_properties, vnic_profiles.port_mirroring AS port_mirroring,
-      vm_interface.linked, vm_templates.vds_group_id AS vds_group_id, 
vm_templates.entity_type AS vm_entity_type
+      vm_interface.linked, vm_templates.vds_group_id AS vds_group_id, 
vm_templates.entity_type AS vm_entity_type, vnic_profiles.name AS 
vnic_profile_name
   FROM vm_interface_statistics
   RIGHT JOIN vm_interface ON vm_interface_statistics.id = vm_interface.id
   JOIN vm_static AS vm_templates ON vm_interface.vmt_guid = 
vm_templates.vm_guid


-- 
To view, visit http://gerrit.ovirt.org/17367
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie9d4a6676a7ad244ef32c6e0bc3eb5b6ed69da25
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Moti Asayag <masa...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to