change the style of supervdsm.py code in order to comply with PEP 8

Change-Id: I6b788d55c3b3dbfe95fb35f95edeab5ae81fc7cc
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/3800
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
Remove (almost all) class Volume virtual (!) methods.

Change-Id: Ib14c4d398aa68edbd9a413506b2cc4d8615c686b
Signed-off-by: Eduardo <ewarszaw@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/3461
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
BZ#813423: Adding ENGINENAME macro

To help backward compatibility, let's create ENGINENAME macro which
will contain the engine name.

Change-Id: Ibb9876fba6d1de0b2a2295cd0e301219f0e04bdd
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/3761
Reviewed-by: Bruce Bai <baichm@linux.vnet.ibm.com>
Reviewed-by: Shu Ming <sming56@gmail.com>
Reviewed-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Clean the RHEVM log message in vdsm-reg-setup-in

Change-Id: If89fe6cd3d3e27976b537c304417c59ede8cb633
Signed-off-by: Shu Ming <shuming@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/3798
Reviewed-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
Don't use qemu-img to create sparse file volumes

It's not required to run volume.createVolume when we are creating a
sparse file volume (see createSparseFile few lines above).

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Change-Id: I11e705319ae4c0c5c5823c52ee54d20e90923c22
Reviewed-on: http://gerrit.ovirt.org/3626
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
Add volumeExists to the StorageDomain class

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Change-Id: I5f85832051d249e5cf059f20f87587030184681f
Reviewed-on: http://gerrit.ovirt.org/3625
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
Make blkid.py pep8 clean

Change-Id: I3235a38017aae5d353587bf0584db953885421a8
Signed-off-by: Shu Ming <shuming@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/3818
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Igor Lvovsky <ilvovsky@redhat.com>
add 2 info tests to hooks tests

Change-Id: I3de260d82f79301073e92aa18f53fba767a4175e
Signed-off-by: y kaplan <ykaplan@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/3819
Tested-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Improve usage for bridgeless network

The usage of add/del network is still for bridge only network,
It is useless and may cause confusion. So change it to keep
consistence with current network.

Change-Id: I4f03f9a331062adc662d22ef4ad5a5b582a07835
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/3664
Reviewed-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Reviewed-by: Dmitry Fleytman <dmfleytman@gmail.com>
Tested-by: Dmitry Fleytman <dmfleytman@gmail.com>
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Related to BZ#773210 - Avoid infinite loop when delete volume failed during the merge.

This loop occurs at the end of the merge operation and if we failed
to remove remnants at this point it's still OK.

Change-Id: I447c71ef9d4e9e672de2470bd571c1ae60d4715f
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/3774
Reviewed-by: Eduardo <ewarszaw@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dmitry Fleytman <dmfleytman@gmail.com>
Make API.py conform to pep8

v1->v2
    - Modify all the place to follow the rule that break around
      a binary operator after the operator, and other small errors
      suggested by Saggi.

Change-Id: I9549186e537ba23994891e27b58be3d6d3770f40
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/3561
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Tested-by: Igor Lvovsky <ilvovsky@redhat.com>
Added getDevicePartedInfo function in supervdsm.

This function accepts device path and returns its information as
dictionary.  Sample return value is,

{'model': 'Virtio Block Device',
 'sectorSize': 512L,
 'type': 'gpt',
 'freeSpaceRegions': [(34L, 2047L, 2014L, 1031168L),
                      (16775168L, 16777182L, 2015L, 1031680L)],
 'partitions': {'/dev/vda1': (['bios_grub'], 2048L, 4095L),
                '/dev/vda2': (['boot'], 4096L, 16285695L),
                '/dev/vda3': ([], 16285696L, 16775167L)}}

Change-Id: I6388d6c112abf106471223101be495f20f157c66
Signed-off-by: Bala.FA <barumuga@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/3386
Tested-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Timothy Asir <tjeyasin@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
API.py: fix pep8 noise

commit a35c862341a4fa05e6 did not manage to completely make API.py
conform to pep8, at least not with python-pep8-0.6.0-3.fc15.noarch

Change-Id: Ibd3fd81ce563c748b299a5adf316a4623f17b565
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/3852
tests:miscTests add integer input test for validateUUID

Change-Id: I5c22aa6853c55f74c3128e4dd46136ea0ade29c5
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/3848
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Tested-by: Igor Lvovsky <ilvovsky@redhat.com>
tests/misc: add utf-8 string test to validateUUID

