Change in vdsm[master]: after_vm_start: migrate to jsonrpcvdsli

2016-10-19 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: after_vm_start: migrate to jsonrpcvdsli
..


Patch Set 5: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/62713
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I66bd62164594c83167e8e72081325ff60d1c0cb0
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Irit Goihman 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Michael Burman 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: virt: Migration plugins to enable skipping of special OVS pr...

2016-10-04 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: virt: Migration plugins to enable skipping of special OVS 
processing for nics
..


Patch Set 2:

The hook (vm_migrate_hook.py) was added as part of OVS support 
(https://gerrit.ovirt.org/#/c/59645/).
Whether that was a good or bad choice is out of the scope of this patch.
The problem with the original solution is that it breaks some hooks like vmfex 
or openstack.
This patch is not bringing ovs support, but fixing an issue which ovs support 
has introduced.
jsonrpc connections are not part of this patch, but part of the OVS support 
patch, and doing anything about them is not the intent of this patch.

The purpose of this patch is only to allow to exclude some interfaces from the 
special OVS interface handling.

-- 
To view, visit https://gerrit.ovirt.org/64186
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia0fb056c4b4732505d567385546e78048c37d140
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Michal Skrivanek 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: draft: vm_migration_libvirt_hook_plugins

2016-10-03 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: draft: vm_migration_libvirt_hook_plugins
..


Patch Set 4:

During vm migration we invoke a libvirt hook: vm_migrate_hook.py.
This was added recently, and adds some special ovs handling to our vNics.
But, this change broke all hooks which relied on modifying the nic domxml, 
like: vmfex, openstack, and now the ovn hook.
These hooks applied custom changes to the NIC xml.
These custom changes were now lost, as a result of vm_migrate_hook applying the 
special ovs handling.
So we needed a way to disable this special handling for some of the NICs.
To be able to do it for any hooks, we needed something easily extendable (as 
for example this could break future external network providers), so we went for 
plugins.
We tried some other options (like using the existing vdsm hooks) but these 
looked even worse.

Please note that this is not something that introduces something new, but 
something which tries to fix the functionality broken by introducing the 
libvirt hook.
So far everyone agrees that this is not a nice solution, but so far no one was 
able to suggest any better.
If you don't agree with the way this is solved, please suggest a nicer 
alternative.

-- 
To view, visit https://gerrit.ovirt.org/64001
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I7e13a94fa28968e37cd2d4d99fe540c8b762f7cc
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Michal Skrivanek 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: virt: Migration plugins to enable skipping of special OVS pr...

2016-10-03 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: virt: Migration plugins to enable skipping of special OVS 
processing for nics
..


Patch Set 2:

(1 comment)

https://gerrit.ovirt.org/#/c/64186/2//COMMIT_MSG
Commit Message:

PS2, Line 11: plugins
> "pluginS", yet I see only __init__.py. Is that intended?
This should probably replaced by:
'The plugin mechanism'

The actual plugins will be added as part of the hooks (in separate patches).

The one's we need now will be in:
- vdsm_hooks/vmfex
- vdsm_hooks/openstacknet
and in the upcoming OVN network provider.

Once this has your +1 (or at least some other form of acceptance of the way we 
do it), I will provide all the plugins, and verify the complete solution.


-- 
To view, visit https://gerrit.ovirt.org/64186
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia0fb056c4b4732505d567385546e78048c37d140
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: virt: Migration plugins to enable skipping of special OVS pr...

2016-09-20 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: virt: Migration plugins to enable skipping of special OVS 
processing for nics
..


Patch Set 2:

(8 comments)

This was just a quick and dirty draft to show the concept :(
This version should be better.

https://gerrit.ovirt.org/#/c/64186/1/vdsm/virt/vm_migrate_hook.py
File vdsm/virt/vm_migrate_hook.py:

Line 27: from vdsm import jsonrpcvdscli
Line 28: from vdsm.config import config
Line 29: from vdsm.network import api as net_api
Line 30: 
Line 31: import vm_migrate_plugins
> I like this simplistic approach.
Done
Line 32: 
Line 33: 
Line 34: _DEBUG_MODE = False
Line 35: LOG_FILE = '/tmp/libvirthook_ovs_migrate.log'


PS1, Line 87: target_vm_conf_by_vni
> Can you add the 'vnic' part? ..by_vnic_mac
Done


PS1, Line 100: target_vm_ifac
> How about: 'target_vm_iface_conf' ?
Done


Line 98: vnic_mac_addr = elem_macaddr.get('address')
Line 99: 
Line 100: target_vm_iface_conf = target_vm_conf_by_vnic_mac[vnic_mac_addr]
Line 101: target_vm_net = target_vm_iface_conf['network']
Line 102: 
> It's a bit nicer to go with the positive one and just bail out earlier with
Done
Line 103: if vm_migrate_plugins.skip_processing(interface, 
target_vm_iface_conf):
Line 104: return
Line 105: 
Line 106: target_ovs_bridge = net_api.ovs_bridge(target_vm_net)


https://gerrit.ovirt.org/#/c/64186/1/vdsm/virt/vm_migrate_plugins/__init__.py
File vdsm/virt/vm_migrate_plugins/__init__.py:

Line 18
Line 19
Line 20
Line 21
Line 22
> please place new code under lib/vdsm
Done


PS1, Line 27: 
> _PLUGINS
Done


Line 26
Line 27
Line 28
Line 29
Line 30
> domxml_iface or something similar.
Done


Line 31
Line 32
Line 33
Line 34
Line 35
> You will need a decorator:
I'm dropping the class completely and invoking 'skip_processing' on the plugin 
itself.


-- 
To view, visit https://gerrit.ovirt.org/64186
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia0fb056c4b4732505d567385546e78048c37d140
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: draft: migration plugin proposal - draft 102

2016-09-20 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: draft: migration plugin proposal - draft 102
..

draft: migration plugin proposal - draft 102

Just a draft to show the idea, not verified

Change-Id: Ia0fb056c4b4732505d567385546e78048c37d140
Signed-off-by: mirecki 
---
M vdsm/virt/vm_migrate_hook.py
A vdsm/virt/vm_migrate_plugins/__init__.py
A vdsm/virt/vm_migrate_plugins/external_network_plugin.py
A vdsm/virt/vm_migrate_plugins/openstack_network_plugin.py
A vdsm/virt/vm_migrate_plugins/vm_fex_plugin.py
5 files changed, 161 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/86/64186/1

diff --git a/vdsm/virt/vm_migrate_hook.py b/vdsm/virt/vm_migrate_hook.py
index 633e4f0..dd276f5 100755
--- a/vdsm/virt/vm_migrate_hook.py
+++ b/vdsm/virt/vm_migrate_hook.py
@@ -28,6 +28,8 @@
 from vdsm.config import config
 from vdsm.network import api as net_api
 
+import vm_migrate_plugins
+
 
 _DEBUG_MODE = False
 LOG_FILE = '/tmp/libvirthook_ovs_migrate.log'
@@ -82,24 +84,28 @@
 
 
 def _set_bridge_interfaces(devices, target_vm_conf):
-target_vm_nets_by_vnic_mac = {dev['macAddr']: dev['network']
-  for dev in target_vm_conf['devices']
-  if dev.get('type') == 'interface'}
+target_vm_conf_by_mac = {dev['macAddr']: dev
+ for dev in target_vm_conf['devices']
+ if dev.get('type') == 'interface'}
+
 for interface in devices.findall('interface'):
 if interface.get('type') == 'bridge':
-_bind_iface_to_bridge(interface, target_vm_nets_by_vnic_mac)
+_bind_iface_to_bridge(interface, target_vm_conf_by_mac)
 
 
-def _bind_iface_to_bridge(interface, target_vm_nets_by_vnic_mac):
+def _bind_iface_to_bridge(interface, target_vm_conf_by_mac):
 elem_macaddr = interface.find('mac')
 mac_addr = elem_macaddr.get('address')
 
-target_vm_net = target_vm_nets_by_vnic_mac[mac_addr]
-target_ovs_bridge = net_api.ovs_bridge(target_vm_net)
-if target_ovs_bridge:
-_bind_iface_to_ovs_bridge(interface, target_ovs_bridge, target_vm_net)
-else:
-_bind_iface_to_linux_bridge(interface, target_vm_net)
+interface_conf = target_vm_conf_by_mac[mac_addr]
+target_vm_net = interface_conf['network']
+if not vm_migrate_plugins.skip_processing(interface, interface_conf):
+target_ovs_bridge = net_api.ovs_bridge(target_vm_net)
+if target_ovs_bridge:
+_bind_iface_to_ovs_bridge(interface, target_ovs_bridge,
+  target_vm_net)
+else:
+_bind_iface_to_linux_bridge(interface, target_vm_net)
 
 
 def _bind_iface_to_ovs_bridge(interface, target_ovs_bridge, target_vm_net):
diff --git a/vdsm/virt/vm_migrate_plugins/__init__.py 
b/vdsm/virt/vm_migrate_plugins/__init__.py
new file mode 100644
index 000..6c81eee
--- /dev/null
+++ b/vdsm/virt/vm_migrate_plugins/__init__.py
@@ -0,0 +1,43 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+import abc
+from importlib import import_module
+from pkgutil import iter_modules
+
+import six
+
+
+_DRIVERS = []
+
+
+def skip_processing(domxml, device_conf):
+for driver in _DRIVERS:
+driver.create().skip_processing(domxml, device_conf)
+
+
+class VmMigratePlugin():
+
+@abc.abstractmethod
+def skip_processing(self, domxml, device_conf):
+return False
+
+
+for _, module, _ in iter_modules([__path__[0]]):
+_DRIVERS.append(import_module('{}.{}'.format(__name__, module)))
diff --git a/vdsm/virt/vm_migrate_plugins/external_network_plugin.py 
b/vdsm/virt/vm_migrate_plugins/external_network_plugin.py
new file mode 100644
index 000..6beb0b2
--- /dev/null
+++ b/vdsm/virt/vm_migrate_plugins/external_network_plugin.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# Copyright 2016 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# 

Change in vdsm[master]: draft: Hook nic_libvirt_migration_destination, proposal 2

2016-09-19 Thread mmirecki
Marcin Mirecki has abandoned this change.

Change subject: draft: Hook nic_libvirt_migration_destination, proposal 2
..


Abandoned

-- 
To view, visit https://gerrit.ovirt.org/63686
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: abandon
Gerrit-Change-Id: I60e4cc7f801033cc830aa1a0aad32afecafe4fea
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: draft: Hook before_nic_libvirt_migration_destination, propos...

2016-09-19 Thread mmirecki
Marcin Mirecki has abandoned this change.

Change subject: draft: Hook before_nic_libvirt_migration_destination, proposal 1
..


Abandoned

-- 
To view, visit https://gerrit.ovirt.org/63684
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: abandon
Gerrit-Change-Id: I38363bd36f5580d006960487ad7df0dc5ded73bb
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: draft: vm_migration_libvirt_hook_plugins

2016-09-19 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: draft: vm_migration_libvirt_hook_plugins
..


Patch Set 1: Code-Review-1 Verified-1

-- 
To view, visit https://gerrit.ovirt.org/64001
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I7e13a94fa28968e37cd2d4d99fe540c8b762f7cc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[master]: draft: vm_migration_libvirt_hook_plugins

2016-09-15 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: draft: vm_migration_libvirt_hook_plugins
..

draft: vm_migration_libvirt_hook_plugins

Quick draft for vm migration libvirt hook plugins

Change-Id: I7e13a94fa28968e37cd2d4d99fe540c8b762f7cc
Signed-off-by: mirecki 
---
M vdsm/virt/vm_migrate_hook.py
A vdsm/virt/vm_migrate_plugins/__init__.py
2 files changed, 72 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/01/64001/1

diff --git a/vdsm/virt/vm_migrate_hook.py b/vdsm/virt/vm_migrate_hook.py
index 633e4f0..063fdd0 100755
--- a/vdsm/virt/vm_migrate_hook.py
+++ b/vdsm/virt/vm_migrate_hook.py
@@ -28,6 +28,8 @@
 from vdsm.config import config
 from vdsm.network import api as net_api
 
+import vm_migrate_plugins
+
 
 _DEBUG_MODE = False
 LOG_FILE = '/tmp/libvirthook_ovs_migrate.log'
@@ -82,24 +84,29 @@
 
 
 def _set_bridge_interfaces(devices, target_vm_conf):
-target_vm_nets_by_vnic_mac = {dev['macAddr']: dev['network']
-  for dev in target_vm_conf['devices']
-  if dev.get('type') == 'interface'}
+target_vm_conf_by_mac = {dev['macAddr']: dev
+ for dev in target_vm_conf['devices']
+ if dev.get('type') == 'interface'}
+
 for interface in devices.findall('interface'):
 if interface.get('type') == 'bridge':
-_bind_iface_to_bridge(interface, target_vm_nets_by_vnic_mac)
+_bind_iface_to_bridge(interface, target_vm_conf_by_mac)
 
 
-def _bind_iface_to_bridge(interface, target_vm_nets_by_vnic_mac):
+def _bind_iface_to_bridge(interface, target_vm_conf_by_mac):
 elem_macaddr = interface.find('mac')
 mac_addr = elem_macaddr.get('address')
 
-target_vm_net = target_vm_nets_by_vnic_mac[mac_addr]
-target_ovs_bridge = net_api.ovs_bridge(target_vm_net)
-if target_ovs_bridge:
-_bind_iface_to_ovs_bridge(interface, target_ovs_bridge, target_vm_net)
-else:
-_bind_iface_to_linux_bridge(interface, target_vm_net)
+interface_conf = target_vm_conf_by_mac[mac_addr]
+target_vm_net = interface_conf['network']
+if vm_migrate_plugins.do_default_processing(interface, interface_conf):
+target_ovs_bridge = net_api.ovs_bridge(target_vm_net)
+if target_ovs_bridge:
+_bind_iface_to_ovs_bridge(interface, target_ovs_bridge,
+  target_vm_net)
+else:
+_bind_iface_to_linux_bridge(interface, target_vm_net)
+vm_migrate_plugins.process(interface, interface_conf)
 
 
 def _bind_iface_to_ovs_bridge(interface, target_ovs_bridge, target_vm_net):
diff --git a/vdsm/virt/vm_migrate_plugins/__init__.py 
b/vdsm/virt/vm_migrate_plugins/__init__.py
new file mode 100644
index 000..3e4b090
--- /dev/null
+++ b/vdsm/virt/vm_migrate_plugins/__init__.py
@@ -0,0 +1,54 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+import abc
+from importlib import import_module
+from pkgutil import iter_modules
+
+import six
+
+
+_DRIVERS = []
+
+
+def do_default_processing(domxml, device_conf):
+result = True
+for driver in _DRIVERS:
+result = result and driver.create().do_default_processing(domxml,
+  device_conf)
+return result
+
+
+def process(domxml, device_conf):
+for driver in _DRIVERS:
+driver.create().process(domxml, device_conf)
+
+
+class VmMigrateDriver():
+
+@abc.abstractmethod
+def do_default_processing(self, domxml, device_conf):
+pass
+
+@abc.abstractmethod
+def process(self, domxml, device_conf):
+pass
+
+for _, module, _ in iter_modules([__path__[0]]):
+_DRIVERS.append(import_module('{}.{}'.format(__name__, module)))


-- 
To view, visit https://gerrit.ovirt.org/64001
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e13a94fa28968e37cd2d4d99fe540c8b762f7cc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 

Change in vdsm[master]: draft: Hook nic_libvirt_migration_destination, proposal 2

2016-09-12 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: draft: Hook nic_libvirt_migration_destination, proposal 2
..


Patch Set 1: Code-Review-1 Verified-1

-- 
To view, visit https://gerrit.ovirt.org/63686
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I60e4cc7f801033cc830aa1a0aad32afecafe4fea
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: draft: Hook before_nic_libvirt_migration_destination, propos...

2016-09-12 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: draft: Hook before_nic_libvirt_migration_destination, proposal 1
..


Patch Set 2: Code-Review-1 Verified-1

-- 
To view, visit https://gerrit.ovirt.org/63684
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I38363bd36f5580d006960487ad7df0dc5ded73bb
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: draft: Hook nic_libvirt_migration_destination, proposal 2

2016-09-12 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: draft: Hook nic_libvirt_migration_destination, proposal 2
..

draft: Hook nic_libvirt_migration_destination, proposal 2

A quick proposal for fixing broken custom nic migration.
Just a quick draft - do not review.

Change-Id: I60e4cc7f801033cc830aa1a0aad32afecafe4fea
Signed-off-by: mirecki 
---
M lib/vdsm/hooks.py
M vdsm/virt/vm_migrate_hook.py
2 files changed, 21 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/86/63686/1

diff --git a/lib/vdsm/hooks.py b/lib/vdsm/hooks.py
index 03363ae..5f025ba 100644
--- a/lib/vdsm/hooks.py
+++ b/lib/vdsm/hooks.py
@@ -418,6 +418,12 @@
 raiseError=False, hookType=_JSON_HOOK)
 
 
+def nic_libvirt_migration_destination(
+devicexml, vmconf={}, customProperties={}):
+return _runHooksDir(devicexml, 'before_nic_libvirt_migration_destination',
+vmconf=vmconf, params=customProperties)
+
+
 def _getScriptInfo(path):
 try:
 with open(path) as f:
diff --git a/vdsm/virt/vm_migrate_hook.py b/vdsm/virt/vm_migrate_hook.py
index 633e4f0..85b1b02 100755
--- a/vdsm/virt/vm_migrate_hook.py
+++ b/vdsm/virt/vm_migrate_hook.py
@@ -24,6 +24,7 @@
 import traceback
 import xml.etree.cElementTree as ET
 
+from vdsm import hooks
 from vdsm import jsonrpcvdscli
 from vdsm.config import config
 from vdsm.network import api as net_api
@@ -82,21 +83,28 @@
 
 
 def _set_bridge_interfaces(devices, target_vm_conf):
-target_vm_nets_by_vnic_mac = {dev['macAddr']: dev['network']
-  for dev in target_vm_conf['devices']
-  if dev.get('type') == 'interface'}
+
+target_vm_conf_by_mac = {dev['macAddr']: dev['network']
+ for dev in target_vm_conf['devices']
+ if dev.get('type') == 'interface'}
+
 for interface in devices.findall('interface'):
 if interface.get('type') == 'bridge':
-_bind_iface_to_bridge(interface, target_vm_nets_by_vnic_mac)
+_bind_iface_to_bridge(interface, target_vm_conf_by_mac)
 
 
-def _bind_iface_to_bridge(interface, target_vm_nets_by_vnic_mac):
+def _bind_iface_to_bridge(interface, target_vm_conf_by_mac):
 elem_macaddr = interface.find('mac')
 mac_addr = elem_macaddr.get('address')
 
-target_vm_net = target_vm_nets_by_vnic_mac[mac_addr]
+target_conf = target_vm_conf_by_mac[mac_addr]
+target_vm_net = ['network']
+is_target_custom = target_conf.get('custom')
 target_ovs_bridge = net_api.ovs_bridge(target_vm_net)
-if target_ovs_bridge:
+if is_target_custom:
+interface = hooks.nic_libvirt_migration_destination(interface,
+target_conf)
+elif target_ovs_bridge:
 _bind_iface_to_ovs_bridge(interface, target_ovs_bridge, target_vm_net)
 else:
 _bind_iface_to_linux_bridge(interface, target_vm_net)


-- 
To view, visit https://gerrit.ovirt.org/63686
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I60e4cc7f801033cc830aa1a0aad32afecafe4fea
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: draft: Hook before_nic_libvirt_migration_destination, propos...

2016-09-12 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: draft: Hook before_nic_libvirt_migration_destination, proposal 1
..

draft: Hook before_nic_libvirt_migration_destination, proposal 1

Change-Id: I38363bd36f5580d006960487ad7df0dc5ded73bb
Signed-off-by: mirecki 
---
M lib/vdsm/hooks.py
M vdsm/virt/vm_migrate_hook.py
2 files changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/63684/1

diff --git a/lib/vdsm/hooks.py b/lib/vdsm/hooks.py
index 03363ae..8c7efc6 100644
--- a/lib/vdsm/hooks.py
+++ b/lib/vdsm/hooks.py
@@ -418,6 +418,18 @@
 raiseError=False, hookType=_JSON_HOOK)
 
 
