hooks: Renamed openstacknet_consts file

In order to put functions in the shared file, it is more appropriate to
name it openstacknet_utils rather than openstacknet_consts.

Change-Id: I5cf8c6ce2463e89e88b761f25801a2dcfc8a083c
Signed-off-by: Mike Kolesnik <mkolesni@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22582
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
clientIF: Log unhandled exception for new Thread

Adding a traceback log for unhandled exceptions, when openning a new thread, so
it will not die silently.  Since the log in clientIF instance is inaccessible
from the decorator, we use the default root logger.

Change-Id: I595902fd9d7b62879a4466d4f8deae55a0ed7580
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22812
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
sourceRouteThread: log unhandled exceptions

Change-Id: I23eaf7a41c8decaea64a392d58ef6ba31f24d795
Signed-off-by: Antoni S. Puimedon <asegurap@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22670
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
supervdsmServer: Run sourceRouteThread in a thread

The current code was running the sourceRouteThread main function in the
main thread instead of starting it in a thread. This probably leads to
bogus message in the supervdsm log. Now the code is doing what it was
trying to do.

Change-Id: I5eb78b57b9ae6ada9948815020ac3d5ac005d20a
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22718
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Ayal Baron <abaron@redhat.com>
Reviewed-by: Assaf Muller <amuller@redhat.com>
Reviewed-by: Yaniv Bronhaim <ybronhei@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
sourceRouteThread: Encapsulate inotify thread

sourceRouteThread defined a main function for the inotify thread, but
the thread was created and started from supervdsmServer main function.
This couple these modules, expose module implementation details, and
make both sourceRouteThread and supervdsmServer harder to understand and
maintain.

This patch move inotify thread creation boilerplate from supervdsmServer
main function to a start function in sourceRouteThread module.  The
inotify thread main function is private now, unlikely to be used from
other modules by mistake.

A nice side effect is shortening the too-big-and-growing try-block in
supervdsmServer main.

Change-Id: I38e1d402ac1c1cd4de4c3e74910244b47e7977f0
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22723
Reviewed-by: Assaf Muller <amuller@redhat.com>
Reviewed-by: Yaniv Bronhaim <ybronhei@redhat.com>
Tested-by: Yaniv Bronhaim <ybronhei@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
vdsm: prepareVolumePath payload misdetection fix

The changeset http://gerrit.ovirt.org/#/c/22324/3
used a condition too broad for its check, causing
a device path misdetection when cloud-init is used.

It is triggered in the following case:
specParams vmPayload attribute has
"file"(with content), path" non existent.
Device's (drive's) "path" is set to ''.
The code then consider the cdrom with vmPayload
a case of empty CDROM and creating it as such.
It did work before because the condition results
false when there is no 'path' in drive['specParams']
(which is the case here) and goes to the
next condition section (the right one with payload handling)

This patch provides a band-aid fix to the issue
by tightening the prepareVolumePath check.

Change-Id: Ie847eb92f28d24f4d8189e03a47cd64cc6597363
Bug-Url: https://bugzilla.redhat.com/1047356
Signed-off-by: Francesco Romani <fromani@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22925
Reviewed-by: Vinzenz Feenstra <vfeenstr@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
tests: do not check permissions on dos filesystem

commit 0b147dc2e247e787ad760ba30a8b8815eb65daca
introduced an extra step in unit tests, to check
the permissions of the files in the created filesystem.

This is fine for filesystems which support permissions,
but DOSFS/FAT/VFAT does not, then the tests on this
filesystem started to fail for no good reasons.

This patch fixes this misbehaviour by disabling the
permissions check in filesystem which do not support
them.

Change-Id: I9c14b3cc0538e2f8b09ea99a185ec86e067217f6
Signed-off-by: Francesco Romani <fromani@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22816
Reviewed-by: Vered Volansky <vvolansk@redhat.com>
Tested-by: Vered Volansky <vvolansk@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
update NIC: having no custom properies is valid

Older Engines, that preceded per-vNIC custom properties (Vdsm commit
38b1f8fb) do not send the "custom" element at all. This has to be
interpreted exactly as an empty custom element.

Bug-Url: https://bugzilla.redhat.com/1047646
Change-Id: If510f012039304ad16000d46d9d72a3e035539f5
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22922
Reviewed-by: Francesco Romani <fromani@redhat.com>
Reviewed-by: Vinzenz Feenstra <vfeenstr@redhat.com>
Reviewed-by: Assaf Muller <amuller@redhat.com>
supervdsmServer: Cleaner way to wait for signals

supervdsmServer was using silly way to wait for termination, working
around Python bug. This patch use the standard way to wait until
termination signal is received, eliminating the workaround.

Change-Id: I7f0a1fdd518df1524441fd856fc764f8dbd7cf79
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22719
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
hsm: remove master info from getStorageDomainInfo