As requested, add a test case with a Chinese UTF-8 string.

Change-Id: I7e07af6ce9df8b0bd3e4554a8baa8131486a00df
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/3849
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Added getMdDeviceUuidMap function in supervdsm.

getMdDeviceUuidMap function returns all md/uuid map.  Sample return value
is,

{'/dev/md0': 'e35641fc:621a9fa8:123456e4:a1bc6b5f',
 '/dev/md1': '95451662:3945780b:123456a7:f3ad55c5'}

Change-Id: I1970fa0ad9125c29b4a96fa614c580682ac5064c
Signed-off-by: Bala.FA <barumuga@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/3469
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
vdsm/storage/misc.py: ensure uuid input is str or unicode for regex

When abusing the createVolume() method by passing numeric values
as UUIDs, the validation regex needs a string to process and
throws an exception when it isn't:

Traceback (most recent call last):
  File "/usr/share/vdsm/storage/task.py", line 861, in _run
    return fn(*args, **kargs)
  File "/usr/share/vdsm/logUtils.py", line 38, in wrapper
    res = f(*args, **kwargs)
  File "/usr/share/vdsm/storage/hsm.py", line 1206, in createVolume
    misc.validateUUID(imgUUID, 'imgUUID')
  File "/usr/share/vdsm/storage/misc.py", line 525, in validateUUID
    m = UUID_REGEX.match(uuid)
TypeError: expected string or buffer

And on the client side, I get a less than useful error:

Traceback (most recent call last):
  File "create_a_vm.py", line 98, in <module>
    BLANK_UUID, BLANK_UUID))
  File "create_a_vm.py", line 19, in vdsOK
    raise Exception(str(d))
Exception: {'status': {'message': "Error creating a new volume: ('sdUUID=99d43d50-5946-4451-8e12-9d85cb426e19, spUUID=150e55ab-e68c-411c-af30-587071905216, imgUUID=4194304, size=4, volFormat=2, preallocate=rootfs, diskType=7bdf7b4b-4909-41ce-a9c0-9bc06ba045fe, volUUID=00000000-0000-0000-0000-000000000000, desc=00000000-0000-0000-0000-000000000000, srcImgUUID=00000000-0000-0000-0000-000000000000, srcVolUUID=00000000-0000-0000-0000-000000000000',)", 'code': 205}}

We can test that the input is str or unicode before attempting to regex
if it's something else, raise an exception.

Now, I get:

Traceback (most recent call last):
  File "create_a_vm.py", line 98, in <module>
    BLANK_UUID, BLANK_UUID))
  File "create_a_vm.py", line 19, in vdsOK
    raise Exception(str(d))
Exception: {'status': {'message': "Invalid parameter: 'imgUUID=4194304'", 'code': 1000}}

Which explains to me my error quite well.

V2 -> V3:
    - change check to use isinstance(s, basestring) per Dan Kenigsberg
V1 -> V2:
    - Fix case where we pass in a string, but it's not a UUID as
      Reported by Dan Kenigsberg <danken@redhat.com>

Change-Id: If16466e88a50d3af03ae7830d4d8148ebf69d0d9
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/3687
Tested-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
vds_bootstrap: allowing the options n and u as paratemers

Previous patch removed dead code, thus removing the options "n" and "u"
from the vds_bootstrap, and it broke backward compatibility (old engine
couldn't install new clients).

Change-Id: Ia39774898052957a3e3c83536cb90e4a2d8a957d
Signed-off-by: Oved Ourfali <oourfali@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/3857
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Douglas Schilling Landgraf <dougsland@redhat.com>
vds_bootstrap: changing the default to install virt to true

Preivous patch added an option "-v" to enable virt installation.
This made issues in backward compatability, as old engine couldn't
install new client. Passing now -V to disable virt installation.

Change-Id: Ie4b1f63309db0ac624944c5432e52d0ce3781770
Signed-off-by: Oved Ourfali <oourfali@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/3858
Reviewed-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
spec: remove the conflicts of ovirt-engine from vds_bootstrap section

This commit removes the conflicts of ovirt-engine < 3.1 from the
vds_bootstrap section in the spec file, as it is no longer needed.

Change-Id: Ic70024ebb9c0226bf411a2fcb58a9dc0f9409878
Signed-off-by: Oved Ourfali <oourfali@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/3859
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Douglas Schilling Landgraf <dougsland@redhat.com>