+def before_nic_libvirt_migration_destination(
+devicexml, vmconf={}, customProperties={}):
+return _runHooksDir(devicexml, 'before_nic_libvirt_migration_destination',
+vmconf=vmconf, params=customProperties)
+
+
+def after_nic_libvirt_migration_destination(
+devicexml, vmconf={}, customProperties={}):
+return _runHooksDir(devicexml, 'after_nic_libvirt_migration_destination',
+vmconf=vmconf, params=customProperties)
+
+
 def _getScriptInfo(path):
 try:
 with open(path) as f:
diff --git a/vdsm/virt/vm_migrate_hook.py b/vdsm/virt/vm_migrate_hook.py
index 633e4f0..e198497 100755
--- a/vdsm/virt/vm_migrate_hook.py
+++ b/vdsm/virt/vm_migrate_hook.py
@@ -24,6 +24,7 @@
 import traceback
 import xml.etree.cElementTree as ET
 
+from vdsm import hooks
 from vdsm import jsonrpcvdscli
 from vdsm.config import config
 from vdsm.network import api as net_api
@@ -86,8 +87,12 @@
   for dev in target_vm_conf['devices']
   if dev.get('type') == 'interface'}
 for interface in devices.findall('interface'):
+hooks.before_nic_libvirt_migration_destination(interface,
+   target_vm_conf)
 if interface.get('type') == 'bridge':
 _bind_iface_to_bridge(interface, target_vm_nets_by_vnic_mac)
+hooks.after_nic_libvirt_migration_destination(interface,
+  target_vm_conf)
 
 
 def _bind_iface_to_bridge(interface, target_vm_nets_by_vnic_mac):


-- 
To view, visit https://gerrit.ovirt.org/63684
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I38363bd36f5580d006960487ad7df0dc5ded73bb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: virt net: Disable special OVS handling for exteranal network

2016-09-09 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: virt net: Disable special OVS handling for exteranal network
..

virt net: Disable special OVS handling for exteranal network

Exteranal network rely of changes introduced by hooks into domxml
and hence should not undergo the special handling meant for OVS

Change-Id: Id0aa5846040a80773a65a14d3e93624e4491c229
Signed-off-by: mirecki 
---
M vdsm/virt/vm_migrate_hook.py
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/63621/1

diff --git a/vdsm/virt/vm_migrate_hook.py b/vdsm/virt/vm_migrate_hook.py
index 633e4f0..86c4373 100755
--- a/vdsm/virt/vm_migrate_hook.py
+++ b/vdsm/virt/vm_migrate_hook.py
@@ -31,6 +31,7 @@
 
 _DEBUG_MODE = False
 LOG_FILE = '/tmp/libvirthook_ovs_migrate.log'
+EXTERNAL_NETWORK = 'EXTERNAL_NETWORK'
 
 
 class VmMigrationHookError(Exception):
@@ -85,7 +86,15 @@
 target_vm_nets_by_vnic_mac = {dev['macAddr']: dev['network']
   for dev in target_vm_conf['devices']
   if dev.get('type') == 'interface'}
+exernal_by_mac = {dev['macAddr']: dev.get('custom').
+  get('provider_type') == EXTERNAL_NETWORK
+  for dev in target_vm_conf['devices']
+  if dev.get('type') == 'interface' and dev.get('custom')}
+
 for interface in devices.findall('interface'):
+if exernal_by_mac.get(interface.find('mac').get('address')):
+continue
+
 if interface.get('type') == 'bridge':
 _bind_iface_to_bridge(interface, target_vm_nets_by_vnic_mac)
 


-- 
To view, visit https://gerrit.ovirt.org/63621
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0aa5846040a80773a65a14d3e93624e4491c229
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: net libvirt hook: Adjust hook to vmList report change.

2016-09-08 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: net libvirt hook: Adjust hook to vmList report change.
..


Patch Set 1: Code-Review+1 Verified+1

-- 
To view, visit https://gerrit.ovirt.org/63542
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I46925a65abc293e317b8df86bd958bf1cf27b6de
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Edward Haas 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Milan Zamazal 
Gerrit-Reviewer: Petr Horáček 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: hooks: Initial commit for the ovn vif driver

2016-09-05 Thread mmirecki
Marcin Mirecki has abandoned this change.

Change subject: hooks: Initial commit for the ovn vif driver
..


Abandoned

Moving to ovirt-provider-ovn repo

-- 
To view, visit https://gerrit.ovirt.org/62958
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: abandon
Gerrit-Change-Id: I01ad6d41a93c1298c2c6e93b691ba9181b35457d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: hooks: Initial commit for the ovn vif driver

2016-08-29 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: hooks: Initial commit for the ovn vif driver
..

hooks: Initial commit for the ovn vif driver

Adds the POC code (from github) into vdsm.
This provides the basic ovn setup for a vnic.

Change-Id: I01ad6d41a93c1298c2c6e93b691ba9181b35457d
Signed-off-by: mirecki 
---
A vdsm_hooks/ovn/before_device_create.py
A vdsm_hooks/ovn/ovn-nb.ovsschema
A vdsm_hooks/ovn/ovsdb_api.py
A vdsm_hooks/ovn/vswitch.ovsschema
4 files changed, 884 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/62958/1

