mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
SecurityGroupDao: do join with "nics" table instead of "user_vm" as we keep ip address information in nics.
This commit is contained in:
parent
1a81515566
commit
1966b4f449
@ -16,8 +16,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.cloud.network.security;
|
package com.cloud.network.security;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
@ -29,66 +29,62 @@ import javax.persistence.SecondaryTables;
|
|||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import com.cloud.vm.VirtualMachine.State;
|
import com.cloud.vm.VirtualMachine.State;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name=("security_group_vm_map"))
|
@Table(name = ("security_group_vm_map"))
|
||||||
@SecondaryTables({
|
@SecondaryTables({ @SecondaryTable(name = "nics", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "instance_id", referencedColumnName = "instance_id") }),
|
||||||
@SecondaryTable(name="user_vm",
|
@SecondaryTable(name = "vm_instance", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "instance_id", referencedColumnName = "id") }),
|
||||||
pkJoinColumns={@PrimaryKeyJoinColumn(name="instance_id", referencedColumnName="id")}),
|
@SecondaryTable(name = "security_group", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "security_group_id", referencedColumnName = "id") }) })
|
||||||
@SecondaryTable(name="vm_instance",
|
public class SecurityGroupVMMapVO {
|
||||||
pkJoinColumns={@PrimaryKeyJoinColumn(name="instance_id", referencedColumnName="id")}),
|
@Id
|
||||||
@SecondaryTable(name="security_group",
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
pkJoinColumns={@PrimaryKeyJoinColumn(name="security_group_id", referencedColumnName="id")})
|
@Column(name = "id")
|
||||||
})
|
private Long id;
|
||||||
public class SecurityGroupVMMapVO {
|
|
||||||
@Id
|
@Column(name = "security_group_id")
|
||||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
private long securityGroupId;
|
||||||
@Column(name="id")
|
|
||||||
private Long id;
|
@Column(name = "instance_id")
|
||||||
|
|
||||||
@Column(name="security_group_id")
|
|
||||||
private long securityGroupId;
|
|
||||||
|
|
||||||
@Column(name="instance_id")
|
|
||||||
private long instanceId;
|
private long instanceId;
|
||||||
|
|
||||||
@Column(name="guest_ip_address", table="user_vm", insertable=false, updatable=false)
|
@Column(name = "ip4_address", table = "nics", insertable = false, updatable = false)
|
||||||
private String guestIpAddress;
|
private String guestIpAddress;
|
||||||
|
|
||||||
@Column(name="state", table="vm_instance", insertable=false, updatable=false)
|
@Column(name = "state", table = "vm_instance", insertable = false, updatable = false)
|
||||||
private State vmState;
|
private State vmState;
|
||||||
|
|
||||||
@Column(name="name", table="security_group", insertable=false, updatable=false)
|
@Column(name = "name", table = "security_group", insertable = false, updatable = false)
|
||||||
private String groupName;
|
private String groupName;
|
||||||
|
|
||||||
public SecurityGroupVMMapVO() { }
|
public SecurityGroupVMMapVO() {
|
||||||
|
|
||||||
public SecurityGroupVMMapVO(long securityGroupId, long instanceId) {
|
|
||||||
this.securityGroupId = securityGroupId;
|
|
||||||
this.instanceId = instanceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getSecurityGroupId() {
|
|
||||||
return securityGroupId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGuestIpAddress() {
|
|
||||||
return guestIpAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getInstanceId() {
|
|
||||||
return instanceId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getVmState() {
|
public SecurityGroupVMMapVO(long securityGroupId, long instanceId) {
|
||||||
return vmState;
|
this.securityGroupId = securityGroupId;
|
||||||
}
|
this.instanceId = instanceId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getGroupName() {
|
public Long getId() {
|
||||||
return groupName;
|
return id;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public long getSecurityGroupId() {
|
||||||
|
return securityGroupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGuestIpAddress() {
|
||||||
|
return guestIpAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getInstanceId() {
|
||||||
|
return instanceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public State getVmState() {
|
||||||
|
return vmState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupName() {
|
||||||
|
return groupName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user