The pool metadata doesn't belong in the storage domain information
and ovirt-engine never read those values.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1033942
Change-Id: I8c046db3884b56b57cc1bf040f3e9cc136c6d877
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22824
Reviewed-by: Ayal Baron <abaron@redhat.com>
Reviewed-by: Saggi Mizrahi <smizrahi@redhat.com>
BindingXMLRPC cleanup: Inline getServerInfo

Inlining getServerInfo because:
1) It's used exactly once
2) I'd like to avoid people using it at all. It only works
   if there's exactly one client, and only for one command
   at a time. It works for the purposes it's used, but if
   (code) users expect it to work for all cases they'd be
   in for a surprise

Change-Id: I9f19630f995c2fe9fb3e3c11e4027f22f98722ba
Signed-off-by: Assaf Muller <amuller@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22835
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
BindingXMLRPC cleanup: Remove unused variables

Change-Id: I1d36a9f71b4d192b8ba825e95055dd42fc278248
Signed-off-by: Assaf Muller <amuller@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22836
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
BindingXMLRPC bugfix: Return lastClientIface for current connection

The patch does two things:
1) Fixes a bug where lastClientIface was for the previous
   connection, and not the current one. The method to retrieve
   the last client was through a log_request LoggingMixIn
   which is invoked at the end of a response, not at the beginning.
   The patch removes the usage of that MixIn, and instead uses
   values that are updated at the beginning of the connection
2) Simplifies the 'LoggingMixin' out of the picture as its no
   longer needed

Change-Id: I36e48cc07a27f44a2b413f0e9159110404f1b0ca
Signed-off-by: Assaf Muller <amuller@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22837
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
lbvirtconnection: use root logger

Assign log variable the default logger which is the root logger.
The log of libvirtconnection is not configured in the configuration file
which cause the all the logs that using that not to be seen in the vdsm.log

The use of the root logger will make the log be seen in the vdsm.log

Change-Id: I8f1a7fd7e2dec9bb9ab037348f0276feb746b787
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22907
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
libvirtconnection: Fix a race when starting the eventloop

This patch fixes a race which occurs when setting self.run to True
only after starting the thread.

Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
Change-Id: I7cad0adfdd6c10e173888ee95ef822e1a62f7767
Reviewed-on: http://gerrit.ovirt.org/22859
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Yaniv Bronhaim <ybronhei@redhat.com>
Reviewed-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-by: Francesco Romani <fromani@redhat.com>
libvirtconnection: Fix _EventLoop.run if thread exited abnormally.

Previously if the event loop thread exited abnormally, the run variable
was left in wrong value. Now the variable is set back to False in this case.

Change-Id: I347c8eee0425ce22c3677059c6b9c68ede10f24c
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22908
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Yaniv Bronhaim <ybronhei@redhat.com>
Reviewed-by: Nir Soffer <nsoffer@redhat.com>
Updating README with vdsm-tool new api

Change-Id: I9c2f06cbb48030c1340e1a1738149c7c62e66460
Signed-off-by: Yaniv Bronhaim <ybronhei@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22910
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
vdsm: Create VMs for the POWER architecture

This includes changes necessary to create VMs in the POWER architecture
 and run ppc64 guests in x86-64 hosts. These changes are:

- Allow the architecture of a guest to be different from the host,
  in order to allow x86-64 hosts to test ppc64 specific code
- Execute x86 specific QEMU features only in x86-64 guests, like
SMBIOS, guest cpu flags and processor models, ACPI
- Create a virtual USB keyboard in ppc64 guests (this is not done
  automatically like in the x86-64)
- Create a virtual USB mouse in ppc64 guests
- Use the Standard VGA device instead of the Cirrus Logic VGA in ppc64
  guests
- Change the default drive interface to SCSI in ppc64 guests
- Increase the default memory size for fake ppc64 KVM guests
- Tests covering the PPC64 specific code

Change-Id: Iba5026f254d8212f522836f856c2027c04b1d247
Signed-off-by: Vitor de Lima <vitor.lima@eldorado.org.br>
Signed-off-by: Leonardo Bianconi <leonardo.bianconi@eldorado.org.br>
Reviewed-on: http://gerrit.ovirt.org/18718
Reviewed-by: Francesco Romani <fromani@redhat.com>
Reviewed-by: Michal Skrivanek <michal.skrivanek@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
vm: Bring back missing before_device_migrate_source hook call

During the merge of libvirtvm.py and vm.py this section of the code
somehow got removed, this patch brings it back.

Change-Id: I317ae6b0ed5a7a6fa0f959169b27339c4451b35a
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1048763
Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/23006
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
spec: fix name of qemu-img for el7

Change-Id: I7dea19ede39d68215f28a19edcbea52e062d022e
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/23025
Reviewed-by: Ohad Basan <obasan@redhat.com>
Reviewed-by: Douglas Schilling Landgraf <dougsland@redhat.com>