diff --git a/vdsm_hooks/ovn/before_device_create.py 
b/vdsm_hooks/ovn/before_device_create.py
new file mode 100755
index 000..97552ad
--- /dev/null
+++ b/vdsm_hooks/ovn/before_device_create.py
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+# Copyright 2016 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+import sys
+import traceback
+import os
+import hooking
+from ovsdb_api import OvsDb
+
+BRIDGE_NAME = 'br-int'
+PROVIDER_TYPE_KEY = 'provider_type'
+PROVIDER_TYPE = 'EXTERNAL_NETWORK'
+VNIC_ID = 'vnic_id'
+
+NDB_SCHEMA = "/usr/libexec/vdsm/hooks/config/ovn-nb.ovsschema"
+
+
+def ovs_device(domxml):
+
+# HACK: we need to query OVN south DB because of a bug which requires
+# Logical Port to be specified in external_ids:interface_id by name
+# instead of by id.
+# When the bug is solved, we will be able to just use the received
+# VNIC_ID and remove the query to OVN north DB
+ovsdb = OvsDb()
+ovsdb.connect()
+remote = ovsdb.get_remote()
+# The remote is the OVN south DB (default port 6642)
+# We need OVN north DB instead (default port 6641)
+remote_ndb = remote[:-4] + "6641"
+ovsdb.close()
+
+vnic_id = os.environ[VNIC_ID]
+ovndb = OvsDb()
+ovndb.connect(remote_ndb, ovndb.OVN_TABLES, NDB_SCHEMA)
+ifc_name = ovndb.get_remote_port_name_from_id(vnic_id)
+ovndb.close()
+if not ifc_name:
+# If record was not found, this is not an OVN managed port
+return
+# END HACK
+
+try:
+iface = domxml.getElementsByTagName('interface')[0]
+except IndexError:
+return  # skip if not an interface
+source = iface.getElementsByTagName('source')[0]
+
+virtualport = domxml.createElement('virtualport')
+virtualport.setAttribute('type', 'openvswitch')
+iface.appendChild(virtualport)
+
+parameters = domxml.createElement('parameters')
+parameters.setAttribute('interfaceid', ifc_name)
+virtualport.appendChild(parameters)
+
+source.setAttribute('bridge', BRIDGE_NAME)
+
+
+def main():
+provider_type = os.environ[PROVIDER_TYPE_KEY]
+if provider_type != PROVIDER_TYPE:
+return
+
+domxml = hooking.read_domxml()
+ovs_device(domxml)
+hooking.write_domxml(domxml)
+
+main()
diff --git a/vdsm_hooks/ovn/ovn-nb.ovsschema b/vdsm_hooks/ovn/ovn-nb.ovsschema
new file mode 100644
index 000..95eb4f7
--- /dev/null
+++ b/vdsm_hooks/ovn/ovn-nb.ovsschema
@@ -0,0 +1,109 @@
+{
+"name": "OVN_Northbound",
+"version": "3.0.0",
+"cksum": "1808140260 5339",
+"tables": {
+"Logical_Switch": {
+"columns": {
+"name": {"type": "string"},
+"ports": {"type": {"key": {"type": "uuid",
+   "refTable": "Logical_Switch_Port",
+   "refType": "strong"},
+   "min": 0,
+   "max": "unlimited"}},
+"acls": {"type": {"key": {"type": "uuid",
+  "refTable": "ACL",
+  "refType": "strong"},
+  "min": 0,
+  "max": "unlimited"}},
+"external_ids": {
+"type": {"key": "string", "value": "string",
+ "min": 0, "max": "unlimited"}}},
+"isRoot": true},
+"Logical_Switch_Port": {
+"columns": {
+"name": {"type": "string"},
+ 

Change in vdsm[master]: vdsm: removing txRate and rxRate from code

2016-08-03 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vdsm: removing txRate and rxRate from code
..


Patch Set 6:

Verified on 3.6 engine and 4.0 host.

-- 
To view, visit https://gerrit.ovirt.org/59544
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id6466de88f0228ac3496b4642d34f5eb7b281afa
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: Yevgeny Zaspitsky 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: vdsm: removing txRate and rxRate from code

2016-08-02 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vdsm: removing txRate and rxRate from code
..


Patch Set 6:

Verified with:
-master, vdsm with changes applied
-4.0, vdsm with changes applied (to verify compatiblity with 4.0 engine)

-- 
To view, visit https://gerrit.ovirt.org/59544
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id6466de88f0228ac3496b4642d34f5eb7b281afa
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: Yevgeny Zaspitsky 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: vdsm: removing txRate and rxRate from code

2016-08-02 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vdsm: removing txRate and rxRate from code
..


Patch Set 6: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/59544
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id6466de88f0228ac3496b4642d34f5eb7b281afa
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: Yevgeny Zaspitsky 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: vdsm: removing txRate and rxRate from code

2016-08-02 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vdsm: removing txRate and rxRate from code
..


Patch Set 6:

The engine code which receives the stats looks to be immune to missing 
rx/txRate.
The incoming value is wrapped with 
VdsBrokerObjectBuilder.assignDoubleValueWithNullProtection, which converts 
missing rx/txRate into zeros. So removing the values does not break 
compatibility with engine 4.0

-- 
To view, visit https://gerrit.ovirt.org/59544
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id6466de88f0228ac3496b4642d34f5eb7b281afa
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-Reviewer: Yevgeny Zaspitsky 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[ovirt-3.6]: hooks: openstack hook should wait a while for nic activation

2016-06-30 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: hooks: openstack hook should wait a while for nic activation
..


Patch Set 1: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/60035
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib4f455789909f090a039863fdcfeb61b9db1042f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[ovirt-3.6]: hooks: openstack hook should wait a while for nic activation

2016-06-30 Thread mmirecki
Hello Dan Kenigsberg, Francesco Romani,

I'd like you to do a code review.  Please visit

https://gerrit.ovirt.org/60035

to review the following change.

Change subject: hooks: openstack hook should wait a while for nic activation
..

hooks: openstack hook should wait a while for nic activation

The vm will be stated in a paused state if a nic managed by
an external openstack network provider is present. The openstack
hook after_vm_start  must then wait a given time to allow the
nic to be activated before unpausing the vm.

Change-Id: Ib4f455789909f090a039863fdcfeb61b9db1042f
Bug-Url: https://bugzilla.redhat.com/1314371
Signed-off-by: mirecki 
Reviewed-on: https://gerrit.ovirt.org/58917
Continuous-Integration: Jenkins CI
Reviewed-by: Dan Kenigsberg 
Reviewed-by: Francesco Romani 
---
A vdsm_hooks/openstacknet/after_vm_start.py
M vdsm_hooks/openstacknet/before_device_create.py
M vdsm_hooks/openstacknet/openstacknet_utils.py
3 files changed, 84 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/35/60035/1

diff --git a/vdsm_hooks/openstacknet/after_vm_start.py 
b/vdsm_hooks/openstacknet/after_vm_start.py
new file mode 100644
index 000..6f5c1e5
--- /dev/null
+++ b/vdsm_hooks/openstacknet/after_vm_start.py
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+
+'''
+OpenStack Network Hook (Post vm start)
+=
+The hook unpauses a vm if it was started in the paused state.
+
+Syntax:
+{ 'vmId': 'VM_ID', 'vnic_id': 'port_id' }
+Where:
+VM_ID should be replaced with the vm id.'''
+
+import libvirt
+import os
+import time
+import traceback
+import hooking
+from openstacknet_utils import MARK_FOR_UNPAUSE_PATH
+from openstacknet_utils import VM_ID_KEY
+from vdsm import vdscli
+
+
+OPENSTACK_NIC_WAIT_TIME = 15
+
+
+def resume_paused_vm(vm_id):
+unpause_file = MARK_FOR_UNPAUSE_PATH % vm_id
+if os.path.isfile(unpause_file):
+vdscli.connect().cont(vm_id)
+os.remove(unpause_file)
+
+
+def main():
+
+# TODO (HACK):
+# This code waits for the nic to be attached to neutron for a
+# certain amount of time. This is one way of going around the
+# race between the code and the vm nic becoming active. It is
+# a very fragile hack, as there is no guarantee the nic will
+# actually be ready after this.
+vm_id = os.environ[VM_ID_KEY]
+launch_flags = hooking.load_vm_launch_flags_from_file(vm_id)
+if launch_flags == libvirt.VIR_DOMAIN_START_PAUSED:
+time.sleep(OPENSTACK_NIC_WAIT_TIME)
+resume_paused_vm(vm_id)
+
+
+if __name__ == '__main__':
+try:
+main()
+except:
+hooking.exit_hook('openstacknet hook: [unexpected error]: %s\n' %
+  traceback.format_exc())
diff --git a/vdsm_hooks/openstacknet/before_device_create.py 
b/vdsm_hooks/openstacknet/before_device_create.py
index c37f81a..3cc8376 100755
--- a/vdsm_hooks/openstacknet/before_device_create.py
+++ b/vdsm_hooks/openstacknet/before_device_create.py
@@ -31,6 +31,7 @@
 '''
 from __future__ import print_function
 
+import libvirt
 import os
 import sys
 import traceback
@@ -39,12 +40,14 @@
 import hooking
 from openstacknet_utils import DUMMY_BRIDGE
 from openstacknet_utils import INTEGRATION_BRIDGE
+from openstacknet_utils import MARK_FOR_UNPAUSE_PATH
 from openstacknet_utils import OPENSTACK_NET_PROVIDER_TYPE
 from openstacknet_utils import PLUGIN_TYPE_KEY
 from openstacknet_utils import PROVIDER_TYPE_KEY
 from openstacknet_utils import PT_BRIDGE
 from openstacknet_utils import PT_OVS
 from openstacknet_utils import SECURITY_GROUPS_KEY
+from openstacknet_utils import VM_ID_KEY
 from openstacknet_utils import VNIC_ID_KEY
 from openstacknet_utils import devName
 from openstacknet_utils import setUpSecurityGroupVnic
@@ -120,6 +123,16 @@
 hooking.exit_hook("Unknown plugin type: %s" % pluginType)
 
 
+def mark_for_unpause(vm_id):
+unpause_file = MARK_FOR_UNPAUSE_PATH % vm_id
+try:
+os.makedirs(os.path.dirname(unpause_file))
+except OSError:
+pass
+with open(unpause_file, mode='w') as f:
+f.write("true")
+
+
 def main():
 if PROVIDER_TYPE_KEY not in os.environ:
 return
@@ -135,6 +148,15 @@
 addOpenstackVnic(domxml, pluginType, vNicId, hasSecurityGroups)
 hooking.write_domxml(domxml)
 
+vm_id = os.environ[VM_ID_KEY]
+PAUSE_FLAG = libvirt.VIR_DOMAIN_START_PAUSED
+flags = hooking.load_vm_launch_flags_from_file(vm_id)
+
+if (flags & PAUSE_FLAG) != PAUSE_FLAG:
+flags |= PAUSE_FLAG
+hooking.dump_vm_launch_flags_to_file(vm_id, flags)
+mark_for_unpause(vm_id)
+
 
 def test(ovs, withSecurityGroups):
 domxml = minidom.parseString("""
diff --git a/vdsm_hooks/openstacknet/openstacknet_utils.py 

Change in vdsm[ovirt-4.0]: hooks: openstack hook should wait a while for nic activation

2016-06-29 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: hooks: openstack hook should wait a while for nic activation
..


Patch Set 1:

The hooks are exactly the same as master, verified along with the master version

-- 
To view, visit https://gerrit.ovirt.org/59919
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib4f455789909f090a039863fdcfeb61b9db1042f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Petr Horáček 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: hooks: openstack hook should wait a while for nic activation

2016-06-29 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: hooks: openstack hook should wait a while for nic activation
..


Patch Set 1: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/59919
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib4f455789909f090a039863fdcfeb61b9db1042f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Petr Horáček 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: vdsm: removing txRate and rxRate from code

2016-06-29 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vdsm: removing txRate and rxRate from code
..


Patch Set 5: Code-Review-1 Verified-1

The value is required by engine 4.0, which is already out.
The patch needs to be changed to send some 'dummy' rx/tx rate value instead of 
removing it completely.
Otherwise 4.0 compatibility will be broken.

-- 
To view, visit https://gerrit.ovirt.org/59544
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id6466de88f0228ac3496b4642d34f5eb7b281afa
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yevgeny Zaspitsky 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: vdsm: removing txRate and rxRate from code

2016-06-29 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vdsm: removing txRate and rxRate from code
..


Patch Set 5:

There is no plan so far to backport to 4.0

-- 
To view, visit https://gerrit.ovirt.org/59544
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id6466de88f0228ac3496b4642d34f5eb7b281afa
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yevgeny Zaspitsky 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: vdsm: removing txRate and rxRate from code

2016-06-29 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vdsm: removing txRate and rxRate from code
..


Patch Set 5:

Yes, rx/tx rate are still used on the engine.
But they are not received from vdsm anymore, being instead calculated using 
other data.
Patch: https://gerrit.ovirt.org/#/c/59508/
removes the extracting from vdsm data.

The way we come up with rx/tx rate now is we calculate it in:
NetworkStatisticsBuilder.updateExistingInterfaceStatistics  (line 52).
and use this value further on in the code.

There was already a discussion on a related topic:
https://gerrit.ovirt.org/#/c/59508/1/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java

-- 
To view, visit https://gerrit.ovirt.org/59544
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id6466de88f0228ac3496b4642d34f5eb7b281afa
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Yevgeny Zaspitsky 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: hooks: openstack hook should wait a while for nic activation

2016-06-29 Thread mmirecki
Hello Dan Kenigsberg, Francesco Romani,

I'd like you to do a code review.  Please visit

https://gerrit.ovirt.org/59919

to review the following change.

Change subject: hooks: openstack hook should wait a while for nic activation
..

hooks: openstack hook should wait a while for nic activation

The vm will be stated in a paused state if a nic managed by
an external openstack network provider is present. The openstack
hook after_vm_start  must then wait a given time to allow the
nic to be activated before unpausing the vm.

Change-Id: Ib4f455789909f090a039863fdcfeb61b9db1042f
Bug-Url: https://bugzilla.redhat.com/1314371
Signed-off-by: mirecki 
Reviewed-on: https://gerrit.ovirt.org/58917
Continuous-Integration: Jenkins CI
Reviewed-by: Dan Kenigsberg 
Reviewed-by: Francesco Romani 
---
A vdsm_hooks/openstacknet/after_vm_start.py
M vdsm_hooks/openstacknet/before_device_create.py
M vdsm_hooks/openstacknet/openstacknet_utils.py
3 files changed, 84 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/19/59919/1

diff --git a/vdsm_hooks/openstacknet/after_vm_start.py 
b/vdsm_hooks/openstacknet/after_vm_start.py
new file mode 100644
index 000..6f5c1e5
--- /dev/null
+++ b/vdsm_hooks/openstacknet/after_vm_start.py
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+
+'''
+OpenStack Network Hook (Post vm start)
+=
+The hook unpauses a vm if it was started in the paused state.
+
+Syntax:
+{ 'vmId': 'VM_ID', 'vnic_id': 'port_id' }
+Where:
+VM_ID should be replaced with the vm id.'''
+
+import libvirt
+import os
+import time
+import traceback
+import hooking
+from openstacknet_utils import MARK_FOR_UNPAUSE_PATH
+from openstacknet_utils import VM_ID_KEY
+from vdsm import vdscli
+
+
+OPENSTACK_NIC_WAIT_TIME = 15
+
+
+def resume_paused_vm(vm_id):
+unpause_file = MARK_FOR_UNPAUSE_PATH % vm_id
+if os.path.isfile(unpause_file):
+vdscli.connect().cont(vm_id)
+os.remove(unpause_file)
+
+
+def main():
+
+# TODO (HACK):
+# This code waits for the nic to be attached to neutron for a
+# certain amount of time. This is one way of going around the
+# race between the code and the vm nic becoming active. It is
+# a very fragile hack, as there is no guarantee the nic will
+# actually be ready after this.
+vm_id = os.environ[VM_ID_KEY]
+launch_flags = hooking.load_vm_launch_flags_from_file(vm_id)
+if launch_flags == libvirt.VIR_DOMAIN_START_PAUSED:
+time.sleep(OPENSTACK_NIC_WAIT_TIME)
+resume_paused_vm(vm_id)
+
+
+if __name__ == '__main__':
+try:
+main()
+except:
+hooking.exit_hook('openstacknet hook: [unexpected error]: %s\n' %
+  traceback.format_exc())
diff --git a/vdsm_hooks/openstacknet/before_device_create.py 
b/vdsm_hooks/openstacknet/before_device_create.py
index c37f81a..3cc8376 100755
--- a/vdsm_hooks/openstacknet/before_device_create.py
+++ b/vdsm_hooks/openstacknet/before_device_create.py
@@ -31,6 +31,7 @@
 '''
 from __future__ import print_function
 
+import libvirt
 import os
 import sys
 import traceback
@@ -39,12 +40,14 @@
 import hooking
 from openstacknet_utils import DUMMY_BRIDGE
 from openstacknet_utils import INTEGRATION_BRIDGE
+from openstacknet_utils import MARK_FOR_UNPAUSE_PATH
 from openstacknet_utils import OPENSTACK_NET_PROVIDER_TYPE
 from openstacknet_utils import PLUGIN_TYPE_KEY
 from openstacknet_utils import PROVIDER_TYPE_KEY
 from openstacknet_utils import PT_BRIDGE
 from openstacknet_utils import PT_OVS
 from openstacknet_utils import SECURITY_GROUPS_KEY
+from openstacknet_utils import VM_ID_KEY
 from openstacknet_utils import VNIC_ID_KEY
 from openstacknet_utils import devName
 from openstacknet_utils import setUpSecurityGroupVnic
@@ -120,6 +123,16 @@
 hooking.exit_hook("Unknown plugin type: %s" % pluginType)
 
 
+def mark_for_unpause(vm_id):
+unpause_file = MARK_FOR_UNPAUSE_PATH % vm_id
+try:
+os.makedirs(os.path.dirname(unpause_file))
+except OSError:
+pass
+with open(unpause_file, mode='w') as f:
+f.write("true")
+
+
 def main():
 if PROVIDER_TYPE_KEY not in os.environ:
 return
@@ -135,6 +148,15 @@
 addOpenstackVnic(domxml, pluginType, vNicId, hasSecurityGroups)
 hooking.write_domxml(domxml)
 
+vm_id = os.environ[VM_ID_KEY]
+PAUSE_FLAG = libvirt.VIR_DOMAIN_START_PAUSED
+flags = hooking.load_vm_launch_flags_from_file(vm_id)
+
+if (flags & PAUSE_FLAG) != PAUSE_FLAG:
+flags |= PAUSE_FLAG
+hooking.dump_vm_launch_flags_to_file(vm_id, flags)
+mark_for_unpause(vm_id)
+
 
 def test(ovs, withSecurityGroups):
 domxml = minidom.parseString("""
diff --git a/vdsm_hooks/openstacknet/openstacknet_utils.py 

Change in vdsm[master]: hooks: openstack hook should wait a while for nic activation

2016-06-29 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: hooks: openstack hook should wait a while for nic activation
..


Patch Set 5: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/58917
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib4f455789909f090a039863fdcfeb61b9db1042f
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: openstacknet: add MidoNet support

2016-06-21 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: openstacknet: add MidoNet support
..


Patch Set 2:

Verified up to the point where the xml passed to libvirt is correct.
It still needs verification to see if the generated xml will work with midonet.

-- 
To view, visit https://gerrit.ovirt.org/59255
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id5cb84c155b46603e05951238ad16182081dbe10
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon 
Gerrit-Reviewer: Antoni Segura Puimedon 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: vdsm: removing txRate and rxRate from code

2016-06-21 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: vdsm: removing txRate and rxRate from code
..

vdsm: removing txRate and rxRate from code

Vdsm should no longer send rxRate and txRate to the engine.

Change-Id: Id6466de88f0228ac3496b4642d34f5eb7b281afa
Signed-off-by: mirecki 
---
M lib/api/vdsm-api.yml
M lib/vdsm/host/stats.py
M lib/vdsm/virt/vmstats.py
M tests/hoststatsTests.py
M tests/vdsmapi_test.py
M tests/vmStatsTests.py
M tests/vmTests.py
M vdsm_hooks/fakevmstats/after_get_all_vm_stats.py
8 files changed, 0 insertions(+), 80 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/44/59544/1

diff --git a/lib/api/vdsm-api.yml b/lib/api/vdsm-api.yml
index b537e8e..0b8d27a 100644
--- a/lib/api/vdsm-api.yml
+++ b/lib/api/vdsm-api.yml
@@ -1591,12 +1591,6 @@
 type: string
 datatype: uint
 
--   description: The rate of incoming packets (as a percentage
-of speed)
-name: rxRate
-type: string
-datatype: float
-
 -   description: The network device name
 name: name
 type: string
@@ -1623,12 +1617,6 @@
 name: txErrors
 type: string
 datatype: uint
-
--   description: The rate of outgoing packets (as a percentage
-of speed)
-name: txRate
-type: string
-datatype: float
 
 -   description: The interface speed (in Megabits/s)
 name: speed
@@ -1877,12 +1865,6 @@
 name: swapTotal
 type: int
 
--   description: Incoming packet rate (as a percentage of total
-capacity)
-name: rxRate
-type: string
-datatype: float
-
 -   description: The number of VMs migrating to this host
 name: incomingVmMigrations
 type: uint
@@ -1905,12 +1887,6 @@
 
 -   description: Ratio of CPU time spent idle
 name: cpuIdle
-type: string
-datatype: float
-
--   description: Outgoing packet rate (as a percentage of total
-capacity)
-name: txRate
 type: string
 datatype: float
 
@@ -4466,12 +4442,6 @@
 type: string
 datatype: uint
 
--   description: The rate of incoming packets (as a percentage
-of speed)
-name: rxRate
-type: string
-datatype: float
-
 -   description: The network device name
 name: name
 type: string
@@ -4502,12 +4472,6 @@
 name: txErrors
 type: string
 datatype: uint
-
--   description: The rate of outgoing packets (as a percentage
-of speed)
-name: txRate
-type: string
-datatype: float
 
 -   description: The interface speed (in Megabits/s)
 name: speed
diff --git a/lib/vdsm/host/stats.py b/lib/vdsm/host/stats.py
index 23ce688..61bd5ab 100644
--- a/lib/vdsm/host/stats.py
+++ b/lib/vdsm/host/stats.py
@@ -158,12 +158,6 @@
 last_sample.interfaces[ifid].tx -
 first_sample.interfaces[ifid].tx
 ) % NETSTATS_BOUND
-rxRate = 100.0 * thisRx / interval / ifrate / Mbps2Bps
-txRate = 100.0 * thisTx / interval / ifrate / Mbps2Bps
-if txRate > 100 or rxRate > 100:
-txRate = min(txRate, 100.0)
-rxRate = min(rxRate, 100.0)
-logging.debug('Rate above 100%%.')
 iface = last_sample.interfaces[ifid]
 stats['network'][ifid] = {
 'name': ifid, 'speed': str(ifrate),
@@ -172,8 +166,6 @@
 'rxErrors': str(iface.rxErrors),
 'txErrors': str(iface.txErrors),
 'state': iface.operstate,
-'rxRate': '%.1f' % rxRate,
-'txRate': '%.1f' % txRate,
 'rx': str(iface.rx),
 'tx': str(iface.tx),
 'sampleTime': last_sample.timestamp,
@@ -185,12 +177,6 @@
 total_rate += ifrate
 
 total_bytes_per_sec = (total_rate or 1000) * (10 ** 6) / 8
-stats['rxRate'] = 100.0 * rx / interval / total_bytes_per_sec
-stats['txRate'] = 100.0 * tx / interval / total_bytes_per_sec
-if stats['txRate'] > 100 or stats['rxRate'] > 100:
-stats['txRate'] = min(stats['txRate'], 100.0)
-stats['rxRate'] = min(stats['rxRate'], 100.0)
-logging.debug(stats)
 stats['rxDropped'] = rxDropped
 stats['txDropped'] = txDropped
 
@@ -234,8 +220,6 @@
 'cpuUser': 0.0,
 'cpuSys': 0.0,
 'cpuIdle': 100.0,
-'rxRate': 0.0,  # REQUIRED_FOR: engine < 3.6
-'txRate': 0.0,  # REQUIRED_FOR: engine < 3.6
 'cpuSysVdsmd': 0.0,

Change in vdsm[master]: hooks: openstack hook should wait a while for nic activation

2016-06-20 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: hooks: openstack hook should wait a while for nic activation
..


Patch Set 2:

(5 comments)

https://gerrit.ovirt.org/#/c/58917/2/vdsm_hooks/openstacknet/after_vm_start.py
File vdsm_hooks/openstacknet/after_vm_start.py:

PS2, Line 37: time.sleep
> Please add a big TODO: we need to wait here until the port is bound in Neut
Done


PS2, Line 37: time.sleep
> this is still fragile: you don't know how long could Vdsm take to actually 
This patch is temporary, until we decide on the details on how to solve the 
issue checking the nic state against neutron.
The better solution comes in the next patch:
https://gerrit.ovirt.org/#/c/58810/5


https://gerrit.ovirt.org/#/c/58917/2/vdsm_hooks/openstacknet/before_device_create.py
File vdsm_hooks/openstacknet/before_device_create.py:

PS2, Line 152: pause_flag
> either drop completely or use PAUSE_FLAG, as this never changes.
Done


PS2, Line 153: flag
> flagS please (plural)
Done


PS2, Line 156:  libvirt.VIR_DOMAIN_START_PAUSED
> minor, perhaps silly:
Done


-- 
To view, visit https://gerrit.ovirt.org/58917
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib4f455789909f090a039863fdcfeb61b9db1042f
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: openstacknet: add MidoNet support

2016-06-17 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: openstacknet: add MidoNet support
..


Patch Set 2:

The patch is ok for me for now.
In the next iteration, I would like to make the main body of the hook to be 
independent of any provider specific data like bridge name or port types. The 
reason for this is that the file might become ugly more providers add their 
code there.
A quick draft showing what I have in mind:
https://gerrit.ovirt.org/#/c/59381/
(just a quick draft, please feel free to modify it)

-- 
To view, visit https://gerrit.ovirt.org/59255
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id5cb84c155b46603e05951238ad16182081dbe10
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon 
Gerrit-Reviewer: Antoni Segura Puimedon 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: draft: proposed refactoring of openstack hook to move provid...

2016-06-17 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: draft: proposed refactoring of openstack hook to move provider 
data to a config file
..

draft: proposed refactoring of openstack hook to move provider data to a config 
file

A proposal of refactoring to move provider specific data
into a separate configuration file.

If more providers (or people customizing for their own purposes) would
add their own specific data (like bridge names, ...), the main hook
file would quickly become a mess. Since most of the providers
will probably use similar/identical implementations, it would make
sense to make it flexible enough to just parametrize it with the
provier specific data.

This is just a draft to start a discussion, not a final solution.

Change-Id: Iaa2bc8e3a5dd59a5935ad6808e1de8a2f3c693a2
Signed-off-by: mirecki 
---
M vdsm_hooks/openstacknet/before_device_create.py
M vdsm_hooks/openstacknet/openstacknet_utils.py
A vdsm_hooks/openstacknet/plugin_type_properties.py
3 files changed, 65 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/81/59381/1

diff --git a/vdsm_hooks/openstacknet/before_device_create.py 
b/vdsm_hooks/openstacknet/before_device_create.py
index 2ea29a9..6a7d0bf 100755
--- a/vdsm_hooks/openstacknet/before_device_create.py
+++ b/vdsm_hooks/openstacknet/before_device_create.py
@@ -43,12 +43,20 @@
 from openstacknet_utils import PLUGIN_TYPE_KEY
 from openstacknet_utils import PROVIDER_TYPE_KEY
 from openstacknet_utils import PT_BRIDGE
-from openstacknet_utils import PT_MIDONET
+from openstacknet_utils import PT_VIRTUAL_PORT_VNIC
 from openstacknet_utils import PT_OVS
 from openstacknet_utils import SECURITY_GROUPS_KEY
 from openstacknet_utils import VNIC_ID_KEY
 from openstacknet_utils import devName
 from openstacknet_utils import setUpSecurityGroupVnic
+
+from openstacknet_utils import DUMMY_BRIDGE
+from openstacknet_utils import KEY_BRIDGE
+from openstacknet_utils import KEY_IMPLEMENTATION
+from openstacknet_utils import KEY_VIRTUAL_PORT_TYPE
+
+from plugin_type_properties import plugin_properties
+
 
 HELP_ARG = "-h"
 TEST_ARG = "-t"
@@ -82,15 +90,16 @@
 source.setAttribute('bridge', brName)
 
 
-def addLinuxBridgeVnic(domxml, iface, portId):
-defineLinuxBridge(domxml, iface, portId, DUMMY_BRIDGE)
+def addLinuxBridgeVnic(domxml, iface, portId, bridge_name):
+defineLinuxBridge(domxml, iface, portId, bridge_name)
 
 
-def addOvsVnic(domxml, iface, portId, hasSecurityGroups):
+def addOvsVnic(domxml, iface, portId, hasSecurityGroups,
+   bridge_name, port_type):
 if hasSecurityGroups:
 addOvsHybridVnic(domxml, iface, portId)
 else:
-addVirtualPortVnic(domxml, iface, portId)
+addVirtualPortVnic(domxml, iface, portId, bridge_name, port_type)
 
 
 def addOvsHybridVnic(domxml, iface, portId):
@@ -102,27 +111,31 @@
 defineLinuxBridge(domxml, iface, portId, brName)
 
 
-def addVirtualPortVnic(domxml, iface, portId, kind='openvswitch'):
+def addVirtualPortVnic(domxml, iface, portId, bridge_name, port_type):
 source = iface.getElementsByTagName('source')[0]
-source.setAttribute('bridge',
-kind if kind == 'midonet' else INTEGRATION_BRIDGE)
+source.setAttribute('bridge', bridge_name)
 
 virtualPort = domxml.createElement('virtualport')
-virtualPort.setAttribute('type', kind)
+virtualPort.setAttribute('type', port_type)
 virtualPortParameters = domxml.createElement('parameters')
 virtualPortParameters.setAttribute('interfaceid', portId)
 virtualPort.appendChild(virtualPortParameters)
 iface.appendChild(virtualPort)
 
 
-def addOpenstackVnic(domxml, pluginType, portId, hasSecurityGroups):
+def addVnic(domxml, pluginType, portId, hasSecurityGroups):
 iface = domxml.getElementsByTagName('interface')[0]
-if pluginType == PT_BRIDGE:
-addLinuxBridgeVnic(domxml, iface, portId)
-elif pluginType == PT_OVS:
-addOvsVnic(domxml, iface, portId, hasSecurityGroups)
-elif pluginType == PT_MIDONET:
-addVirtualPortVnic(domxml, iface, portId, kind='midonet')
+properties = plugin_properties[pluginType]
+implementation = properties[KEY_IMPLEMENTATION]
+if implementation == PT_BRIDGE:
+addLinuxBridgeVnic(domxml, iface, portId, properties[KEY_BRIDGE])
+elif implementation == PT_OVS:
+addOvsVnic(domxml, iface, portId, hasSecurityGroups,
+   properties[KEY_BRIDGE], properties[KEY_VIRTUAL_PORT_TYPE])
+elif implementation == PT_VIRTUAL_PORT_VNIC:
+addVirtualPortVnic(domxml, iface, portId,
+   properties[KEY_BRIDGE],
+   properties[KEY_VIRTUAL_PORT_TYPE])
 else:
 hooking.exit_hook("Unknown plugin type: %s" % pluginType)
 
@@ -139,7 +152,7 @@
 hasSecurityGroups = SECURITY_GROUPS_KEY in os.environ
  

Change in vdsm[master]: hooks: openstack hook should wait a while for nic activation

2016-06-16 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: hooks: openstack hook should wait a while for nic activation
..


Patch Set 1:

(3 comments)

https://gerrit.ovirt.org/#/c/58917/1/vdsm_hooks/openstacknet/after_vm_start.py
File vdsm_hooks/openstacknet/after_vm_start.py:

PS1, Line 24: vdscli.connect(vdscli.cannonizeHostPort('0'), True, None)
> just call vdscli.connect(). It has some sane heuristics regarding how to co
Done


Line 26: 
Line 27: def main():
Line 28: vm_id = os.environ[VM_ID_KEY]
Line 29: launch_flags = hooking.load_vm_launch_flags_from_file(vm_id)
Line 30: if launch_flags == libvirt.VIR_DOMAIN_START_PAUSED:
> this has a bug if the admin asked to start the VM in PAUSED state. this act
Done
Line 31: time.sleep(OPENSTACK_NIC_WAIT_TIME)
Line 32: resume_paused_vm(vm_id)
Line 33: 
Line 34: 


https://gerrit.ovirt.org/#/c/58917/1/vdsm_hooks/openstacknet/before_device_create.py
File vdsm_hooks/openstacknet/before_device_create.py:

Line 136:  % (vNicId, providerType, pluginType))
Line 137: addOpenstackVnic(domxml, pluginType, vNicId, 
hasSecurityGroups)
Line 138: hooking.write_domxml(domxml)
Line 139: if pluginType == PT_OVS:
Line 140: flag = libvirt.VIR_DOMAIN_START_PAUSED
> we must first READ the lauchflags file (remember it somewhere) and only the
Done
Line 141: 
hooking.dump_vm_launch_flags_to_file(os.environ[VM_ID_KEY], flag)
Line 142: 
Line 143: 
Line 144: def test(ovs, withSecurityGroups):


-- 
To view, visit https://gerrit.ovirt.org/58917
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib4f455789909f090a039863fdcfeb61b9db1042f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: hooks: openstack hook should wait a while for nic activation

2016-06-16 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: hooks: openstack hook should wait a while for nic activation
..


Patch Set 2: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/58917
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib4f455789909f090a039863fdcfeb61b9db1042f
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: openstacknet: add MidoNet support

2016-06-16 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: openstacknet: add MidoNet support
..


Patch Set 2: Code-Review+1

-- 
To view, visit https://gerrit.ovirt.org/59255
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id5cb84c155b46603e05951238ad16182081dbe10
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon 
Gerrit-Reviewer: Antoni Segura Puimedon 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[master]: virt: Alternative proposal for passing flags in/from vm/devi...

2016-05-20 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: virt: Alternative proposal for passing flags in/from vm/device 
hooks
..

virt: Alternative proposal for passing flags in/from vm/device hooks

Change-Id: I5f0f18beff1f1ed8da8658c4b3786f4133fa030f
Signed-off-by: mirecki 
---
M lib/vdsm/hooks.py
M vdsm/hooking.py
M vdsm/virt/vm.py
3 files changed, 31 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/03/57803/1

diff --git a/lib/vdsm/hooks.py b/lib/vdsm/hooks.py
index 67cb77d..1c0d45b 100644
--- a/lib/vdsm/hooks.py
+++ b/lib/vdsm/hooks.py
@@ -25,6 +25,7 @@
 import hashlib
 import itertools
 import json
+import libvirt
 import logging
 import os
 import os.path
@@ -410,6 +411,20 @@
 raiseError=False, hookType=_JSON_HOOK)
 
 
+def get_vm_launch_flags_from_file(vm_id):
+flags_file = "/var/run/vdsm/hook/" + vm_id + "/launchflags"
+if os.path.isfile(flags_file):
+with open(flags_file) as f:
+return f.readline()
+return libvirt.VIR_DOMAIN_NONE
+
+
+def dump_vm_launch_flags_to_file(vm_id, flags):
+flags_file = "/var/run/vdsm/hook/" + vm_id + "/launchflags"
+with open(flags_file, mode='w') as file:
+file.write(str(flags))
+
+
 def _getScriptInfo(path):
 try:
 with open(path) as f:
diff --git a/vdsm/hooking.py b/vdsm/hooking.py
index 97bf13d..a17d9e5 100644
--- a/vdsm/hooking.py
+++ b/vdsm/hooking.py
@@ -36,6 +36,7 @@
 >2 - reserved
 """
 
+import hooks
 import json
 import os
 import sys
@@ -73,6 +74,14 @@
 sys.stderr.write(message + '\n')
 
 
+def get_vm_launch_flags_from_file(vm_id):
+hooks.get_vm_launch_flags_from_file(vm_id)
+
+
+def dump_vm_launch_flags_to_file(vm_id, flags):
+hooks.dump_vm_launch_flags_to_file(vm_id, flags)
+
+
 def exit_hook(message, return_code=2):
 """
 Exit the hook with a given message, which will be printed to the standard
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index baf9837..61fc260 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1971,7 +1971,6 @@
 self._connection.lookupByUUIDString(self.id),
 self._timeoutExperienced)
 else:
-domxml = hooks.before_vm_start(self._buildDomainXML(), self.conf)
 # TODO: this is debug information. For 3.6.x we still need to
 # see the XML even with 'info' as default level.
 self.log.info(domxml)
@@ -1982,6 +1981,13 @@
 flags |= libvirt.VIR_DOMAIN_START_PAUSED
 self.conf['pauseCode'] = 'NOERR'
 del self.conf['launchPaused']
+
+hooks.dump_vm_launch_flags_to_file(self.id, flags)
+# Dear code reviewer, we can not move the flags into
+# before_vm_start, as it is also needed in _buildDomainXML
+domxml = hooks.before_vm_start(self._buildDomainXML(), self.conf)
+flags = hooks.get_vm_launch_flags_from_file(self.id)
+
 self._dom = virdomain.Notifying(
 self._connection.createXML(domxml, flags),
 self._timeoutExperienced)


-- 
To view, visit https://gerrit.ovirt.org/57803
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f0f18beff1f1ed8da8658c4b3786f4133fa030f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: virt: Collect vm start flags from device hooks when running vm

2016-05-18 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: virt: Collect vm start flags from device hooks when running vm
..


Patch Set 5:

(3 comments)

https://gerrit.ovirt.org/#/c/57538/5/lib/vdsm/hooks.py
File lib/vdsm/hooks.py:

Line 138: return _runHooksDir(devicexml, 'after_device_destroy', 
vmconf=vmconf,
Line 139: params=customProperties, raiseError=False)
Line 140: 
Line 141: 
Line 142: def before_vm_start(domxml, vmconf={}):
> we pass the intact domxml here. we should pass the intact flags as well.
The flags (so far we only have one) are passed in vmconf (from vm.conf)
We would have to dump all the vm configuration there. Do we want to do this?
Line 143: domxml = _runHooksDir(domxml, 'before_vm_start', vmconf=vmconf)
Line 144: flags = _get_vm_launch_flags_from_file(vmconf['vmId'])
Line 145: return (domxml, flags)
Line 146: 


Line 139: params=customProperties, raiseError=False)
Line 140: 
Line 141: 
Line 142: def before_vm_start(domxml, vmconf={}):
Line 143: domxml = _runHooksDir(domxml, 'before_vm_start', vmconf=vmconf)
> Please document the location and content of the file in our man page (vdsmd
Done
Line 144: flags = _get_vm_launch_flags_from_file(vmconf['vmId'])
Line 145: return (domxml, flags)
Line 146: 
Line 147: 


Line 421: return {'md5': md5}
Line 422: 
Line 423: 
Line 424: def _get_vm_launch_flags_from_file(vm_id):
Line 425: launchfile = "/var/run/vdsm/hook/" + vm_id + "/launchflags"
> I'd like this file to hold a single decimal, that is consumable by libvirt 
Done
Line 426: flags = {}
Line 427: if os.path.isfile(launchfile):
Line 428: with open(launchfile) as f:
Line 429: for line in f:


-- 
To view, visit https://gerrit.ovirt.org/57538
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I554e304027ea25340634e8def5ddeef99d98a10a
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: virt: Adding 'delayedLaunch' to vm start

2016-05-17 Thread mmirecki
Marcin Mirecki has abandoned this change.

Change subject: virt: Adding 'delayedLaunch' to vm start
..


Abandoned

The patch is to monstrous to allow it to go in. Abandoning

-- 
To view, visit https://gerrit.ovirt.org/57395
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: abandon
Gerrit-Change-Id: Ia11dbc49428d728bd4273f7a2e2ad3f9d29d6ef3
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: virt: Collect vm start flags from device hooks when running vm

2016-05-16 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: virt: Collect vm start flags from device hooks when running vm
..

virt: Collect vm start flags from device hooks when running vm

Change-Id: I554e304027ea25340634e8def5ddeef99d98a10a
Bug-Url: https://bugzilla.redhat.com/1314371
Signed-off-by: mirecki 
---
M vdsm/virt/vm.py
1 file changed, 14 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/38/57538/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 202cf55..09b5cd8 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1965,7 +1965,10 @@
 self._connection.lookupByUUIDString(self.id),
 self._timeoutExperienced)
 else:
-domxml = hooks.before_vm_start(self._buildDomainXML(), self.conf)
+# _buildDomainXML invokes the device hooks
+domain_xml = self._buildDomainXML()
+self._update_vm_launch_flags_from_file(self.id)
+domxml = hooks.before_vm_start(domain_xml, self.conf)
 # TODO: this is debug information. For 3.6.x we still need to
 # see the XML even with 'info' as default level.
 self.log.info(domxml)
@@ -1994,6 +1997,16 @@
 if initDomain:
 self._domDependentInit()
 
+def _update_vm_launch_flags_from_file(self, vm_id):
+launchfile = "/var/run/vdsm/hook/" + vm_id + "/launchflags"
+if os.path.isfile(launchfile):
+new_conf_dict = {}
+with open(launchfile) as f:
+for line in f:
+(key, val) = line.split()
+new_conf_dict[key] = val
+self.conf.update(new_conf_dict)
+
 def _updateDevices(self, devices):
 """
 Update self.conf with updated devices


-- 
To view, visit https://gerrit.ovirt.org/57538
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I554e304027ea25340634e8def5ddeef99d98a10a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: virt: Temporary fix resolving race condition when adding ext...

2016-05-12 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: virt: Temporary fix resolving race condition when adding 
external network to vm
..

virt: Temporary fix resolving race condition when adding external network to vm

Change-Id: Ia11dbc49428d728bd4273f7a2e2ad3f9d29d6ef3
Bug-Url: https://bugzilla.redhat.com/1314371
Signed-off-by: mirecki 
---
M vdsm/virt/vm.py
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/57395/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 5fb15b9..e670da8 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1642,6 +1642,13 @@
 deviceXML = hooks.before_device_create(
 deviceXML, self.conf, dev.custom)
 
+provider_type = dev.custom.get("provider_type")
+self.log.error("MMM: type: " + str(type))
+if provider_type == "OPENSTACK_NETWORK" or \
+   provider_type == "EXTERNAL_NETWORK":
+self.conf['launchPaused'] = 1
+self.conf['resumeAfterLaunch'] = 1
+
 dev._deviceXML = deviceXML
 domxml.appendDeviceXML(deviceXML)
 
@@ -1979,6 +1986,12 @@
 self._dom = virdomain.Notifying(
 self._connection.createXML(domxml, flags),
 self._timeoutExperienced)
+
+if 'resumeAfterLaunch' in self.conf:
+time.sleep(5)
+self._dom.resume()
+del self.conf['resumeAfterLaunch']
+
 hooks.after_vm_start(self._dom.XMLDesc(0), self.conf)
 for dev in self._customDevices():
 hooks.after_device_create(dev._deviceXML, self.conf,


-- 
To view, visit https://gerrit.ovirt.org/57395
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia11dbc49428d728bd4273f7a2e2ad3f9d29d6ef3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: net: Network speed reported as -1 if it can not be determined

2016-05-05 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: net: Network speed reported as -1 if it can not be determined
..


Patch Set 1: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/57108
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I5f5c4a2b0b3f0df53a740b2b6a0e9d331f85c1ae
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Tomas Jelinek 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: net: Network speed reported as -1 if it can not be determined

2016-05-05 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: net: Network speed reported as -1 if it can not be determined
..

net: Network speed reported as -1 if it can not be determined

If network speed can not be determined, as is for example the case
with virtio devices, the reported network speed should be -1

Change-Id: I5f5c4a2b0b3f0df53a740b2b6a0e9d331f85c1ae
Bug-Url: https://bugzilla.redhat.com/1322529
Signed-off-by: mirecki 
---
M lib/vdsm/network/netinfo/nics.py
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/08/57108/1

diff --git a/lib/vdsm/network/netinfo/nics.py b/lib/vdsm/network/netinfo/nics.py
index 1fd6aaa..07240cf 100644
--- a/lib/vdsm/network/netinfo/nics.py
+++ b/lib/vdsm/network/netinfo/nics.py
@@ -56,8 +56,10 @@
 return _ibHackedSpeed(nic_name)
 else:
 logging.exception('cannot read %s nic speed', nic_name)
+return -1
 except Exception:
 logging.exception('cannot read %s speed', nic_name)
+return -1
 return 0
 
 
@@ -68,9 +70,9 @@
 https://bugzilla.redhat.com/show_bug.cgi?id=1101314
 """
 try:
-return 1 if drv_name(nic_name) == 'ib_ipoib' else 0
+return 1 if drv_name(nic_name) == 'ib_ipoib' else -1
 except IOError:
-return 0
+return -1
 
 
 def info(link, paddr):


-- 
To view, visit https://gerrit.ovirt.org/57108
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f5c4a2b0b3f0df53a740b2b6a0e9d331f85c1ae
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: net: Removing 'link' scoped addresses from the ip address list

2016-03-08 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: net: Removing 'link' scoped addresses from the ip address list
..


Patch Set 3: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/54211
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: If8bbee8deebdfc617bc82f811e8a20e4db11ebb5
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Yevgeny Zaspitsky 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: net: Removing 'link' scoped addresses from the ip address list

2016-03-02 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: net: Removing 'link' scoped addresses from the ip address list
..


Patch Set 2:

(3 comments)

https://gerrit.ovirt.org/#/c/54211/2/tests/network/netinfo_test.py
File tests/network/netinfo_test.py:

Line 319: """filter away ipv6 link local addresses that may or may 
not exist
Line 320: on the device depending on OS configuration"""
Line 321: ipv4addr, ipv4netmask, ipv4addrs, ipv6addrs = \
Line 322: addresses.getIpInfo(*a, **kw)
Line 323: ipv6addrs = [
> heh, without the dropped condition, this is a NO-OP.
Done
Line 324: addr for addr in ipv6addrs]
Line 325: return ipv4addr, ipv4netmask, ipv4addrs, ipv6addrs
Line 326: 
Line 327: IP_ADDR = '192.0.2.2'


Line 320: on the device depending on OS configuration"""
Line 321: ipv4addr, ipv4netmask, ipv4addrs, ipv6addrs = \
Line 322: addresses.getIpInfo(*a, **kw)
Line 323: ipv6addrs = [
Line 324: addr for addr in ipv6addrs]
> .. unless I'm mistaken, and this code is still needed to filter-out the ipv
Looking deeper into what is happening inside, we only check against:
linklocal_network = IPv4Network('169.254.0.0/16')
linklocal_network = IPv6Network('fe80::/10')
So it looks like we can remove this too.
Line 325: return ipv4addr, ipv4netmask, ipv4addrs, ipv6addrs
Line 326: 
Line 327: IP_ADDR = '192.0.2.2'
Line 328: IP_ADDR_SECOND = '192.0.2.3'


Line 368: test_drop_link_addr
> link addr is another name for a mac, better use some other name. 
Done


-- 
To view, visit https://gerrit.ovirt.org/54211
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: If8bbee8deebdfc617bc82f811e8a20e4db11ebb5
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Yevgeny Zaspitsky 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: net: Removing cfg entry from get capabilities

2016-03-02 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: net: Removing cfg entry from get capabilities
..


Patch Set 3:

ovirt-hosted-engine-setup will be adapting to our changes:
https://bugzilla.redhat.com/show_bug.cgi?id=1313881

-- 
To view, visit https://gerrit.ovirt.org/53746
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I71742512e82f6009c4d1a50e7122c18a6961a908
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Alona Kaplan 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Ondřej Svoboda 
Gerrit-Reviewer: Simone Tiraboschi 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: net: Removing cfg entry from get capabilities

2016-03-02 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: net: Removing cfg entry from get capabilities
..


Patch Set 3: Code-Review-1

-- 
To view, visit https://gerrit.ovirt.org/53746
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I71742512e82f6009c4d1a50e7122c18a6961a908
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Alona Kaplan 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Ondřej Svoboda 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: net: Removing 'link' scoped addresses from the ip address list

2016-03-01 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: net: Removing 'link' scoped addresses from the ip address list
..

net: Removing 'link' scoped addresses from the ip address list

This method should not report link scoped ip addresses.

Change-Id: If8bbee8deebdfc617bc82f811e8a20e4db11ebb5
Signed-off-by: mirecki 
---
M lib/vdsm/netinfo/addresses.py
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/54211/1

diff --git a/lib/vdsm/netinfo/addresses.py b/lib/vdsm/netinfo/addresses.py
index 0b9741f..13ed0c6 100644
--- a/lib/vdsm/netinfo/addresses.py
+++ b/lib/vdsm/netinfo/addresses.py
@@ -45,6 +45,8 @@
 return addr_net in gw_net
 
 for addr in ipaddrs[dev]:
+if addr['scope'] == 'link':
+continue
 address_cidr = nl_addr.cidr_form(addr)  # x.y.z.t/N
 if addr['family'] == 'inet':  # ipv4
 ipv4addrs.append(address_cidr)


-- 
To view, visit https://gerrit.ovirt.org/54211
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If8bbee8deebdfc617bc82f811e8a20e4db11ebb5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: net: Removing cfg entry from get capabilities

2016-02-19 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: net: Removing cfg entry from get capabilities
..


Patch Set 2: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/53746
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I71742512e82f6009c4d1a50e7122c18a6961a908
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Alona Kaplan 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: net: Removing cfg entry from get capabilities

2016-02-19 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: net: Removing cfg entry from get capabilities
..

net: Removing cfg entry from get capabilities

Cfg entry in capabilities report is no longer needed as of 3.6,
so it needs to be removed.

Change-Id: I71742512e82f6009c4d1a50e7122c18a6961a908
Signed-off-by: mirecki 
---
M lib/vdsm/netinfo/bonding.py
M lib/vdsm/netinfo/cache.py
M lib/vdsm/netinfo/dhcp.py
3 files changed, 0 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/53746/1

diff --git a/lib/vdsm/netinfo/bonding.py b/lib/vdsm/netinfo/bonding.py
index 49c0f29..a462335 100644
--- a/lib/vdsm/netinfo/bonding.py
+++ b/lib/vdsm/netinfo/bonding.py
@@ -174,12 +174,6 @@
  in sorted(opts.iteritems(
 
 
-def bondOptsCompat(info):
-"""Add legacy ifcfg option if missing."""
-if info['opts'] and 'BONDING_OPTS' not in info['cfg']:
-info['cfg']['BONDING_OPTS'] = bondOptsForIfcfg(info['opts'])
-
-
 def permanent_address():
 paddr = {}
 for b in bondings():
diff --git a/lib/vdsm/netinfo/cache.py b/lib/vdsm/netinfo/cache.py
index 2e7833f..4435562 100644
--- a/lib/vdsm/netinfo/cache.py
+++ b/lib/vdsm/netinfo/cache.py
@@ -77,12 +77,8 @@
 else:
 continue
 devinfo.update(_devinfo(dev, routes, ipaddrs))
-if dev.isBOND():
-bonding.bondOptsCompat(devinfo)
 
 for network_name, network_info in six.iteritems(networking['networks']):
-if network_info['bridged']:
-network_info['cfg'] = networking['bridges'][network_name]['cfg']
 updates = propose_updates_to_reported_dhcp(network_info, networking)
 update_reported_dhcp(updates, networking)
 
@@ -136,7 +132,6 @@
 is_dhcpv4, is_dhcpv6 = dhcp_status(link.name, ipaddrs)
 
 info = {'addr': ipv4addr,
-'cfg': getIfaceCfg(link.name),
 'ipv4addrs': ipv4addrs,
 'ipv6addrs': ipv6addrs,
 'gateway': gateway,
@@ -145,8 +140,6 @@
 'dhcpv6': is_dhcpv6,
 'mtu': link.mtu,
 'netmask': ipv4netmask}
-if 'BOOTPROTO' not in info['cfg']:
-info['cfg']['BOOTPROTO'] = 'dhcp' if info['dhcpv4'] else 'none'
 return info
 
 
diff --git a/lib/vdsm/netinfo/dhcp.py b/lib/vdsm/netinfo/dhcp.py
index 830de7f..7fb0dee 100644
--- a/lib/vdsm/netinfo/dhcp.py
+++ b/lib/vdsm/netinfo/dhcp.py
@@ -41,13 +41,10 @@
 for devices in ('bridges', 'vlans', 'bondings', 'nics'):
 dev_info = networking[devices].get(network_device)
 if dev_info:
-cfg = {}
 updated_networking[devices][network_device] = {
 'dhcpv4': network_info['dhcpv4'],
 'dhcpv6': network_info['dhcpv6'],
-'cfg': cfg,
 }
-cfg['BOOTPROTO'] = 'dhcp' if network_info['dhcpv4'] else 'none'
 break
 
 return updated_networking
@@ -63,10 +60,6 @@
 device_info = networking[device_type][device_name]
 device_info['dhcpv4'] = replacement_device_info['dhcpv4']
 device_info['dhcpv6'] = replacement_device_info['dhcpv6']
-# Remove when cluster level < 3.6 is no longer supported and thus
-# it is not necessary to report ifcfg-like BOOTPROTO field.
-if replacement_device_info['cfg']:
-device_info['cfg'].update(replacement_device_info['cfg'])
 
 
 def dhcp_status(iface, ipaddrs):


-- 
To view, visit https://gerrit.ovirt.org/53746
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I71742512e82f6009c4d1a50e7122c18a6961a908
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: setupNetworks: moving nics between bonds

2016-02-04 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: setupNetworks: moving nics between bonds
..


Patch Set 11: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/50596
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia43fbfe90d1335ed4a740a1bc4f09610da2ecdce
Gerrit-PatchSet: 11
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Alona Kaplan 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: setupNetworks: moving nics between bonds

2016-01-29 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: setupNetworks: moving nics between bonds
..


Patch Set 9:

(3 comments)

https://gerrit.ovirt.org/#/c/50596/9/lib/vdsm/network/api.py
File lib/vdsm/network/api.py:

Line 694: logger.debug("Creating bond %r with options %s", bond, 
bond.options)
Line 695: configurator.configureBond(bond)
Line 696: 
Line 697: 
Line 698: def _calculate_all_removed_slaves(edited_bonds, _netinfo, 
configurator):
> nit: are we calculating removed (-> action done in the past) slaves or all 
_calculate_all_removed_slaves =>  _calculate_all_slaves_to_be_removed

Done
Line 699: all_removed_slaves = []
Line 700: for name, attrs in edited_bonds:
Line 701: slaves_removed_from_bond = 
(set(_netinfo.bondings[name]['slaves']) -
Line 702: set(attrs.get('nics')))


Line 703: all_removed_slaves.extend(slaves_removed_from_bond)
Line 704: return all_removed_slaves
Line 705: 
Line 706: 
Line 707: def _remove_slaves(removed_slaves, configurator, _netinfo):
> same nit: feels weird to remove already removed slaves :)
removed_slaves => slaves_to_remove

Done
Line 708: for name in removed_slaves:
Line 709: slave = Nic(name, configurator, _netinfo=_netinfo)
Line 710: slave.remove(remove_even_if_used=True)
Line 711: 


https://gerrit.ovirt.org/#/c/50596/9/lib/vdsm/network/configurators/iproute2.py
File lib/vdsm/network/configurators/iproute2.py:

Line 192: else:
Line 193: self._setNewMtu(bonding, 
vlans.vlan_devs_for_iface(bonding.name))
Line 194: 
Line 195: def removeNic(self, nic, remove_even_if_used=False):
Line 196: """ The nic is not removed from a bond, if slave of any.
> I don't know about the style in network code, but
Done
Line 197: This needs to be done explicitly.
Line 198: """
Line 199: toBeRemoved = not ifaceUsed(nic.name) or remove_even_if_used
Line 200: 


-- 
To view, visit https://gerrit.ovirt.org/50596
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia43fbfe90d1335ed4a740a1bc4f09610da2ecdce
Gerrit-PatchSet: 9
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Alona Kaplan 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: supervdsm: moving nics between bonds

2016-01-29 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: supervdsm: moving nics between bonds
..


Patch Set 8:

(5 comments)

https://gerrit.ovirt.org/#/c/50596/8//COMMIT_MSG
Commit Message:

Line 7: supervdsm: 
> setupNetworks:
Done


Line 16: Example:
> this example should be placed in a functional tests
Done


https://gerrit.ovirt.org/#/c/50596/8/lib/vdsm/network/api.py
File lib/vdsm/network/api.py:

Line 712: \
> no need for the trailing backslash inside parenthesis context.
Added parenthesis context to conform to comment :)
Done


https://gerrit.ovirt.org/#/c/50596/8/lib/vdsm/network/configurators/iproute2.py
File lib/vdsm/network/configurators/iproute2.py:

Line 195: force
> Please add a remark here, so we will not forget:
Done


Line 195: force
> keep name across configurators
Done


-- 
To view, visit https://gerrit.ovirt.org/50596
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia43fbfe90d1335ed4a740a1bc4f09610da2ecdce
Gerrit-PatchSet: 8
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Alona Kaplan 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: setupNetworks: moving nics between bonds

2016-01-29 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: setupNetworks: moving nics between bonds
..


Patch Set 9: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/50596
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia43fbfe90d1335ed4a740a1bc4f09610da2ecdce
Gerrit-PatchSet: 9
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Alona Kaplan 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: nic hotunplug, perform libvirt operation before modyfing...

2016-01-19 Thread mmirecki
Marcin Mirecki has abandoned this change.

Change subject: vm: nic hotunplug, perform libvirt operation before modyfing 
vdsm nic objects
..


Abandoned

This was an alternative solution to:
https://gerrit.ovirt.org/#/c/51187/
which is now merged.
This makes this patch obsolete.

-- 
To view, visit https://gerrit.ovirt.org/51193
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: abandon
Gerrit-Change-Id: I31ba3c622fa92e9c0898860eb93f6bb42bee3041
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: hooks: ovs: enable auto-attach mapping

2016-01-15 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: hooks: ovs: enable auto-attach mapping
..


Patch Set 1:

(1 comment)

https://gerrit.ovirt.org/#/c/51859/1/vdsm_hooks/ovs/ovs_before_network_setup_ovs.py
File vdsm_hooks/ovs/ovs_before_network_setup_ovs.py:

Line 166: if 'bonding' in attrs else [attrs['nic']])
Line 167: for interface in interfaces:
Line 168: command.extend(['--', 'set', 'Interface', interface,
Line 169: 'lldp:enable=true'])
Line 170: command.extend(['--', 'add-aa-mapping', network, sid, 
vlan])
> I don't understand, could you give me an example of broken behavior?
I am asking if the purpose of the method is just to replace a mapping, or also 
to delete and add mappings?
Line 171: 
Line 172: return command
Line 173: 
Line 174: 


-- 
To view, visit https://gerrit.ovirt.org/51859
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib0eaf7ee8b3f3027154df8f6c30a45d4b45c14e0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Petr Horáček 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: hooks: ovs: enable auto-attach mapping

2016-01-15 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: hooks: ovs: enable auto-attach mapping
..


Patch Set 1: Code-Review+1 -Verified

-- 
To view, visit https://gerrit.ovirt.org/51859
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib0eaf7ee8b3f3027154df8f6c30a45d4b45c14e0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Petr Horáček 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: hooks: ovs: enable auto-attach mapping

2016-01-15 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: hooks: ovs: enable auto-attach mapping
..


Patch Set 1: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/51859
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib0eaf7ee8b3f3027154df8f6c30a45d4b45c14e0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Petr Horáček 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: hooks: ovs: enable auto-attach mapping

2016-01-15 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: hooks: ovs: enable auto-attach mapping
..


Patch Set 1:

(1 comment)

https://gerrit.ovirt.org/#/c/51859/1/vdsm_hooks/ovs/ovs_before_network_setup_ovs.py
File vdsm_hooks/ovs/ovs_before_network_setup_ovs.py:

Line 160: if init_sid is not None:
: command.extend(['--', 'del-aa-mapping', network, init_sid,
: init_vlan])
: if sid is not None:
: interfaces = (
: running_config.bonds.get(attrs['bonding'])['nics']
: if 'bonding' in attrs else [attrs['nic']])
: for interface in interfaces:
: command.extend(['--', 'set', 'Interface', interface,
: 'lldp:enable=true'])
: command.extend(['--', 'add-aa-mapping', network, sid, 
vlan])
If either init_sid or sid is None, then we will just delete a mapping or just 
add a mapping.
Would this be the correct behaviour?


-- 
To view, visit https://gerrit.ovirt.org/51859
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib0eaf7ee8b3f3027154df8f6c30a45d4b45c14e0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[ovirt-3.6]: vm: restoring correct vm nic device after HotunplugTimeout

2016-01-04 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: restoring correct vm nic device after HotunplugTimeout
..


Patch Set 1: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/51339
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I1055a9c6b19143edf98da7f82459d96f3a406712
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Yaniv Bronhaim 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: restoring correct vm nic device after HotunplugTimeout

2016-01-04 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: restoring correct vm nic device after HotunplugTimeout
..


Patch Set 3: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/51187
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I1055a9c6b19143edf98da7f82459d96f3a406712
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[ovirt-3.6]: vm: restoring correct vm nic device after HotunplugTimeout

2016-01-04 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: vm: restoring correct vm nic device after HotunplugTimeout
..

vm: restoring correct vm nic device after HotunplugTimeout

When a nic is hotunpluged, it is first removed from the vdsm
devices, and then from libvirt. When the libvirt operation
fails, we need to revert the state of the nic in the vdsm
devices.

Change-Id: I1055a9c6b19143edf98da7f82459d96f3a406712
Bug-Url: https://bugzilla.redhat.com/1134256
Signed-off-by: Marcin Mirecki 
---
M vdsm/virt/vm.py
1 file changed, 13 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/39/51339/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index fc49c68..9414e23 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2295,18 +2295,15 @@
 self._waitForDeviceRemoval(nic)
 except HotunplugTimeout as e:
 self.log.error("%s", e)
+self._rollback_nic_hotunplug(nicDev, nic)
+hooks.after_nic_hotunplug_fail(nicXml, self.conf,
+   params=nic.custom)
 return response.error('hotunplugNic', "%s" % e)
 except libvirt.libvirtError as e:
 self.log.exception("Hotunplug failed")
 if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
 return response.error('noVM')
-# Restore NIC device in vm's conf and _devices
-if nicDev:
-with self._confLock:
-self.conf['devices'].append(nicDev)
-if nic:
-self._devices[hwclass.NIC].append(nic)
-self.saveState()
+self._rollback_nic_hotunplug(nicDev, nic)
 hooks.after_nic_hotunplug_fail(nicXml, self.conf,
params=nic.custom)
 return response.error('hotunplugNic', e.message)
@@ -2315,6 +2312,15 @@
   params=nic.custom)
 return {'status': doneCode, 'vmList': self.status()}
 
+# Restore NIC device in vm's conf and _devices
+def _rollback_nic_hotunplug(self, nic_dev, nic):
+if nic_dev:
+with self._confLock:
+self.conf['devices'].append(nic_dev)
+if nic:
+self._devices[hwclass.NIC].append(nic)
+self.saveState()
+
 def hotplugMemory(self, params):
 
 if self.isMigrating():


-- 
To view, visit https://gerrit.ovirt.org/51339
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1055a9c6b19143edf98da7f82459d96f3a406712
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: nic hotunplug exception handling - refactoring

2016-01-03 Thread mmirecki
Marcin Mirecki has abandoned this change.

Change subject: vm: nic hotunplug exception handling - refactoring
..


Abandoned

squashed into: https://gerrit.ovirt.org/#/c/51187/

-- 
To view, visit https://gerrit.ovirt.org/51190
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: abandon
Gerrit-Change-Id: Ibc06c9f19f130549dfac54e71d332ad470de61c3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: restoring correct vm nic device after HotunplugTimeout

2015-12-31 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: vm: restoring correct vm nic device after HotunplugTimeout
..

vm: restoring correct vm nic device after HotunplugTimeout

When a nic is hotunpluged, it is first removed from the vdsm
devices, and then from libvirt. When the libvirt operation
fails, we need to revert the state of the nic in the vdsm
devices.

Change-Id: I1055a9c6b19143edf98da7f82459d96f3a406712
Bug-Url: https://bugzilla.redhat.com/1134256
Signed-off-by: Marcin Mirecki 
---
M vdsm/virt/vm.py
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/87/51187/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index ae91531..8939603 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2310,6 +2310,14 @@
 hostdev.reattach_detachable(nic.hostdev)
 except HotunplugTimeout as e:
 self.log.error("%s", e)
+if nicDev:
+with self._confLock:
+self.conf['devices'].append(nicDev)
+if nic:
+self._devices[hwclass.NIC].append(nic)
+self.saveState()
+hooks.after_nic_hotunplug_fail(nicXml, self.conf,
+   params=nic.custom)
 return response.error('hotunplugNic', "%s" % e)
 except libvirt.libvirtError as e:
 self.log.exception("Hotunplug failed")


-- 
To view, visit https://gerrit.ovirt.org/51187
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1055a9c6b19143edf98da7f82459d96f3a406712
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: restoring correct vm nic device after HotunplugTimeout

2015-12-31 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: restoring correct vm nic device after HotunplugTimeout
..


Patch Set 1:

(1 comment)

This problem can also be solved by switching the order of removing the nic from 
'vdsm objects then libvirt' to 'libvirt then vdsm objects'
A patch alternative to this one:
https://gerrit.ovirt.org/51193

https://gerrit.ovirt.org/#/c/51187/1/vdsm/virt/vm.py
File vdsm/virt/vm.py:

Line 2316: if nic:
Line 2317: self._devices[hwclass.NIC].append(nic)
Line 2318: self.saveState()
Line 2319: hooks.after_nic_hotunplug_fail(nicXml, self.conf,
Line 2320:params=nic.custom)
> this code repetition is dangerous. please extract to a helper function, to 
The refactoring is done in: https://gerrit.ovirt.org/#/c/51190/
Line 2321: return response.error('hotunplugNic', "%s" % e)
Line 2322: except libvirt.libvirtError as e:
Line 2323: self.log.exception("Hotunplug failed")
Line 2324: if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:


-- 
To view, visit https://gerrit.ovirt.org/51187
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I1055a9c6b19143edf98da7f82459d96f3a406712
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: nic hotunplug exception handling - refactoring

2015-12-31 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: vm: nic hotunplug exception handling - refactoring
..

vm: nic hotunplug exception handling - refactoring

Pulling some common code to a helper function

Change-Id: Ibc06c9f19f130549dfac54e71d332ad470de61c3
Bug-Url: https://bugzilla.redhat.com/1134256
Signed-off-by: Marcin Mirecki 
---
M vdsm/virt/vm.py
1 file changed, 11 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/51190/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 8939603..47c38ec 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2310,12 +2310,7 @@
 hostdev.reattach_detachable(nic.hostdev)
 except HotunplugTimeout as e:
 self.log.error("%s", e)
-if nicDev:
-with self._confLock:
-self.conf['devices'].append(nicDev)
-if nic:
-self._devices[hwclass.NIC].append(nic)
-self.saveState()
+self._rollback_nic_hotunplug(nicDev, nic)
 hooks.after_nic_hotunplug_fail(nicXml, self.conf,
params=nic.custom)
 return response.error('hotunplugNic', "%s" % e)
@@ -2323,13 +2318,7 @@
 self.log.exception("Hotunplug failed")
 if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
 return response.error('noVM')
-# Restore NIC device in vm's conf and _devices
-if nicDev:
-with self._confLock:
-self.conf['devices'].append(nicDev)
-if nic:
-self._devices[hwclass.NIC].append(nic)
-self.saveState()
+self._rollback_nic_hotunplug(nicDev, nic)
 hooks.after_nic_hotunplug_fail(nicXml, self.conf,
params=nic.custom)
 return response.error('hotunplugNic', e.message)
@@ -2338,6 +2327,15 @@
   params=nic.custom)
 return {'status': doneCode, 'vmList': self.status()}
 
+# Restore NIC device in vm's conf and _devices
+def _rollback_nic_hotunplug(self, nic_dev, nic):
+if nic_dev:
+with self._confLock:
+self.conf['devices'].append(nic_dev)
+if nic:
+self._devices[hwclass.NIC].append(nic)
+self.saveState()
+
 def hotplugMemory(self, params):
 
 if self.isMigrating():


-- 
To view, visit https://gerrit.ovirt.org/51190
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc06c9f19f130549dfac54e71d332ad470de61c3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: nic hotunplug, perform libvirt operation before modyfing...

2015-12-31 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: vm: nic hotunplug, perform libvirt operation before modyfing 
vdsm nic objects
..

vm: nic hotunplug, perform libvirt operation before modyfing vdsm nic objects

When a nic is hotunpluged, it is first removed from the vdsm devices, and then 
from libvirt.
When the libvirt operation fails, the vdsm devices are in conflict with libvirt.
This is fixed by performing the libvirt operations first.

This is an alternative solution to:
https://gerrit.ovirt.org/#/c/51187/
and
https://gerrit.ovirt.org/#/c/51190/

Change-Id: I31ba3c622fa92e9c0898860eb93f6bb42bee3041
Bug-Url: https://bugzilla.redhat.com/1134256
Signed-off-by: Marcin Mirecki 
---
M vdsm/virt/vm.py
1 file changed, 13 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/51193/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 8939603..055c852 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2288,21 +2288,6 @@
nicParams)
 return response.error('hotunplugNic', "NIC not found")
 
-# Remove found NIC from vm's NICs list
-if nic:
-self._devices[hwclass.NIC].remove(nic)
-# Find and remove NIC device from vm's conf
-nicDev = None
-for dev in self.conf['devices'][:]:
-if (dev['type'] == hwclass.NIC and
-dev['macAddr'].lower() == nicParams['macAddr'].lower()):
-with self._confLock:
-self.conf['devices'].remove(dev)
-nicDev = dev
-break
-
-self.saveState()
-
 try:
 self._dom.detachDevice(nicXml)
 self._waitForDeviceRemoval(nic)
@@ -2310,12 +2295,6 @@
 hostdev.reattach_detachable(nic.hostdev)
 except HotunplugTimeout as e:
 self.log.error("%s", e)
-if nicDev:
-with self._confLock:
-self.conf['devices'].append(nicDev)
-if nic:
-self._devices[hwclass.NIC].append(nic)
-self.saveState()
 hooks.after_nic_hotunplug_fail(nicXml, self.conf,
params=nic.custom)
 return response.error('hotunplugNic', "%s" % e)
@@ -2323,17 +2302,24 @@
 self.log.exception("Hotunplug failed")
 if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
 return response.error('noVM')
-# Restore NIC device in vm's conf and _devices
-if nicDev:
-with self._confLock:
-self.conf['devices'].append(nicDev)
-if nic:
-self._devices[hwclass.NIC].append(nic)
 self.saveState()
 hooks.after_nic_hotunplug_fail(nicXml, self.conf,
params=nic.custom)
 return response.error('hotunplugNic', e.message)
 
+# Remove found NIC from vm's NICs list
+if nic:
+self._devices[hwclass.NIC].remove(nic)
+# Find and remove NIC device from vm's conf
+for dev in self.conf['devices'][:]:
+if (dev['type'] == hwclass.NIC and
+dev['macAddr'].lower() ==
+nicParams['macAddr'].lower()):
+with self._confLock:
+self.conf['devices'].remove(dev)
+break
+self.saveState()
+
 hooks.after_nic_hotunplug(nicXml, self.conf,
   params=nic.custom)
 return {'status': doneCode, 'vmList': self.status()}


-- 
To view, visit https://gerrit.ovirt.org/51193
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I31ba3c622fa92e9c0898860eb93f6bb42bee3041
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: supervdsm: moving nics between bonds

2015-12-24 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: supervdsm: moving nics between bonds
..


Patch Set 6:

(5 comments)

https://gerrit.ovirt.org/#/c/50596/6/lib/vdsm/network/api.py
File lib/vdsm/network/api.py:

Line 715: _calculate_slaves_removed_from_bond(
:_netinfo.bondings[name]['slaves'],
:attrs.get('nics'))
> I would directly use set(..) - set(..) here, less lines.
This was inline, but one of the previous comments was to move it to a separate 
method :)
I prefer the inline version.


Line 718: for removed_nic in deleted_slaves:
: removed_slaves.append(removed_nic)
> removed_slaves |= deleted_slaves
Done


https://gerrit.ovirt.org/#/c/50596/6/lib/vdsm/network/configurators/ifcfg.py
File lib/vdsm/network/configurators/ifcfg.py:

Line 195: force
> naming: I've learned the hard way that "force" is a bad name. The user can 
Done


Line 194: 
Line 195: def _ifaceDownAndCleanup(self, iface, force=False):
Line 196: """Returns True iff the iface is to be removed."""
Line 197: DynamicSourceRoute.addInterfaceTracking(iface)
Line 198: to_be_removed = not ifaceUsed(iface.name) or force
> better swap the order of the condition.
Done
Line 199: if to_be_removed:
Line 200: ifdown(iface.name)
Line 201: self._removeSourceRoute(iface, StaticSourceRoute)
Line 202: return to_be_removed


Line 232: force
> even_if_used ?
Done


-- 
To view, visit https://gerrit.ovirt.org/50596
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia43fbfe90d1335ed4a740a1bc4f09610da2ecdce
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Alona Kaplan 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: supervdsm: moving nics between bonds

2015-12-22 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: supervdsm: moving nics between bonds
..


Patch Set 5:

We objectivize bonds, with only the remaining slaves (original slaves - removed 
slaves), and pass them to configurator editBonding method.
editBonding adds, removes, and edits slaves. Since we only have the remaining 
slave present, we only remove the ones which are no longer there.

-- 
To view, visit https://gerrit.ovirt.org/50596
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia43fbfe90d1335ed4a740a1bc4f09610da2ecdce
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Alona Kaplan 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: supervdsm: moving nics between bonds

2015-12-22 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: supervdsm: moving nics between bonds
..


Patch Set 2:

(3 comments)

https://gerrit.ovirt.org/#/c/50596/2/lib/vdsm/network/api.py
File lib/vdsm/network/api.py:

Line 707: existing_slaves = set(_netinfo.bondings[name]['slaves'])
: removed_slaves = existing_slaves - set(attrs.get('nics'))
> please separate the computation of what needs to be removed to a different 
Done


Line 710: _netinfo.bondings[name]['slaves'] = existing_slaves - removed_slaves
> this is frowned upon. please call updateDevices to refresh _netinfo state. 
Done


https://gerrit.ovirt.org/#/c/50596/2/lib/vdsm/network/configurators/ifcfg.py
File lib/vdsm/network/configurators/ifcfg.py:

Line 129: remove_slaves
> now that this is simpler I'll ask you to implement also in iproute2 ;-)
Done


-- 
To view, visit https://gerrit.ovirt.org/50596
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia43fbfe90d1335ed4a740a1bc4f09610da2ecdce
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Alona Kaplan 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: supervdsm: moving nics between bonds

2015-12-22 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: supervdsm: moving nics between bonds
..


Patch Set 5:

(1 comment)

https://gerrit.ovirt.org/#/c/50596/5/lib/vdsm/network/models.py
File lib/vdsm/network/models.py:

Line 276: force_edited
In case all nics have to be removed, and nics is empty


-- 
To view, visit https://gerrit.ovirt.org/50596
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia43fbfe90d1335ed4a740a1bc4f09610da2ecdce
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Alona Kaplan 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: supervdsm: moving nics between bonds

2015-12-22 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: supervdsm: moving nics between bonds
..


Patch Set 6:

Another version where we don't objectivize the bonds, but just remove all the 
unwanted nics.
More efficient, but instead we have to modify the configurators to force nic 
removal.

I prefer version 5, with bond objectivization (even if we do some superfluous 
operations there).

-- 
To view, visit https://gerrit.ovirt.org/50596
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia43fbfe90d1335ed4a740a1bc4f09610da2ecdce
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Alona Kaplan 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: supervdsm: moving nics between bonds

2015-12-21 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: supervdsm: moving nics between bonds
..


Patch Set 1:

(7 comments)

https://gerrit.ovirt.org/#/c/50596/1/lib/vdsm/network/api.py
File lib/vdsm/network/api.py:

Line 687: ,
: _netinfo=_netinfo
> this line break is unrelated, right?
Done


Line 690: modified_bondings=bondings
> You probably meant to pass 'edition'.
We need the complete list of bondings, or at least all the bonds in which the 
new nics have been before the request (and from which they have been 
deleted/not deleted).


Line 708: modified_bondings
> Not in use.
Done


Line 711: for slave_name in _netinfo.bondings[name]['slaves']:
: if slave_name not in attrs.get('nics')
> removed_slaves = _netinfo.bondings[name]['slaves'] - attrs.get('nics')
Done


Line 714:  configurator.remove_slaves(removed_slaves, _netinfo)
> Why this is saved here?
We need to delete a slave from one bond, before adding it to another. The 
mechanism is the same as for instance configurator.configureBond.


https://gerrit.ovirt.org/#/c/50596/1/lib/vdsm/network/models.py
File lib/vdsm/network/models.py:

Line 262: if not existing_bond_name or new_bond_name == existing_bond_name:
> I would split this or expression into 2 tests (as done for next 2 tests) fo
Done


Line 268: bond['remove'] == 'true':
> can 'remove' be other then 'true'?
Done


-- 
To view, visit https://gerrit.ovirt.org/50596
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia43fbfe90d1335ed4a740a1bc4f09610da2ecdce
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Alona Kaplan 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: supervdsm: moving nics between bonds

2015-12-16 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: supervdsm: moving nics between bonds
..

supervdsm: moving nics between bonds

This patch fixes an problem where a slave removed from
one bond could sometimes not be assigned to another
bond in the same request.
This happened because removing, editing and adding of
slaves to a bond was done bond by bond, so if a nic
was added to a bond which was handled before the bond
from which the nic was removed the operation failed.
Example:
bond0: nic0, nic1   => nic2, nic3
bond1: nic2, nic3   => nic0, nic1
In this situation first bond0 is processed: nic0 and
nic1 will be removed, but nic2 and nic3 can not yet
be removed as they are part of bond1 (validation fails).
Processing of bond1 will introduce errors, as nic2 and
nic3 will be removed (already assigned to bond0),
which will in effect reset their ifcfg files, and cause
the previous attachement to bond0 to be undone.

The patch changes the validation to check if a slave
added to a bond is deleted from another bond.
Also the removing of slaves from all bonds is done
before any other bond operation.

Bug-Url: https://bugzilla.redhat.com/1269175
Change-Id: Ia43fbfe90d1335ed4a740a1bc4f09610da2ecdce
Signed-off-by: Marcin Mirecki 
---
M lib/vdsm/network/api.py
M lib/vdsm/network/configurators/ifcfg.py
M lib/vdsm/network/models.py
3 files changed, 43 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/96/50596/1

diff --git a/lib/vdsm/network/api.py b/lib/vdsm/network/api.py
index c3d82d4..d70b39f 100755
--- a/lib/vdsm/network/api.py
+++ b/lib/vdsm/network/api.py
@@ -680,10 +680,14 @@
 else:
 addition.append((name, attrs))
 
+_handle_removed_slaves(edition, _netinfo, configurator, bondings)
+
 for name, attrs in edition:
 bond = Bond.objectivize(name, configurator, attrs.get('options'),
-attrs.get('nics'), mtu=None, _netinfo=_netinfo,
-destroyOnMasterRemoval='remove' in attrs)
+attrs.get('nics'), mtu=None,
+_netinfo=_netinfo,
+destroyOnMasterRemoval='remove' in attrs,
+modified_bondings=bondings)
 if len(bond.slaves) == 0:
 raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'Missing required nics'
  ' for bonding device.')
