engine: Fixing saveOrUpdate qmethod in AsyncTaskUtils

The following patch should solve a bug, when async_task_entities
table never filled.
The bug was caused because of using a wrong API, so a fix is start to use
a correct API and remove unused APIs

Change-Id: I8874a4222ac17ecc4ca9de3fbccc18e16efe20c8
Signed-off-by: Michael Kublin <mkublin@redhat.com>
engine: Improving GetAsyncTasksByStoragePoolId query

The following patch will simplify a query, we don't need to make any join,
access to async_tasks table is enough

Change-Id: I295291a2ac84e021b7354a3fd072ba5534af533d
Signed-off-by: Michael Kublin <mkublin@redhat.com>
engine: Replacing call to host by query

The following patch should replace a call to host by query during moving host to maintenance.
All task should be kept in Db so no need to perform an XML RPC call.
Query to DB is much more efficient and faster.

Change-Id: I1e864961ab05538bd565d74f31869f64aa40b758
Signed-off-by: Michael Kublin <mkublin@redhat.com>
engine: Imroving updates of vds dynamic

The following patch is removing call for UpdateVdsDynamicData command in order to
update net_config_dirty field.

The change is make a simple update instead of:
1. Run query for VdsDynamic
2. Acquire lock on VdsManager
3. Perform update

Change-Id: Ic9e76b6ddd20ebd36a00d68b44da3a3a954ad87d
Signed-off-by: Michael Kublin <mkublin@redhat.com>
engine: Improving update of vds dynamic data - status

Instead of updating all vds dynamic data we can update only its status

Change-Id: I59c0c1c34c7c9ddcb481fda17decc91875eb1638
Signed-off-by: Michael Kublin <mkublin@redhat.com>
restapi : Add permit to role issues(#919202)

When trying to add permit to role the permit
name needs to accept both lower case and upper
case names.

Change-Id: I7ae176b9b6d60b4f8a51c16354ec6210f13870c9
Bug-Url: https://bugzilla.redhat.com/919202
Signed-off-by: Ravi Nori <rnori@redhat.com>
webadmin: It is not possible add non-operational network to vNic of vm.

Removed the if that avoided adding the non-operational networks to the
network list.

Change-Id: I6183a5abcddc343323b82c39111de9f2f1ba5166
Bug-Url: https://bugzilla.redhat.com/948160
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
engine: Removing EvenlyDistributeVDComparer

The following class is not in use anymore

Change-Id: I76739488192cf13bc5d6356f9feda6f452d6edf4
Signed-off-by: Michael Kublin <mkublin@redhat.com>
engine: "dual mode" on vm with agent should be reported as "virtio"

vnic with "dual mode" on vm with an agent should be reported to the vdsm as
"virtio" only.
Currently, there is a leftover code that prepares also an interface with
"rtl8139" type. But does nothing with it. So there is not a real bug,
just a code fix.

Also, the vm.getHasAgent() returned false even if there is an agent on the
vm.

The cause of the bug is that the guest-agent-version was updated in
the RunVmCommand.attachCd method only if there was an active ISO domain in
the dc.
In this patch the guest agent version update was moved to the runVm method
to make sure the version is always updated when trying to run the vm.

Change-Id: I072ee66172027d5b4bea1b0ff2f0033d69bf6111
Bug-Url: https://bugzilla.redhat.com/923889
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
restapi : Error when adding/removing permissions with filtered api(#919686)

Internal server error when UserVmManager adds a User role permission on a VM,
the permission gets added.

Insufficent privileges error when removing the permission which was added.

Change-Id: I47cbb6e06599fc64afcb491bef15b46a82afd681
Bug-Url: https://bugzilla.redhat.com/919686
Signed-off-by: Ravi Nori <rnori@redhat.com>
restapi: Use DbUser.isGroup() properly

Replaced an explicit string check on DbUser's user name with the BE's
method isGroup().

This achieves two goals:
1. It's easier to understand.
2. It removes a dependency on the deprecated StringHelper.

Change-Id: Ib17d50003d2b1425db9a2fc17c206da2d4db5de7
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Remove StringHelper usages in jaxrs module

Removed all the usages of the deprecated StringHelper class and replaced
them with standard calls to StringUtils.

Change-Id: I86d4266462bb936db9be551a1a321cdcb8f5929f
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Remove StringHelper usages in types module

Removed all the usages of the deprecated StringHelper class and replaced
them with standard calls to StringUtils.

Change-Id: If571a276077252672577f63b160a95c81f8bdeb4
Signed-off-by: Allon Mureinik <amureini@redhat.com>
restapi: Added mapping to derived classes of VdsNetworkInterface

The mapping now uses Bond, Vlan and Nic. This to enable specific bean
validation, etc.

Change-Id: Iaabecc4d723923506e98cd3bc397ad406c4ef5c0
Signed-off-by: Lior Vernia <lvernia@redhat.com>
restapi: Removed unused import that broke the build

Not sure how it got there...

Change-Id: I71d6c34cdf29ab63efb4f0553cb58b84e9b3b5ac
Signed-off-by: Lior Vernia <lvernia@redhat.com>
core: monitoring - don't handle devices for MigratingTo VMs

There is no point of trying to update devices of migrating VM. This
could wait when the VM will be up. its consistent with the same
behaviour of ignoring
the state of VMs with status MigratingTo.

Change-Id: I33087d86c4f41d781331d1879297350d3483728f
Signed-off-by: Roy Golan <rgolan@redhat.com>
Bug-Url: https://bugzilla.redhat.com/922490
core: fix build error

Change-Id: I669480a591095e84ebdb0b4624424bd3ba177ac6
Bug-Url: http://bugzilla.redhat.com/922490
Signed-off-by: Roy Golan <rgolan@redhat.com>
core:restore.sh fails to drop existing database...

restore.sh fails to drop existing database and continues running

Adding a check on the dropdb command status and existing if not
succeeded.

Change-Id: If9d33e0011cdac6bb0d9b153cc4f4a118c7b4aaf
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=929359
Signed-off-by: Eli Mesika <emesika@redhat.com>
packaging: engine-service: do not clean environment

the init system may put important variables in environment.

add LC_ALL as java is effected by AC_CTYPE per defaults of string
conversions, as if it is set by init it will effect us.

in practice we should only set LC_CTYPE or use jnu.encoding, when
we are sure that no default locale is used for conversions within
application.

Change-Id: Ia8231b343574df83e65c55d9ffa75698a3f2d692
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
packaging: engine-service: remove unused tmpfiles config

Change-Id: I81175c21f018be180157ffcaadef1dd28ee8801c
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>