@@ -88,8 +88,6 @@ private void validate(APIGetEipAttachableVmNicsMsg msg) {
88
88
}
89
89
90
90
private void validate (final APIAttachEipMsg msg ) {
91
- isVmNicUsed (msg .getVmNicUuid ());
92
-
93
91
SimpleQuery <EipVO > q = dbf .createQuery (EipVO .class );
94
92
q .select (EipVO_ .state , EipVO_ .vmNicUuid , EipVO_ .vipIp );
95
93
q .add (EipVO_ .uuid , Op .EQ , msg .getEipUuid ());
@@ -110,14 +108,6 @@ private void validate(final APIAttachEipMsg msg) {
110
108
));
111
109
}
112
110
113
- q = dbf .createQuery (EipVO .class );
114
- q .add (EipVO_ .vmNicUuid , Op .EQ , msg .getVmNicUuid ());
115
- if (q .isExists ()) {
116
- throw new ApiMessageInterceptionException (errf .stringToOperationError (
117
- String .format ("the VM nic[uuid:%s] already has another EIP attached" , msg .getVmNicUuid ())
118
- ));
119
- }
120
-
121
111
String vipIp = t .get (2 , String .class );
122
112
isVipInVmNicSubnet (vipIp , msg .getVmNicUuid ());
123
113
@@ -167,18 +157,6 @@ private void validate(APIDeleteEipMsg msg) {
167
157
}
168
158
}
169
159
170
- private void isVmNicUsed (String vmNicUuid ) {
171
- SimpleQuery <EipVO > eq = dbf .createQuery (EipVO .class );
172
- eq .select (EipVO_ .uuid );
173
- eq .add (EipVO_ .vmNicUuid , Op .EQ , vmNicUuid );
174
- String eipUuid = eq .findValue ();
175
- if (eipUuid != null ) {
176
- throw new ApiMessageInterceptionException (errf .instantiateErrorCode (SysErrors .OPERATION_ERROR ,
177
- String .format ("vm nic[uuid:%s] has attached to another eip[uuid:%s]" , vmNicUuid , eipUuid )
178
- ));
179
- }
180
- }
181
-
182
160
private void isVipInVmNicSubnet (String eipIp , String vmNicUuid ) {
183
161
SimpleQuery <VmNicVO > q = dbf .createQuery (VmNicVO .class );
184
162
q .select (VmNicVO_ .gateway , VmNicVO_ .netmask );
@@ -212,10 +190,6 @@ private void checkIfVmAlreadyHasVipNetwork(String vmUuid, VipVO vip) {
212
190
}
213
191
214
192
private void validate (APICreateEipMsg msg ) {
215
- if (msg .getVmNicUuid () != null ) {
216
- isVmNicUsed (msg .getVmNicUuid ());
217
- }
218
-
219
193
VipVO vip = dbf .findByUuid (msg .getVipUuid (), VipVO .class );
220
194
if (vip .getUseFor () != null ) {
221
195
throw new ApiMessageInterceptionException (errf .instantiateErrorCode (SysErrors .OPERATION_ERROR ,
@@ -230,14 +204,6 @@ private void validate(APICreateEipMsg msg) {
230
204
}
231
205
232
206
if (msg .getVmNicUuid () != null ) {
233
- SimpleQuery <EipVO > q = dbf .createQuery (EipVO .class );
234
- q .add (EipVO_ .vmNicUuid , Op .EQ , msg .getVmNicUuid ());
235
- if (q .isExists ()) {
236
- throw new ApiMessageInterceptionException (errf .stringToOperationError (
237
- String .format ("the VM nic[uuid:%s] already has another EIP attached" , msg .getVmNicUuid ())
238
- ));
239
- }
240
-
241
207
isVipInVmNicSubnet (vip .getIp (), msg .getVmNicUuid ());
242
208
243
209
SimpleQuery <VmNicVO > nicq = dbf .createQuery (VmNicVO .class );
0 commit comments