@@ -700,6 +704,16 @@
 configurator.configureBond(bond)
 
 
+def _handle_removed_slaves(edited_bonds, _netinfo, configurator,
+   modified_bondings):
+for name, attrs in edited_bonds:
+removed_slaves = []
+for slave_name in _netinfo.bondings[name]['slaves']:
+if slave_name not in attrs.get('nics'):
+removed_slaves.append(slave_name)
+configurator.remove_slaves(removed_slaves, _netinfo)
+
+
 def _buildBondOptions(bondName, bondings, _netinfo):
 logger = logging.getLogger("_buildBondOptions")
 
diff --git a/lib/vdsm/network/configurators/ifcfg.py 
b/lib/vdsm/network/configurators/ifcfg.py
index f169400..6d49c61 100644
--- a/lib/vdsm/network/configurators/ifcfg.py
+++ b/lib/vdsm/network/configurators/ifcfg.py
@@ -126,6 +126,11 @@
 bond.name, {'options': bond.options,
 'nics': [slave.name for slave in bond.slaves]})
 
+def remove_slaves(self, removed_slaves, _netinfo):
+for nic in removed_slaves:
+ifdown(nic)  # So that no users will be detected for it.
+Nic(nic, self, _netinfo=_netinfo).remove()
+
 def editBonding(self, bond, _netinfo):
 """
 Modifies the bond so that the bond in the system ends up with the
@@ -148,10 +153,6 @@
 bond.master = Bridge(bridgeName, self, port=bond)
 self.configApplier.addBonding(bond)
 bondIfcfgWritten = True
-
-for nic in currentNics - nicsToSet:
-ifdown(nic)  # So that no users will be detected for it.
-Nic(nic, self, _netinfo=_netinfo).remove()
 
 for slave in bond.slaves:
 if slave.name in nicsToAdd:
diff --git a/lib/vdsm/network/models.py b/lib/vdsm/network/models.py
index a5609fd..9305a4d 100644
--- a/lib/vdsm/network/models.py
+++ b/lib/vdsm/network/models.py
@@ -257,13 +257,31 @@
 self.configurator.removeBond(self)
 
 @classmethod
-def _objectivizeSlaves(cls, name, configurator, nics, mtu, _netinfo):
+def is_slave_used(cls, new_bond_name, existing_bond_name, slave_name,
+  modified_bondings):
+if not existing_bond_name or new_bond_name == existing_bond_name:
+return False
+if not modified_bondings:
+return False
+if existing_bond_name in modified_bondings:
+bond = 

Change in vdsm[master]: supervdsm: moving nics between bonds

2015-12-16 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: supervdsm: moving nics between bonds
..


Patch Set 1: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/50596
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia43fbfe90d1335ed4a740a1bc4f09610da2ecdce
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[ovirt-3.6]: vm: move device attached check to device itself

2015-12-15 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: move device attached check to device itself
..


Patch Set 2: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/49670
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4df478798bc774c1134ca36879abd809ea2b6380
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: always return bond mode in Host.getCapabilities

2015-12-07 Thread mmirecki
Marcin Mirecki has abandoned this change.

Change subject: vm: always return bond mode in Host.getCapabilities
..


Abandoned

Duplicated:
 https://gerrit.ovirt.org/#/c/49580/

-- 
To view, visit https://gerrit.ovirt.org/49550
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: abandon
Gerrit-Change-Id: I697af1c895db5ece99b3f940242b77f623caa8b9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[ovirt-3.6]: vm: unit test for vm._waitForDriveRemoval

2015-12-07 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: unit test for vm._waitForDriveRemoval
..


Patch Set 1: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/49668
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4d1f86e17132a7099f109a5e33407c56dde40df2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Allon Mureinik 
Gerrit-Reviewer: Amit Aviram 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[ovirt-3.6]: vm: check operation result for vm nic hotunplug

2015-12-07 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: check operation result for vm nic hotunplug
..


Patch Set 1: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/49669
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I3d3b2c839cbb4733aecc8d5a0e9a1ae691e14ac3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Amit Aviram 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[ovirt-3.6]: vm: add test for nic unplug wait

2015-12-07 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: add test for nic unplug wait
..


Patch Set 2: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/49671
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4603efa0739c9bd50777a157c946da3ba8544729
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: adding xpath property to device Base class

2015-12-04 Thread mmirecki
Marcin Mirecki has abandoned this change.

Change subject: vm: adding xpath property to device Base class
..


Abandoned

No longer needed.

-- 
To view, visit https://gerrit.ovirt.org/49554
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: abandon
Gerrit-Change-Id: I29a7989cde44da0f756d48ae139fba47e524a40b
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[ovirt-3.6]: vm: add test for nic unplug wait

2015-12-04 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: add test for nic unplug wait
..


Patch Set 2:

Reordered.

The order in master was first moving the device_attached, and then the nic 
tests.

-- 
To view, visit https://gerrit.ovirt.org/49671
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4603efa0739c9bd50777a157c946da3ba8544729
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[ovirt-3.6]: vm: add test for nic unplug wait

2015-12-03 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: vm: add test for nic unplug wait
..

vm: add test for nic unplug wait

Change-Id: I4603efa0739c9bd50777a157c946da3ba8544729
Signed-off-by: Marcin Mirecki 
Bug-Url: https://bugzilla.redhat.com/1134256
Reviewed-on: https://gerrit.ovirt.org/49104
Tested-by: Nir Soffer 
Reviewed-by: Nir Soffer 
Continuous-Integration: Jenkins CI
---
M tests/vmTests.py
1 file changed, 15 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/49671/1

diff --git a/tests/vmTests.py b/tests/vmTests.py
index 2b2d8b0..bad95cb 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -43,6 +43,7 @@
 from virt import vmstatus
 from virt.vmdevices.storage import Drive
 from virt.vmdevices.storage import DISK_TYPE
+from virt.vmdevices.network import Interface
 from vdsm import constants
 from vdsm import define
 from vdsm import password
@@ -1284,12 +1285,20 @@
 
 """
 
