core: adding "NetworkLinkingSupported" to vdc_options.

Changing LinkState is supported only for 3.2 cluster version.

Change-Id: I143f3849e9126ec4125defb9d3fa8f3c241b0583
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core: HotPlugEnabled shouldn't be reloadable.

We shouldn't allow modifying this property.

Change-Id: I5e9031e8fa1148d65eaa4d36b79d4a57ed9565a1
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core,ui: add/update linking bll-error messages.

UNLINKING_IS_NOT_SUPPORTED
NULL_NETWORK_IS_NOT_SUPPORTED
NETWORK_CANNOT_CHANGE_STATUS_WHEN_NOT_DOWN_UP
HOT_VM_INTERFACE_UPDATE_IS_NOT_SUPPORTED
CANNOT_PERFOM_HOT_UPDATE
CANNOT_PERFOM_HOT_UPDATE_WITH_PORT_MIRRORING

- update the related AppError files.

Change-Id: I7eec8709aeb43367f9d33b3e1202943aad5d1c91
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core: Add hashCode, equals & toString to ValidationResult

Added these methods to allow testing with this class (and for ease of
test/debug messages).

Change-Id: Iafb909a84ba344e102b9a6c9a166ed8d941511c6
Signed-off-by: Mike Kolesnik <mkolesni@redhat.com>
engine: Added variable replacements to ValidationResult

Added a possibility to include variable replacements in the validation
result, so that variables inside the validation failure message can be
replaced with the given values.

This should make it easier to use validations that require variable
replacements inside the message.

Change-Id: I2ef15a9454cac7ea179fdbac0003944bc0327dcc
Signed-off-by: Mike Kolesnik <mkolesni@redhat.com>
engine: Added VM NIC validator

Validator will be used to check if the NIC is valid for unlinking or for
setting no network on it.

Change-Id: Ib4b5ddd5530fd1435bec471f9b07aa7858abe172
Signed-off-by: Mike Kolesnik <mkolesni@redhat.com>
core: add NetworkLinking to AddVmInterfaceCommand

- canDoAction-
If "UnlinkingSupported" is false for the cluster compatibility version.
- block 'null' network.
- block unlinking.

If "UnlinkingSupported" is true
- allow 'null' network.

Change-Id: I4f804e0d3117eed22814a8397d0fee12dd9e1347
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core: add NetworkLinking support to RunVm command.

- If "linked" property on VmNetworkInterface is true
 'linkActive-> true' should be sent to the vdsm
Otherwise-
 'linkActive-> false' should be sent to the vdsm

- If network name is null it should be sent.

- Avoid NPE in vdsSelector.

Change-Id: Ib9805b18c364685a6533b89cfa31ae0575a00ea5
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core: 'No Network' on a Vnic should be marked as null and not empty String.

If on importVm, the VM has Nics with non valid Network, the Network
was deleted by setting it to empty String.

Since NetworkLinking feature, the convention is to mark no-network as null
and not as empty String.

Change-Id: Ia802fc81be7d65d3f4039e757646918aae5dc0a3
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core: HotPlugNicVDSCommand should send "linkActive" to the vdsm.

- If "linked" property on VmNetworkInterface is true
 'linkActive-> true' should be sent to the vdsm
Otherwise-
 'linkActive-> false' should be sent to the vdsm

- If network name is null it should be sent.
- CanDo should allow null network.

Change-Id: I127fc3202702f8cb1920990eb77d9fbccdb9804b
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
engine: DetachNetworkToVdsGroup for NetworkLinking

This patch makes sure NPEs are avoided due to the new
option for a VmNetworkInterface to have an empty Network
name.

Change-Id: I088b759698f1032c1236f93f96afe04fbb63a256
Signed-off-by: Muli Salem <msalem@redhat.com>
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core: add NetworkLinking to ChangeVMClusterCommand

When changing the VM Cluster-
if the new Cluster doesn't support NetworkLinking and the VM has Vnics with
1. No network (null)- it is allowed.
   CanDoAction will be thrown when the user will try to run the vm.
2. Unlinked Network- canDoAction is thrown.

Change-Id: Icc3dd865ccd99f23862db4f4a37aa5e816db3214
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core: add NetworkLinking to AddVmTemplateCommand

Linked property on VmNetworkInterface should also be saved on the
template.

Change-Id: Ie20322ec1183877fbbcb9a004026a08a38b306f7
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core: add NetworkLinking to AddVmTemplateInterfaceCommand

- canDoAction-
If "UnlinkingSupported" is false for the cluster compatibility version.
- block 'null' network.
- block unlinking.

If "UnlinkingSupported" is true
- allow 'null' network.

Change-Id: Id39e63f5061b694457de5918490e08bce3fb962c
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core: add NetworkLinking to UpdateVmTemplateInterfaceCommand

- canDoAction-
If "UnlinkingSupported" is false for the cluster compatibility version.
- block 'null' network.
- block unlinking.

Change-Id: I8b22b20aeb4860226311c1691c6e684c72a07970
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core: allow editing VmInterface while the VM is running.

NetworkLinking feature allows editig a VM while it is UP.

Change-Id: I6870491156f264079c60d63c0d9321e9b4364192
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core: adding AbstractVmInterfaceCommand

This command will contain common logic of VmIntrefaceCommands.

For now, the logic of internaly calling activateNic (called from
AddVmInterfaceCommnad and will be called from UpdateVmInterfaceCommanf in
the future) was moved to AbstractVmInterfaceCommand.

In the future other common logic can be placed here.

Change-Id: I15acf7c715703582e96274f4621239b33d263172
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core: adding VdsmError for failure on VmUpdateDevice on Vnic.

If the vdsm fails to update the Vnic via VmUpdateDevice the error
UPDATE_VNIC_FAILED (translated to- Failed to update VM Network Interface.)
will be thrown.

Change-Id: I8e081a127fb39fa5c188d9f6b17a5fe0ca52c25b
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
engine: Rename HotPlugUnplgNicVDSParameters

Renamed the parameters to VmNicDeviceVDSParameters so that they can be
used in other commands that need the same combination of parameters.

Change-Id: Ie9f956a2dc00cfded652682a39521bf901917369
Signed-off-by: Mike Kolesnik <mkolesni@redhat.com>
core: create UpdateVmInterfaceVDSCommand

The command will be called from UpdateVmInterfaceCommand.
It will be used to hot-update a vnic on a running vm.
The fields that can be updated are-
network
linked (link state)

Change-Id: Idc54fedde0fdf6ea9694fc19977bf1178e73efdf
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>