+NIC_XML = """
+
+  
+
+"""
+
 drive_file = Drive({}, log=logging.getLogger(''), index=0, iface="",
path='test_path',  diskType=DISK_TYPE.FILE)
 drive_network = Drive({}, log=logging.getLogger(''), index=0, iface="",
   path='test_path', diskType=DISK_TYPE.NETWORK)
 drive_block = Drive({}, log=logging.getLogger(''), index=0, iface="",
 path="/block_path", diskType=DISK_TYPE.BLOCK)
+interface = Interface({}, log=logging.getLogger(''), macAddr="macAddr",
+  device='bridge', name='')
 
 @MonkeyPatch(vm, "config", make_config([
 ("vars", "hotunplug_timeout", "0.25"),
@@ -1298,7 +1307,8 @@
 @MonkeyPatch(utils, "isBlockDevice", lambda x: x == "/block_path")
 @permutations([[drive_file, FILE_DRIVE_XML],
[drive_network, NETWORK_DRIVE_XML],
-   [drive_block, BLOCK_DRIVE_XML]])
+   [drive_block, BLOCK_DRIVE_XML],
+   [interface, NIC_XML]])
 def test_timeout(self, device, matching_xml):
 testvm = TestingVm(WaitForRemovalFakeVmDom(matching_xml,
times_to_match=9))
@@ -1314,7 +1324,8 @@
 @MonkeyPatch(utils, "isBlockDevice", lambda x: x == "/block_path")
 @permutations([[drive_file, FILE_DRIVE_XML],
[drive_network, NETWORK_DRIVE_XML],
-   [drive_block, BLOCK_DRIVE_XML]])
+   [drive_block, BLOCK_DRIVE_XML],
+   [interface, NIC_XML]])
 def test_removed_on_first_check(self, device, matching_xml):
 testvm = TestingVm(WaitForRemovalFakeVmDom(matching_xml))
 testvm._waitForDeviceRemoval(device)
@@ -1327,7 +1338,8 @@
 @MonkeyPatch(utils, "isBlockDevice", lambda x: x == "/block_path")
 @permutations([[drive_file, FILE_DRIVE_XML],
[drive_network, NETWORK_DRIVE_XML],
-   [drive_block, BLOCK_DRIVE_XML]])
+   [drive_block, BLOCK_DRIVE_XML],
+   [interface, NIC_XML]])
 def test_removed_on_x_check(self, device, matching_xml):
 testvm = TestingVm(WaitForRemovalFakeVmDom(matching_xml,
times_to_match=2))


-- 
To view, visit https://gerrit.ovirt.org/49671
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4603efa0739c9bd50777a157c946da3ba8544729
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[ovirt-3.6]: vm: unit test for vm._waitForDriveRemoval

2015-12-03 Thread mmirecki
Hello Francesco Romani,

I'd like you to do a code review.  Please visit

https://gerrit.ovirt.org/49668

to review the following change.

Change subject: vm: unit test for vm._waitForDriveRemoval
..

vm: unit test for vm._waitForDriveRemoval

Added unit tests for vm._waitForDriveRemoval, in
preparation to make this generic for all devices.

Change-Id: I4d1f86e17132a7099f109a5e33407c56dde40df2
Signed-off-by: Marcin Mirecki 
Bug-Url: https://bugzilla.redhat.com/1134256
Reviewed-on: https://gerrit.ovirt.org/48880
Reviewed-by: Francesco Romani 
Continuous-Integration: Jenkins CI
Reviewed-by: Nir Soffer 
---
M lib/vdsm/config.py.in
M tests/vmTests.py
M vdsm/virt/vm.py
3 files changed, 121 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/49668/1

diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index 9cab004..7e9b89d 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -146,6 +146,10 @@
 ('hotunplug_timeout', '30',
 'Time to wait (in seconds) for a VM to detach its disk'),
 
+('hotunplug_check_interval', '1',
+'Time to wait (in seconds) between consecutive checks for device'
+'removal'),
+
 ('vm_watermark_interval', '2',
 'How often should we check drive watermark on block storage for '
 'automatic extension of thin provisioned volumes (seconds).'),
diff --git a/tests/vmTests.py b/tests/vmTests.py
index a7d5c63..f0be9b6 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -26,11 +26,13 @@
 import threading
 import time
 import uuid
+import xml.etree.cElementTree as etree
 
 import libvirt
 from nose.plugins.skip import SkipTest
 
 from virt import vm
+from virt.vm import HotunplugTimeout
 from virt import vmdevices
 from virt import vmexitreason
 from virt.vmdevices import hwclass
@@ -39,6 +41,8 @@
 from virt import vmxml
 from virt import vmstats
 from virt import vmstatus
+from virt.vmdevices.storage import Drive
+from virt.vmdevices.storage import DISK_TYPE
 from vdsm import constants
 from vdsm import define
 from vdsm import password
@@ -1264,6 +1268,116 @@
 return self._params
 
 
+@expandPermutations
+class TestWaitForRemoval(TestCaseBase):
+
+FILE_DRIVE_XML = """
+
+
+"""
+NETWORK_DRIVE_XML = """
+
+
+"""
+BLOCK_DRIVE_XML = """
+
+
+"""
+
+drive_file = Drive({}, log=logging.getLogger(''), index=0, iface="",
+   path='test_path',  diskType=DISK_TYPE.FILE)
+drive_network = Drive({}, log=logging.getLogger(''), index=0, iface="",
+  path='test_path', diskType=DISK_TYPE.NETWORK)
+drive_block = Drive({}, log=logging.getLogger(''), index=0, iface="",
+path="/block_path", diskType=DISK_TYPE.BLOCK)
+
+@MonkeyPatch(vm, "config", make_config([
+("vars", "hotunplug_timeout", "0.25"),
+("vars", "hotunplug_check_interval", "0.1")
+]))
+@MonkeyPatch(utils, "isBlockDevice", lambda x: x == "/block_path")
+@permutations([[drive_file, FILE_DRIVE_XML],
+   [drive_network, NETWORK_DRIVE_XML],
+   [drive_block, BLOCK_DRIVE_XML]])
+def test_timeout(self, drive, matching_xml):
+testvm = TestingVm(WaitForRemovalFakeVmDom(matching_xml,
+   times_to_match=9))
+self.assertRaises(HotunplugTimeout, testvm._waitForDriveRemoval, drive)
+
+# The timeout hotunplug_check_interval=1 should never be reached. We should
+# never reach sleep when device is removed in first check, and method
+# should exit immediately
+@MonkeyPatch(vm, "config", make_config([
+("vars", "hotunplug_timeout", "1")
+]))
+@MonkeyPatch(utils, "isBlockDevice", lambda x: x == "/block_path")
+@permutations([[drive_file, FILE_DRIVE_XML],
+   [drive_network, NETWORK_DRIVE_XML],
+   [drive_block, BLOCK_DRIVE_XML]])
+def test_removed_on_first_check(self, drive, matching_xml):
+testvm = TestingVm(WaitForRemovalFakeVmDom(matching_xml))
+testvm._waitForDriveRemoval(drive)
+self.assertEqual(testvm._dom.xmldesc_fetched, 1)
+
+@MonkeyPatch(vm, "config", make_config([
+("vars", "hotunplug_timeout", "1"),
+("vars", "hotunplug_check_interval", "0")
+]))
+@MonkeyPatch(utils, "isBlockDevice", lambda x: x == "/block_path")
+@permutations([[drive_file, FILE_DRIVE_XML],
+   [drive_network, NETWORK_DRIVE_XML],
+   [drive_block, BLOCK_DRIVE_XML]])
+def test_removed_on_x_check(self, drive, matching_xml):
+testvm = TestingVm(WaitForRemovalFakeVmDom(matching_xml,
+   times_to_match=2))
+

Change in vdsm[ovirt-3.6]: vm: check operation result for vm nic hotunplug

2015-12-03 Thread mmirecki
Hello Francesco Romani,

I'd like you to do a code review.  Please visit

https://gerrit.ovirt.org/49669

to review the following change.

Change subject: vm: check operation result for vm nic hotunplug
..

vm: check operation result for vm nic hotunplug

After detaching a device we need to verify that this device
has actually been detached.

This mechanism was already implemented for disks. This
patch generalizes the disk waiting mechanism so that it
can also be applied to nics.

This patch is similar to:
https://gerrit.ovirt.org/#/c/45138
https://bugzilla.redhat.com/1044466

Change-Id: I3d3b2c839cbb4733aecc8d5a0e9a1ae691e14ac3
Signed-off-by: Marcin Mirecki 
Bug-Url: https://bugzilla.redhat.com/1134256
Bug-Url: https://bugzilla.redhat.com/1199782
Reviewed-on: https://gerrit.ovirt.org/48473
Reviewed-by: Nir Soffer 
Continuous-Integration: Jenkins CI
Reviewed-by: Francesco Romani 
---
M tests/vmTests.py
M vdsm/virt/vm.py
M vdsm/virt/vmdevices/network.py
M vdsm/virt/vmdevices/storage.py
4 files changed, 43 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/69/49669/1

diff --git a/tests/vmTests.py b/tests/vmTests.py
index f0be9b6..2b2d8b0 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -1299,10 +1299,11 @@
 @permutations([[drive_file, FILE_DRIVE_XML],
[drive_network, NETWORK_DRIVE_XML],
[drive_block, BLOCK_DRIVE_XML]])
-def test_timeout(self, drive, matching_xml):
+def test_timeout(self, device, matching_xml):
 testvm = TestingVm(WaitForRemovalFakeVmDom(matching_xml,
times_to_match=9))
-self.assertRaises(HotunplugTimeout, testvm._waitForDriveRemoval, drive)
+self.assertRaises(HotunplugTimeout, testvm._waitForDeviceRemoval,
+  device)
 
 # The timeout hotunplug_check_interval=1 should never be reached. We should
 # never reach sleep when device is removed in first check, and method
@@ -1314,9 +1315,9 @@
 @permutations([[drive_file, FILE_DRIVE_XML],
[drive_network, NETWORK_DRIVE_XML],
[drive_block, BLOCK_DRIVE_XML]])
-def test_removed_on_first_check(self, drive, matching_xml):
+def test_removed_on_first_check(self, device, matching_xml):
 testvm = TestingVm(WaitForRemovalFakeVmDom(matching_xml))
-testvm._waitForDriveRemoval(drive)
+testvm._waitForDeviceRemoval(device)
 self.assertEqual(testvm._dom.xmldesc_fetched, 1)
 
 @MonkeyPatch(vm, "config", make_config([
@@ -1327,10 +1328,10 @@
 @permutations([[drive_file, FILE_DRIVE_XML],
[drive_network, NETWORK_DRIVE_XML],
[drive_block, BLOCK_DRIVE_XML]])
-def test_removed_on_x_check(self, drive, matching_xml):
+def test_removed_on_x_check(self, device, matching_xml):
 testvm = TestingVm(WaitForRemovalFakeVmDom(matching_xml,
times_to_match=2))
-testvm._waitForDriveRemoval(drive)
+testvm._waitForDeviceRemoval(device)
 self.assertEqual(testvm._dom.xmldesc_fetched, 3)
 
 
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index bd2bfb9..75591f1 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2251,6 +2251,10 @@
 
 try:
 self._dom.detachDevice(nicXml)
+self._waitForDeviceRemoval(nic)
+except HotunplugTimeout as e:
+self.log.error("%s", e)
+return response.error('hotunplugNic', "%s" % e)
 except libvirt.libvirtError as e:
 self.log.exception("Hotunplug failed")
 if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
@@ -2650,7 +2654,7 @@
 params=drive.custom)
 try:
 self._dom.detachDevice(driveXml)
-self._waitForDriveRemoval(drive)
+self._waitForDeviceRemoval(drive)
 except HotunplugTimeout as e:
 self.log.error("%s", e)
 return response.error('hotunplugDisk', "%s" % e)
@@ -2676,14 +2680,14 @@
 
 return {'status': doneCode, 'vmList': self.status()}
 
-def _waitForDriveRemoval(self, drive):
+def _waitForDeviceRemoval(self, device):
 """
 As stated in libvirt documentary, after detaching a device using
 virDomainDetachDeviceFlags, we need to verify that this device
 has actually been detached:
 libvirt.org/html/libvirt-libvirt-domain.html#virDomainDetachDeviceFlags
 
-This function waits for the disk device to be detached.
+This function waits for the device to be detached.
 
 Currently we use virDomainDetachDevice. However- That function behaves
 the same in that matter. (Currently it is not documented at libvirt's
@@ -2691,26 

Change in vdsm[ovirt-3.6]: vm: move device attached check to device itself

2015-12-03 Thread mmirecki
Hello Ido Barkan, Francesco Romani,

I'd like you to do a code review.  Please visit

https://gerrit.ovirt.org/49670

to review the following change.

Change subject: vm: move device attached check to device itself
..

vm: move device attached check to device itself

Moving the check for being attached to the device in question.

Change-Id: I4df478798bc774c1134ca36879abd809ea2b6380
Signed-off-by: Marcin Mirecki 
Bug-Url: https://bugzilla.redhat.com/1134256
Reviewed-on: https://gerrit.ovirt.org/48881
Reviewed-by: Francesco Romani 
Reviewed-by: Ido Barkan 
Continuous-Integration: Jenkins CI
---
M vdsm/virt/vm.py
M vdsm/virt/vmdevices/core.py
M vdsm/virt/vmdevices/network.py
M vdsm/virt/vmdevices/storage.py
4 files changed, 18 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/49670/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 75591f1..62fb26c 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2702,15 +2702,11 @@
 deadline = (utils.monotonic_time() +
 config.getfloat('vars', 'hotunplug_timeout'))
 sleep_time = config.getfloat('vars', 'hotunplug_check_interval')
-while self._isDeviceAttached(device):
+while device.is_attached_to(self._dom.XMLDesc(0)):
 time.sleep(sleep_time)
 if utils.monotonic_time() > deadline:
 raise HotunplugTimeout("Timeout detaching device %s"
% device.name)
-
-def _isDeviceAttached(self, device):
-root = ET.fromstring(self._dom.XMLDesc(0))
-return bool(root.findall(device.xpath))
 
 def _readPauseCode(self):
 state, reason = self._dom.state(0)
diff --git a/vdsm/virt/vmdevices/core.py b/vdsm/virt/vmdevices/core.py
index c2a135a..8b18986 100644
--- a/vdsm/virt/vmdevices/core.py
+++ b/vdsm/virt/vmdevices/core.py
@@ -56,6 +56,10 @@
  if not a.startswith('__')]
 return ' '.join(attrs)
 
+def is_attached_to(self, xml_string):
+raise NotImplementedError(
+"%s does not implement is_attached_to", self.__class__.__name__)
+
 
 class Generic(Base):
 
diff --git a/vdsm/virt/vmdevices/network.py b/vdsm/virt/vmdevices/network.py
index 76f70db..b2fa629 100644
--- a/vdsm/virt/vmdevices/network.py
+++ b/vdsm/virt/vmdevices/network.py
@@ -18,6 +18,8 @@
 # Refer to the README and COPYING files for full details of the license
 #
 
+import xml.etree.ElementTree as ET
+
 from vdsm import utils
 from vdsm.netinfo import DUMMY_BRIDGE
 
@@ -186,9 +188,13 @@
 self.conf,))
 
 @property
-def xpath(self):
+def _xpath(self):
 """
 Returns xpath to the device in libvirt dom xml
 The path is relative to the root element
 """
 return "./devices/interface/mac[@address='%s']" % self.macAddr
+
+def is_attached_to(self, xml_string):
+dom = ET.fromstring(xml_string)
+return bool(dom.findall(self._xpath))
diff --git a/vdsm/virt/vmdevices/storage.py b/vdsm/virt/vmdevices/storage.py
index 5878dae..3c4533d 100644
--- a/vdsm/virt/vmdevices/storage.py
+++ b/vdsm/virt/vmdevices/storage.py
@@ -19,6 +19,7 @@
 #
 
 import caps
+import xml.etree.ElementTree as ET
 
 from vdsm.config import config
 from vdsm import constants
@@ -424,7 +425,7 @@
 self._validateIoTuneParams(self.specParams['ioTune'])
 
 @property
-def xpath(self):
+def _xpath(self):
 """
 Returns xpath to the device in libvirt dom xml
 The path is relative to the root element
@@ -437,6 +438,10 @@
 return ("./devices/disk/source[@%s='%s']" %
 (source_key[self.diskType], self.path))
 
+def is_attached_to(self, xml_string):
+dom = ET.fromstring(xml_string)
+return bool(dom.findall(self._xpath))
+
 
 def _getSourceXML(drive):
 source = vmxml.Element('source')


-- 
To view, visit https://gerrit.ovirt.org/49670
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4df478798bc774c1134ca36879abd809ea2b6380
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: move device attached check to device itself

2015-12-02 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: move device attached check to device itself
..


Patch Set 15: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/48881
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4df478798bc774c1134ca36879abd809ea2b6380
Gerrit-PatchSet: 15
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Amit Aviram 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Vinzenz Feenstra 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: unit test for vm._waitForDriveRemoval

2015-12-02 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: unit test for vm._waitForDriveRemoval
..


Patch Set 12: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/48880
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4d1f86e17132a7099f109a5e33407c56dde40df2
Gerrit-PatchSet: 12
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Amit Aviram 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Vinzenz Feenstra 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: adding xpath property to device Base class

2015-12-02 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: adding xpath property to device Base class
..


Patch Set 1: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/49554
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I29a7989cde44da0f756d48ae139fba47e524a40b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: add test for nic unplug wait

2015-12-02 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: add test for nic unplug wait
..


Patch Set 11: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/49104
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4603efa0739c9bd50777a157c946da3ba8544729
Gerrit-PatchSet: 11
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: adding xpath property to device Base class

2015-12-02 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: vm: adding xpath property to device Base class
..

vm: adding xpath property to device Base class

Change-Id: I29a7989cde44da0f756d48ae139fba47e524a40b
Bug-Url: https://bugzilla.redhat.com/1134256
Signed-off-by: Marcin Mirecki 
---
M vdsm/virt/vmdevices/core.py
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/49554/1

diff --git a/vdsm/virt/vmdevices/core.py b/vdsm/virt/vmdevices/core.py
index 7402947..3bca823 100644
--- a/vdsm/virt/vmdevices/core.py
+++ b/vdsm/virt/vmdevices/core.py
@@ -60,6 +60,11 @@
 raise NotImplementedError(
 "%s does not implement is_attached_to", self.__class__.__name__)
 
+@property
+def _xpath(self):
+raise NotImplementedError(
+"%s does not implement _xpath", self.__class__.__name__)
+
 
 class Generic(Base):
 


-- 
To view, visit https://gerrit.ovirt.org/49554
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I29a7989cde44da0f756d48ae139fba47e524a40b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: check operation result for vm nic hotunplug

2015-12-02 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: check operation result for vm nic hotunplug
..


Patch Set 20:

xpath property added to base class in:
https://gerrit.ovirt.org/49554

-- 
To view, visit https://gerrit.ovirt.org/48473
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I3d3b2c839cbb4733aecc8d5a0e9a1ae691e14ac3
Gerrit-PatchSet: 20
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Amit Aviram 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Ido Barkan 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: always return bond mode in Host.getCapabilities

2015-12-02 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: always return bond mode in Host.getCapabilities
..


Patch Set 1: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/49550
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I697af1c895db5ece99b3f940242b77f623caa8b9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: always return bond mode in Host.getCapabilities

2015-12-02 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: always return bond mode in Host.getCapabilities
..


Patch Set 1:

(1 comment)

https://gerrit.ovirt.org/#/c/49550/1/lib/vdsm/netinfo.py
File lib/vdsm/netinfo.py:

Line 445: """
Line 446: opts = bondOpts(bond)
Line 447: mode = opts['mode'][-1] if 'mode' in opts else None
Line 448: defaults = getDefaultBondingOptions(mode)
Line 449: defaults.pop('mode', None)
optionaly:
if 'key' in myDict:
del myDict['key']

but pop is shorter
Line 450: 
Line 451: return dict(((opt, val[-1]) for (opt, val) in opts.iteritems()
Line 452:  if val and val != defaults.get(opt)))
Line 453: 


-- 
To view, visit https://gerrit.ovirt.org/49550
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I697af1c895db5ece99b3f940242b77f623caa8b9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: adding xpath property to device Base class

2015-12-02 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: adding xpath property to device Base class
..


Patch Set 1:

(1 comment)

https://gerrit.ovirt.org/#/c/49554/1/vdsm/virt/vmdevices/core.py
File vdsm/virt/vmdevices/core.py:

Line 62: 
Line 63: @property
Line 64: def _xpath(self):
Line 65: raise NotImplementedError(
Line 66: "%s does not implement _xpath", self.__class__.__name__)
> Why do we need this? this is private implementation detail of the network a
Answer to Francesco's request in:
https://gerrit.ovirt.org/#/c/48473/20
Line 67: 
Line 68: 
Line 69: class Generic(Base):
Line 70: 


-- 
To view, visit https://gerrit.ovirt.org/49554
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I29a7989cde44da0f756d48ae139fba47e524a40b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: always return bond mode in Host.getCapabilities

2015-12-01 Thread mmirecki
Marcin Mirecki has uploaded a new change for review.

Change subject: vm: always return bond mode in Host.getCapabilities
..

vm: always return bond mode in Host.getCapabilities

The 'mode' attribute in bonding options should always be returned in
Host.getCapabilities.

Change-Id: I697af1c895db5ece99b3f940242b77f623caa8b9
Bug-Url: https://bugzilla.redhat.com/1276445
Signed-off-by: Marcin Mirecki 
---
M lib/vdsm/netinfo.py
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/49550/1

diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index f3c9c0c..a30ac97 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -446,6 +446,7 @@
 opts = bondOpts(bond)
 mode = opts['mode'][-1] if 'mode' in opts else None
 defaults = getDefaultBondingOptions(mode)
+defaults.pop('mode', None)
 
 return dict(((opt, val[-1]) for (opt, val) in opts.iteritems()
  if val and val != defaults.get(opt)))


-- 
To view, visit https://gerrit.ovirt.org/49550
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I697af1c895db5ece99b3f940242b77f623caa8b9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: vm: unit test for vm._waitForDriveRemoval

2015-11-30 Thread mmirecki
Marcin Mirecki has posted comments on this change.

Change subject: vm: unit test for vm._waitForDriveRemoval
..


Patch Set 9: Verified+1

-- 
To view, visit https://gerrit.ovirt.org/48880
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4d1f86e17132a7099f109a5e33407c56dde40df2
Gerrit-PatchSet: 9
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki 
Gerrit-Reviewer: Amit Aviram 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki 
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Vinzenz Feenstra 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


  1   2   3   >