Change in vdsm[master]: deployUtil: expect integer vlan id from new netinfo
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: deployUtil: expect integer vlan id from new netinfo
......................................................................
deployUtil: expect integer vlan id from new netinfo
Commit 8b2bbe6e5 changed netinfo.getVlanID() to return the vlan id as an
integer, istead of a string. This makes a lot of sense, but breaks
compatibility with ancient deployUtil code.
Change-Id: Ibc1c5875e0d13b110f61f9eabf6d1964fc4c1237
Bug-Url: https://bugzilla.redhat.com/1037277
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm_reg/deployUtil.py.in
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/21948/1
diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in
index 2d379f6..ba45d64 100644
--- a/vdsm_reg/deployUtil.py.in
+++ b/vdsm_reg/deployUtil.py.in
@@ -1061,6 +1061,7 @@
else:
vlan, bonding, nic = _getRHELBridgeParams(mgtIface,
bridgeName=bridgeName)
+ vlan = str(vlan)
fReturn = (nic is not None)
#Delete existing bridge in oVirt
--
To view, visit http://gerrit.ovirt.org/21948
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc1c5875e0d13b110f61f9eabf6d1964fc4c1237
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: tests: declate alignmentScanTests as broken
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: tests: declate alignmentScanTests as broken
......................................................................
tests: declate alignmentScanTests as broken
More often then not,
alignmentScanTests.AlignmentScanTests.test_aligned_image
alignmentScanTests.AlignmentScanTests.test_unaligned_image
fail on our Jenkins slaves with the message
libguestfs: error: could not connect to libvirt (URI = NULL): Failed to connect socket to '/run/user/1001/libvirt/libvirt-sock': Permission denied [code=38 domain=7]
Mark them as broken until we understand the issue better.
Change-Id: Ic64c0c5a19c5b207ef6c00fcbb247ac39d975a88
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M tests/alignmentScanTests.py
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/21871/1
diff --git a/tests/alignmentScanTests.py b/tests/alignmentScanTests.py
index 8208b19..599f1b4 100644
--- a/tests/alignmentScanTests.py
+++ b/tests/alignmentScanTests.py
@@ -24,7 +24,7 @@
from nose.tools import eq_, raises
from nose.plugins.skip import SkipTest
from testrunner import VdsmTestCase as TestCaseBase
-from testValidation import slowtest
+from testValidation import brokentest, slowtest
from storage.misc import execCmd
from alignmentScan import runScanArgs, scanImage, VirtAlignError
@@ -57,6 +57,7 @@
scanImage("nonexistent-image-name")
@slowtest
+ @brokentest("libguestfs occasionally fails to open libvirt-sock")
def test_nonaligned_image(self):
validate_virtalignscan_installed()
with tempfile.NamedTemporaryFile() as img:
@@ -67,6 +68,7 @@
eq_(msg[0][4], 'bad (alignment < 4K)')
@slowtest
+ @brokentest("libguestfs occasionally fails to open libvirt-sock")
def test_aligned_image(self):
validate_virtalignscan_installed()
with tempfile.NamedTemporaryFile() as img:
--
To view, visit http://gerrit.ovirt.org/21871
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic64c0c5a19c5b207ef6c00fcbb247ac39d975a88
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: Quarantine ovirt-3.0.0 network upgrade
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: Quarantine ovirt-3.0.0 network upgrade
......................................................................
Quarantine ovirt-3.0.0 network upgrade
Since ovirt-3.0.z, Vdsm uses libvirt networks (with names vdsm-*) to store
its own networks. Older Vdsms did not have those defined, and used only
Linux bridges. _syncLibvirtNetworks created a vdsm-bla network for every
bridge named bla, even if that bridge had nothing to do with ovirt.
This patch replaces _syncLibvirtNetworks with a help script that does
this conversion on the rare occasion that upgrade is needed. It
identifies this occasion by the existence of ovirtmgmt bridge
and nonexistence of a vdsm-ovirtmgmt network.
Moving the code to a separate script would make it easier to get rid of
it once ovirt-3.0.0 hosts are no longer supported.
Change-Id: Icb2ffff1715dc3b92fc6c198dbb4c49f0bbef0cb
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M debian/vdsm.install
M init/vdsmd_init_common.sh.in
M vdsm.spec.in
M vdsm/Makefile.am
M vdsm/clientIF.py
A vdsm/upgrade-3.0.0-networks
6 files changed, 63 insertions(+), 23 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/03/20803/1
diff --git a/debian/vdsm.install b/debian/vdsm.install
index 55464a3..442ed2a 100644
--- a/debian/vdsm.install
+++ b/debian/vdsm.install
@@ -126,6 +126,7 @@
./usr/share/vdsm/supervdsm.py
./usr/share/vdsm/supervdsmServer
./usr/share/vdsm/tc.py
+./usr/share/vdsm/upgrade-3.0.0-networks
./usr/share/vdsm/vdsm
./usr/share/vdsm/vdsm-restore-net-config
./usr/share/vdsm/vdsm-store-net-config
diff --git a/init/vdsmd_init_common.sh.in b/init/vdsmd_init_common.sh.in
index 43a86ef..8470a03 100644
--- a/init/vdsmd_init_common.sh.in
+++ b/init/vdsmd_init_common.sh.in
@@ -199,6 +199,10 @@
fi
return 0
}
+
+task_upgrade_300_nets(){
+ "@VDSMDIR(a)/upgrade-3.0.0-networks"
+}
#### pre-start tasks end ####
@@ -246,6 +250,7 @@
test_lo \
test_conflicting_conf \
restore_nets \
+ upgrade_300_nets \
"
;;
--post-stop)
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 34bdc2d..3ae7102 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -833,6 +833,7 @@
%{_datadir}/%{vdsm_name}/supervdsmServer
%{_datadir}/%{vdsm_name}/vmChannels.py*
%{_datadir}/%{vdsm_name}/tc.py*
+%{_datadir}/%{vdsm_name}/upgrade-3.0.0-networks
%{_datadir}/%{vdsm_name}/vdsm
%{_datadir}/%{vdsm_name}/vdsm-restore-net-config
%{_datadir}/%{vdsm_name}/vdsm-store-net-config
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 7fd9ead..3975adf 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -85,6 +85,7 @@
get-conf-item \
set-conf-item \
supervdsmServer \
+ upgrade-3.0.0-networks \
vdsm \
vdsm-restore-net-config \
$(NULL)
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 47851b1..9e2f1b4 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -38,7 +38,6 @@
import vm
from vdsm import constants
from vdsm import utils
-from netconf import ifcfg
import caps
from vmChannels import Listener
from vm import Vm
@@ -196,27 +195,6 @@
self.log.warn("MOM is not available, fallback to KsmMonitor")
self.ksmMonitor = ksm.KsmMonitorThread(self)
-
- def _syncLibvirtNetworks(self):
- """
- function is mostly for upgrade from versions that did not
- have a libvirt network per vdsm network
- """
- # add libvirt networks
- nets = netinfo.networks()
- bridges = netinfo.bridges()
- configWriter = ifcfg.ConfigWriter()
- for bridge in bridges:
- if not bridge in nets:
- configWriter.createLibvirtNetwork(network=bridge,
- bridged=True,
- skipBackup=True)
- # remove bridged networks that their bridge not exists
- #TODO:
- # this should probably go into vdsm-restore-net script
- for network in nets:
- if nets[network]['bridged'] and network not in bridges:
- configWriter.removeLibvirtNetwork(network, skipBackup=True)
def prepareForShutdown(self):
"""
@@ -405,7 +383,6 @@
return {'status': doneCode, 'vmList': vm.status()}
def _initializingLibvirt(self):
- self._syncLibvirtNetworks()
mog = min(config.getint('vars', 'max_outgoing_migrations'),
caps.CpuTopology().cores())
vm.MigrationSourceThread.setMaxOutgoingMigrations(mog)
diff --git a/vdsm/upgrade-3.0.0-networks b/vdsm/upgrade-3.0.0-networks
new file mode 100644
index 0000000..8c3453a
--- /dev/null
+++ b/vdsm/upgrade-3.0.0-networks
@@ -0,0 +1,55 @@
+#!/usr/bin/python
+#
+# Copyright 2011-2013 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
+#
+
+"""
+Since ovirt-3.0, Vdsm uses libvirt networks (with names vdsm-*) to store its
+own networks. Older Vdsms did not have those defined, and used only linux
+bridges. This script is kept as an upgrade tool for the (very few) people who
+still have such old setups running.
+"""
+
+from vdsm import netinfo
+from vdsm.constants import MANAGEMENT_NETWORK
+
+from netconf import ifcfg
+
+def upgrade():
+ nets = netinfo.networks()
+ bridges = netinfo.bridges()
+ if (MANAGEMENT_NETWORK in nets or
+ MANAGEMENT_NETWORK not in bridges):
+ # upgrade has been done or was never needed
+ return
+
+ configWriter = ifcfg.ConfigWriter()
+ for bridge in bridges:
+ if not bridge in nets:
+ configWriter.createLibvirtNetwork(network=bridge,
+ bridged=True,
+ skipBackup=True)
+
+ # remove bridged networks that their bridge not exists
+ for network in nets:
+ if nets[network]['bridged'] and network not in bridges:
+ configWriter.removeLibvirtNetwork(network, skipBackup=True)
+
+if __name__ == '__main__':
+ upgrade()
--
To view, visit http://gerrit.ovirt.org/20803
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb2ffff1715dc3b92fc6c198dbb4c49f0bbef0cb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: Remove verbosity from restorecon hack for /var/log/core.
by mtayer@redhat.com
mooli tayer has uploaded a new change for review.
Change subject: Remove verbosity from restorecon hack for /var/log/core.
......................................................................
Remove verbosity from restorecon hack for /var/log/core.
vebosity spams consoel during installation.
Change-Id: I862039a6dfeebe38fc5c62276ae98213ef92bd02
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1031109
Signed-off-by: Mooli Tayer <mtayer(a)redhat.com>
---
M vdsm.spec.in
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/21888/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index f248b74..af0a552 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -664,7 +664,7 @@
if /usr/sbin/selinuxenabled; then
/usr/sbin/semanage fcontext -a -t virt_cache_t '/var/log/core(/.*)?'
fi
-/sbin/restorecon -R -v /var/log/core
+/sbin/restorecon -R /var/log/core
# hack until we replace core dump with abrt
%if 0%{?rhel}
--
To view, visit http://gerrit.ovirt.org/21888
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I862039a6dfeebe38fc5c62276ae98213ef92bd02
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: mooli tayer <mtayer(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: Unified network persistence [4/4] - Upgrade updates running ...
by amuller@redhat.com
Assaf Muller has uploaded a new change for review.
Change subject: Unified network persistence [4/4] - Upgrade updates running conf
......................................................................
Unified network persistence [4/4] - Upgrade updates running conf
Run a VDSM upgrade that gathers net info and updates the running
config of the unified network persistence.
Change-Id: I051b0f168b6357e60184409845ea410c5891b083
Signed-off-by: Assaf Muller <amuller(a)redhat.com>
---
M vdsm.spec.in
M vdsm/Makefile.am
M vdsm/upgrade/Makefile.am
A vdsm/upgrade/__init__.py
A vdsm/upgrade/unifiedPersistence.py
A vdsm/vdsm-unified-network-persistence
M vdsm/vdsmd.init.in
7 files changed, 140 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/25/18425/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 73fde5b..4e03b4f 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -832,6 +832,7 @@
%{_datadir}/%{vdsm_name}/vdsm
%{_datadir}/%{vdsm_name}/vdsm-restore-net-config
%{_datadir}/%{vdsm_name}/vdsm-store-net-config
+%{_datadir}/%{vdsm_name}/vdsm-unified-network-persistence
%{_datadir}/%{vdsm_name}/vm.py*
%{_datadir}/%{vdsm_name}/zombieReaper.py*
%config(noreplace) %{_sysconfdir}/%{vdsm_name}/logger.conf
@@ -973,6 +974,7 @@
%{_datadir}/%{vdsm_name}/set-conf-item
%dir %{_datadir}/%{vdsm_name}/upgrade
%{_datadir}/%{vdsm_name}/upgrade/upgrade.py*
+%{_datadir}/%{vdsm_name}/upgrade/unifiedPersistence.py*
%if 0%{?with_gluster}
%dir %{_datadir}/%{vdsm_name}/gluster
%{_datadir}/%{vdsm_name}/gluster/__init__.py*
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 4c5f02a..2712c4e 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -93,6 +93,7 @@
set-conf-item \
vdsm \
vdsm-restore-net-config \
+ vdsm-unified-network-persistence \
$(NULL)
nodist_man8_MANS = \
diff --git a/vdsm/upgrade/Makefile.am b/vdsm/upgrade/Makefile.am
index 014864a..558a19a 100644
--- a/vdsm/upgrade/Makefile.am
+++ b/vdsm/upgrade/Makefile.am
@@ -23,4 +23,6 @@
upgradedir = $(vdsmdir)/upgrade
dist_upgrade_PYTHON = \
- upgrade.py
+ upgrade.py \
+ unifiedPersistence.py
+
diff --git a/vdsm/upgrade/__init__.py b/vdsm/upgrade/__init__.py
new file mode 100644
index 0000000..8e88115
--- /dev/null
+++ b/vdsm/upgrade/__init__.py
@@ -0,0 +1,18 @@
+# Copyright 2013 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
+#
diff --git a/vdsm/upgrade/unifiedPersistence.py b/vdsm/upgrade/unifiedPersistence.py
new file mode 100644
index 0000000..7db6646
--- /dev/null
+++ b/vdsm/upgrade/unifiedPersistence.py
@@ -0,0 +1,84 @@
+# Copyright 2013 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
+#
+
+from upgrade import Upgrade
+from vdsm import netinfo
+
+
+class UnifiedPersistence(Upgrade):
+ def run(self):
+ networks, bondings = self._getNetInfo()
+ self._persist(networks, bondings)
+
+ def _getNetInfo(self):
+ _netinfo = netinfo.NetInfo()
+ networks = {}
+ bondings = {}
+ whitelist = ['bridged', 'vlan', 'mtu', 'qosInbound', 'qosOutbound',
+ 'stp']
+
+ """
+ bridged="True | False"
+ vlan=<id>
+ bonding="<name>" | nic="<name>"
+ ipaddr="<ip>"
+ netmask="<ip>"
+ gateway="<ip>"
+ bootproto="dhcp | none"
+ delay="..."
+ onboot="yes | no"
+ """
+
+ for network, netParams in _netinfo.networks.iteritems():
+ networks[network] = {}
+ for k, v in netParams.iteritems():
+ if k in whitelist:
+ networks[network][k] = v
+ if netParams.get('ports'):
+ device = "".join(netParams['ports'])
+ else:
+ device = netParams['interface']
+ topLevelDevice = \
+ netParams['iface'] if netParams['bridged'] else device
+ bootproto = netinfo.getBootProtocol(topLevelDevice)
+ networks[network]['bootproto'] = bootproto
+ if bootproto != 'dhcp':
+ networks[network]['ipaddr'] = netParams['addr']
+ networks[network]['netmask'] = netParams['netmask']
+ networks[network]['gateway'] = netParams['gateway']
+ if device in _netinfo.bondings:
+ bondings[device] = \
+ {'nics': _netinfo.bondings[device]['slaves']}
+ networks[network]['bonding'] = device
+ else:
+ networks[network]['nic'] = device
+
+ return networks, bondings
+
+ def _persist(self, networks, bondings):
+ self.log.debug("networks: %s, bondings: %s" % (networks, bondings))
+ print("networks: %s, bondings: %s" % (networks, bondings))
+
+
+def main():
+ UnifiedPersistence().runIfNeeded()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/vdsm/vdsm-unified-network-persistence b/vdsm/vdsm-unified-network-persistence
new file mode 100755
index 0000000..64a4db9
--- /dev/null
+++ b/vdsm/vdsm-unified-network-persistence
@@ -0,0 +1,30 @@
+#! /usr/bin/python
+#
+# Copyright 2013 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
+#
+
+from upgrade.unifiedPersistence import UnifiedPersistence
+
+
+def main():
+ UnifiedPersistence().runIfNeeded()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in
index 1bdb911..215b0ff 100755
--- a/vdsm/vdsmd.init.in
+++ b/vdsm/vdsmd.init.in
@@ -261,6 +261,8 @@
return 1
fi
+ "@VDSMDIR@/vdsm-unified-network-persistence"
+
echo $"Starting up vdsm daemon: "
local vdsm_nice="$("${GETCONFITEM}" "${CONF_FILE}" vars vdsm_nice -5)"
--
To view, visit http://gerrit.ovirt.org/18425
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I051b0f168b6357e60184409845ea410c5891b083
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Assaf Muller <amuller(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: New upgrade system
by amuller@redhat.com
Assaf Muller has uploaded a new change for review.
Change subject: New upgrade system
......................................................................
New upgrade system
New simplistic upgrade system to support running code exactly
once.
Change-Id: Iba3c9c34f03134c192db1c2add31084824e195d9
Signed-off-by: Assaf Muller <amuller(a)redhat.com>
---
M configure.ac
M vdsm.spec.in
M vdsm/Makefile.am
A vdsm/upgrade/Makefile.am
A vdsm/upgrade/upgrade.py
5 files changed, 81 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/17726/1
diff --git a/configure.ac b/configure.ac
index 0ccca95..0504a8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -217,6 +217,7 @@
vdsm/storage/Makefile
vdsm/storage/imageRepository/Makefile
vdsm/storage/protect/Makefile
+ vdsm/upgrade/Makefile
vdsm_api/Makefile
vdsm_hooks/Makefile
vdsm_hooks/checkimages/Makefile
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 87bc231..4389575 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -964,6 +964,8 @@
%{_datadir}/%{vdsm_name}/respawn
%{_datadir}/%{vdsm_name}/sampling.py*
%{_datadir}/%{vdsm_name}/set-conf-item
+%dir %{_datadir}/%{vdsm_name}/upgrade
+%{_datadir}/%{vdsm_name}/upgrade/upgrade.py*
%if 0%{?with_gluster}
%dir %{_datadir}/%{vdsm_name}/gluster
%{_datadir}/%{vdsm_name}/gluster/__init__.py*
@@ -997,6 +999,7 @@
%config(noreplace) %{_sysconfdir}/pki/%{vdsm_name}/keys/libvirt_password
%dir %{_localstatedir}/lib/%{vdsm_name}
%dir %{_localstatedir}/lib/%{vdsm_name}/netconfback
+%dir %{_localstatedir}/lib/%{vdsm_name}/upgrade
%dir %{_localstatedir}/run/%{vdsm_name}
%dir %{_localstatedir}/run/%{vdsm_name}/sourceRoutes
%dir %{_localstatedir}/run/%{vdsm_name}/trackedInterfaces
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index c30dcd9..33f91d6 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -18,7 +18,7 @@
# Refer to the README and COPYING files for full details of the license
#
-SUBDIRS = netconf sos storage gluster
+SUBDIRS = netconf sos storage gluster upgrade
include $(top_srcdir)/build-aux/Makefile.subs
@@ -172,6 +172,7 @@
$(MKDIR_P) $(DESTDIR)$(vdsmrundir)/trackedInterfaces
$(MKDIR_P) $(DESTDIR)$(vdsmrundir)/payload
$(MKDIR_P) $(DESTDIR)$(vdsmlibdir)/netconfback
+ $(MKDIR_P) $(DESTDIR)$(vdsmlibdir)/upgrade
$(MKDIR_P) $(DESTDIR)$(vdsmpoolsdir)
$(MKDIR_P) $(DESTDIR)$(vdsmbackupdir)
$(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/libvirt/qemu/channels
diff --git a/vdsm/upgrade/Makefile.am b/vdsm/upgrade/Makefile.am
new file mode 100644
index 0000000..014864a
--- /dev/null
+++ b/vdsm/upgrade/Makefile.am
@@ -0,0 +1,26 @@
+#
+# Copyright 2013 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
+#
+
+include $(top_srcdir)/build-aux/Makefile.subs
+
+upgradedir = $(vdsmdir)/upgrade
+
+dist_upgrade_PYTHON = \
+ upgrade.py
diff --git a/vdsm/upgrade/upgrade.py b/vdsm/upgrade/upgrade.py
new file mode 100644
index 0000000..60913bc
--- /dev/null
+++ b/vdsm/upgrade/upgrade.py
@@ -0,0 +1,49 @@
+# Copyright 2013 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 logging
+import os
+
+import dsaversion
+from vdsm import constants
+
+
+class Upgrade(object):
+ def __init__(self):
+ self.upgradeName = self.__class__.__name__
+ self.log = logging.getLogger('vds')
+
+ def runIfNeeded(self):
+ if self.isNeeded():
+ self.log.debug("Running upgrade %s" % self.upgradeName)
+ self.run()
+ self.done()
+
+ def isNeeded(self):
+ return not os.path.exists(self._getUpgradeFilePath())
+
+ def run(self):
+ raise NotImplementedError
+
+ def done(self):
+ with open(self._getUpgradeFilePath(), 'w') as upgradeFile:
+ upgradeFile.write(dsaversion.raw_version_revision)
+
+ def _getUpgradeFilePath(self):
+ return constants.P_VDSM_LIB + "upgrade/%s" % self.upgradeName
--
To view, visit http://gerrit.ovirt.org/17726
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba3c9c34f03134c192db1c2add31084824e195d9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Assaf Muller <amuller(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: [WIP] vdsm: add support for virtiorng device
by mpoledni@redhat.com
Martin Polednik has uploaded a new change for review.
Change subject: [WIP] vdsm: add support for virtiorng device
......................................................................
[WIP] vdsm: add support for virtiorng device
Adds support for virtiorng with basic capabilities
- TODO: decide which sources are supported
agree upon API
Change-Id: I4b9b2c355e06bae5f66bbaadffd5fda8d3ed4e9a
Signed-off-by: Martin Polednik <mpoledni(a)redhat.com>
---
M vdsm/vm.py
M vdsm_api/vdsmapi-schema.json
2 files changed, 106 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/19091/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 69508fe..b7cdbbe 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -74,6 +74,7 @@
GENERAL_DEVICES = 'general'
BALLOON_DEVICES = 'balloon'
REDIR_DEVICES = 'redir'
+RNG_DEVICES = 'rng'
WATCHDOG_DEVICES = 'watchdog'
CONSOLE_DEVICES = 'console'
SMARTCARD_DEVICES = 'smartcard'
@@ -1645,6 +1646,41 @@
return self.createXmlElem('redirdev', self.device, ['bus', 'address'])
+class RngDevice(VmDevice):
+ def getXML(self):
+ """
+ <rng model='virtio'>
+ <rate period="2000" bytes="1234"/>
+ <backend model='random'>/dev/random</backend>
+ <!-- OR -->
+ <backend model='egd' type='udp'>
+ <source ...' />
+ </backend>
+ </rng>
+ """
+ rng = self.createXmlElem('rng', None, ['model'])
+ if 'bytes' in self.specParams:
+ rng.appendChildWithArgs('rate',
+ period=self.specParams.get('period'),
+ bytes=self.specParams['bytes'])
+
+ if self.specParams['backend_model'] == 'egd':
+ backend = self.createXmlElem('backend', None)
+ backend.setAttrs(model='egd',
+ type=self.specParams['backend_type'])
+ backend.appendChildWithArgs('source', None,
+ **self.specParams['path'])
+ backend.appendChildWithArgs('source', None,
+ **self.specParams['path2'])
+ rng.appendChild(backend)
+ else:
+ rng.appendChildWithArgs('backend',
+ text=self.specParams['path'],
+ model='random')
+
+ return rng
+
+
class ConsoleDevice(VmDevice):
def getXML(self):
"""
@@ -1729,6 +1765,7 @@
SOUND_DEVICES: [], VIDEO_DEVICES: [],
CONTROLLER_DEVICES: [], GENERAL_DEVICES: [],
BALLOON_DEVICES: [], REDIR_DEVICES: [],
+ RNG_DEVICES: [],
WATCHDOG_DEVICES: [], CONSOLE_DEVICES: [],
SMARTCARD_DEVICES: []}
@@ -1867,6 +1904,7 @@
GENERAL_DEVICES: [],
BALLOON_DEVICES: [],
REDIR_DEVICES: [],
+ RNG_DEVICES: [],
WATCHDOG_DEVICES: [],
CONSOLE_DEVICES: [],
SMARTCARD_DEVICES: []}
@@ -2865,6 +2903,7 @@
BALLOON_DEVICES: BalloonDevice,
WATCHDOG_DEVICES: WatchdogDevice,
REDIR_DEVICES: RedirDevice,
+ RNG_DEVICES: RngDevice,
CONSOLE_DEVICES: ConsoleDevice,
SMARTCARD_DEVICES: SmartCardDevice}
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 27c12c1..161b03b 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -1790,11 +1790,13 @@
#
# @smartcard: A smartcard device
#
+# @rng: A rng device
+#
# Since: 4.10.0
##
{'enum': 'VmDeviceType',
'data': ['disk', 'interface', 'video', 'sound', 'controller', 'balloon',
- 'channel', 'console', 'smartcard']}
+ 'channel', 'console', 'smartcard', 'rng']}
##
# @VmDiskDeviceType:
@@ -2621,6 +2623,70 @@
'specParams': 'VmSmartcardDeviceSpecParams'}}
##
+# @VmRngDeviceModel:
+#
+# An enumeration of VM rng device models
+#
+# @virtio: Currently the only supported model
+#
+# Since: <<<TODO: FIX>>>
+##
+{'enum': 'VmRngDeviceModel',
+ 'data': ['virtio']}
+
+##
+# @VmRngDeviceBackendModel:
+#
+# An enumeration of VM rng device backend models
+#
+# @random: Use
+#
+# @egd: Dont
+#
+# Since: <<<TODO: FIX>>>
+##
+{'enum': 'VmRngDeviceBackendModel',
+ 'data': ['random', 'egd']}
+
+##
+# @VmRngDeviceSpecParams:
+#
+# An enumeration of VM rng device models
+#
+# @backend_model: Will be added
+#
+# @bytes: #optional Will be added
+#
+# @period: #optional Will be added
+#
+# @path: Will be added
+#
+# @path2: #required when backend_model == egd
+#
+# Since: <<<TODO: FIX>>>
+##
+{'type': 'VmRngDeviceSpecParams',
+ 'data': {'backend_model': 'VmRngDeviceBackendModel',
+ '*bytes': 'int', '*period': 'int', 'path': 'str', 'path2': 'str'}}
+
+##
+# @VmRngDevice:
+#
+# Properties of a VM rng device.
+#
+# @deviceType: The device type (always @rng)
+#
+# @model: The model of rng device
+#
+# @specParams: Additional device parameters
+#
+# Since: <<<TODO: FIX>>>
+##
+{'type': 'VmRngDevice',
+ 'data': {'deviceType': 'VmDeviceType', 'model': 'VmRngDeviceModel',
+ 'specParams': 'VmRngDeviceSpecParams'}}
+
+##
# @VmConsoleDevice:
#
# Properties of a VM console device.
--
To view, visit http://gerrit.ovirt.org/19091
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b9b2c355e06bae5f66bbaadffd5fda8d3ed4e9a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpoledni(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: mkimage: create files with explicit permissions
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: mkimage: create files with explicit permissions
......................................................................
mkimage: create files with explicit permissions
Files in the ISO image, most notably `user_data` and `meta_data.json`
files on the config-drive have world readable permissions.
They contain sensitive data, so it is unsafe to do so.
This patch address the issue by adding the capability to set
per-file permissions at creation time in
mkimage._decodeFilesIntoDir
current default is 0o640, so we just avoid to create any world-readable
file at all.
Another approach to obtain exactly the same result could be to
leverate the -file-mode option of the `genisoimage` program.
But doing into the python code has the following advantages:
* creates the correct permissions right from the start, effectively
eliding the vulnerability window; if we let genisoimage fix things,
there is a (very short, indeed) time window on which the newly created
files are still world-readable.
* this paves the road to fine-grained, per-file permissions
with negligibile extra cost (in short, this is more forward-compatible).
Bug-Url: https://bugzilla.redhat.com/1034247
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
Change-Id: Id1a3baca2ec1bf2dd0762641633a749573c40147
---
M tests/mkimageTests.py
M vdsm/mkimage.py
2 files changed, 29 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/56/21956/1
diff --git a/tests/mkimageTests.py b/tests/mkimageTests.py
index 28b35bb..ed6df6a 100644
--- a/tests/mkimageTests.py
+++ b/tests/mkimageTests.py
@@ -28,6 +28,7 @@
from base64 import b64encode
import os
+import stat
from shutil import rmtree
from tempfile import mkdtemp
@@ -88,6 +89,17 @@
#pylint: disable=W0212
mkimage._P_PAYLOAD_IMAGES = self.orig_mkimage["_P_PAYLOAD_IMAGES"]
+ def _check_permissions(self, filepath, permsMask):
+ """
+ Ensure the file at `filepath' has the permissions coherent
+ with the given mask.
+ The mask may specifiy the required presence, or absence, of a
+ permission bit.
+ """
+ data = os.stat(filepath)
+ for perm, expected in permsMask:
+ self.assertEqual(bool(data.st_mode & perm), expected)
+
def _check_content(self):
"""
Ensure that the workdir contains what we want
@@ -101,7 +113,12 @@
self.assertTrue(filename in out_dir)
else:
self.assertTrue(os.path.basename(filename) in out_subdir)
- with open(os.path.join(self.workdir, filename), "r") as fd:
+ filepath = os.path.join(self.workdir, filename)
+ self._check_permissions(filepath,
+ ((stat.S_IROTH, False),
+ (stat.S_IWOTH, False),
+ (stat.S_IXOHT, False))
+ with open(filepath, "r") as fd:
content = fd.read()
self.assertEqual(content, self.expected_results[filename])
diff --git a/vdsm/mkimage.py b/vdsm/mkimage.py
index a4716c7..ca8585e 100644
--- a/vdsm/mkimage.py
+++ b/vdsm/mkimage.py
@@ -35,6 +35,16 @@
_P_PAYLOAD_IMAGES = os.path.join(P_VDSM_RUN, 'payload')
+def _openFile(filename, mode, perms=0o644):
+ '''
+ opens a filename allowing to specify the unix permissions
+ right from the start, to avoid world-readable files
+ with sensitive informations.
+ '''
+ fd = os.open(filename, os.O_CREAT|os.O_TRUNC|os.O_RDWR, perms)
+ return os.fdopen(fd, mode)
+
+
def _decodeFilesIntoDir(files, parentdir):
'''
create temp files from files list
@@ -55,7 +65,7 @@
except OSError as e:
if e.errno != os.errno.EEXIST:
raise
- with file(filename, 'w') as f:
+ with _openFile(filename, 'w', perms=0o640) as f:
f.write(base64.b64decode(content))
--
To view, visit http://gerrit.ovirt.org/21956
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1a3baca2ec1bf2dd0762641633a749573c40147
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: Add uploadIso API call for pushing ISOs into an active iso_d...
by Ryan Harper
Ryan Harper has uploaded a new change for review.
Change subject: Add uploadIso API call for pushing ISOs into an active iso_domain via pool
......................................................................
Add uploadIso API call for pushing ISOs into an active iso_domain via pool
The only way to get an ISO into the vdsm storage service is via ovirt-engine's
engine-iso-uploader. This requires a functioning ovirt-engine install. Instead
provide a simple API call to push the iso file out to the correct location.
Given an pool UUID, we can determine where the iso file should go via isoprefix
so use either wget or rsync to pull the iso file and place it in the pool's
iso_domain.
wget a remote iso
% vdsClient -s 0 uploadIso d3b3948a-ead6-11e1-a3a5-00fffe0000df \
http://server/path/Fedora-17-x86_64-netinst.iso
rsync in a local file
% vdsClient -s 0 uploadIso d3b3948a-ead6-11e1-a3a5-00fffe0000df \
/tmp/Fedora-17-x86_64-netinst.iso
Change-Id: Id78e46513c38789d08e63a38026b28bebb9a2b12
Signed-off-by: Ryan Harper <ryanh(a)us.ibm.com>
---
M vdsm/API.py
M vdsm/BindingXMLRPC.py
M vdsm/storage/hsm.py
M vdsm/storage/sp.py
M vdsm/storage/storage_exception.py
M vdsm_api/vdsmapi-schema.json
M vdsm_cli/vdsClient.py
7 files changed, 136 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/7849/1
diff --git a/vdsm/API.py b/vdsm/API.py
index 827f73b..734f40d 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -956,6 +956,9 @@
return self._irs.upgradeStoragePool(self._UUID,
targetDomVersion)
+ def uploadIso(self, srcPath, method):
+ return self._irs.uploadIso(self._UUID, srcPath, method)
+
def validateStorageServerConnection(self, domainType,
connectionParams):
return self._irs.validateStorageServerConnection(domainType,
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index 826c125..ca92779 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -563,6 +563,10 @@
pool = API.StoragePool(spUUID)
return pool.upgrade(targetDomVersion)
+ def poolUploadIso(self, spUUID, srcPath, method):
+ pool = API.StoragePool(spUUID)
+ return pool.uploadIso(srcPath, method)
+
def poolValidateStorageServerConnection(self, domType, spUUID, conList,
options=None):
pool = API.StoragePool(spUUID)
@@ -809,6 +813,7 @@
(self.poolSpmStart, 'spmStart'),
(self.poolSpmStop, 'spmStop'),
(self.poolUpgrade, 'upgradeStoragePool'),
+ (self.poolUploadIso, 'uploadIso'),
(self.poolValidateStorageServerConnection,
'validateStorageServerConnection'),
(self.poolUpdateVMs, 'updateVM'),
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 1e9311b..2fb9fae 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -1189,6 +1189,19 @@
pool = self.getPool(spUUID)
pool.uploadVolume(sdUUID, imgUUID, volUUID, srcPath, size, method="rsync")
+ @public
+ def uploadIso(self, spUUID, srcPath, method):
+ """
+ Uploads an ISO to <pool UUID>'s iso domain
+
+ :param spUUID: The UUID of the storage pool that will contain the new iso.
+ :type spUUID: UUID
+ :param method: The desired method of upload. Currently only *'wget'* and *'rsync'* are supported.
+ :type method: str
+ """
+ vars.task.getSharedLock(STORAGE, spUUID)
+ pool = self.getPool(spUUID)
+ pool.uploadIso(srcPath, method)
@public
def createVolume(self, sdUUID, spUUID, imgUUID, size, volFormat, preallocate, diskType, volUUID, desc, srcImgUUID=volume.BLANK_UUID, srcVolUUID=volume.BLANK_UUID):
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index c10974c..1c9dec7 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -2004,6 +2004,69 @@
except:
self.log.warning("SP %s SD %s img %s Vol %s - teardown failed")
+
+ def uploadIso(self, srcPath, method):
+ self.log.info("uploadIso - srcPath=%s method=%s"%(srcPath, method))
+
+ # find the iso domain within the pool
+ info = self.getInfo()['info']
+ if 'isoprefix' in info.keys() and len(info['isoprefix']) > 0:
+ targetPath = info['isoprefix']
+ else:
+ self.log.error("uploadIso - target pool(%s) does not"
+ "have an ISO domain" %(self.spUUID))
+ raise se.StoragePoolNoIsoDomain()
+
+ self.log.info("uploadIso - targetPath=%s"%(targetPath))
+ rc = 0
+
+ # we can infer the method to use by inspection of srcPath
+ if len(method) == 0:
+ if srcPath.startswith("http://"):
+ method = "wget"
+ else:
+ method = "rsync"
+
+ try:
+ if method.lower() == "wget":
+ if not srcPath.startswith("http://"):
+ self.log.error("uploadIso - wget method requires HTTP URL")
+ raise se.InvalidParameterException('srcPath mismatch with'
+ ' method', method)
+
+ outFile = os.path.join(targetPath, os.path.basename(srcPath))
+ cmd = [constants.EXT_WGET, "-O", outFile, srcPath]
+ (rc, out, err) = misc.execCmd(cmd, sudo=False)
+
+ if rc:
+ self.log.error("uploadIso - error while trying to retrieve:"
+ "%s into: %s, stderr: %s" % (srcPath,
+ targetPath,
+ err))
+ raise se.VolumeCopyError(srcPath, err)
+ elif method.lower() == "rsync":
+ if srcPath.startswith("http://"):
+ self.log.error("uploadIso - rsync method cannot use"
+ "HTTP URL")
+ raise se.InvalidParameterException('srcPath mismatch with'
+ ' method', method)
+ cmd = [constants.EXT_RSYNC, "-aq", srcPath, targetPath]
+ (rc, out, err) = misc.execCmd(cmd, sudo=False)
+
+ if rc:
+ self.log.error("uploadIso - error while trying to copy:"
+ "%s into: %s, stderr: %s" % (srcPath,
+ targetPath,
+ err))
+ raise se.VolumeCopyError(srcPath, err)
+ else:
+ self.log.error("uploadIso - method '%s' not supported", method)
+ raise se.InvalidParameterException('method', method)
+
+ finally:
+ if rc == 0:
+ self.log.info("uploadIso - completed via %s", method)
+
def preDeleteRename(self, sdUUID, imgUUID):
repoPath = os.path.join(self.storage_repository, self.spUUID)
return image.Image(repoPath).preDeleteRename(sdUUID, imgUUID)
diff --git a/vdsm/storage/storage_exception.py b/vdsm/storage/storage_exception.py
index f1edad4..88ac2d5 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -508,6 +508,10 @@
code = 330
message = "Cannot get files list"
+class StoragePoolNoIsoDomain(StorageException):
+ code = 331
+ message = "No ISO Domain available in Storage Pool"
+
#################################################
# Domains Exceptions
#################################################
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index a773177..d898d0a 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -3309,6 +3309,38 @@
'size': 'int', 'method': 'UploadVolumeMethod'}}
##
+# @UploadIsoMethod:
+#
+# An enumeration of uploadIso methods.
+#
+# @wget: Fetch data using the wget command
+#
+# @rsync: Fetch data using the rsync command
+#
+# Since: 4.10.0
+##
+{'enum': 'UploadIsoMethod', 'data': ['wget', 'rsync']}
+
+##
+# @StoragePool.uploadIso:
+#
+# Upload an ISO file into a Storage Pool from a remote location.
+#
+# @spUUID: The UUID of the pool in which the ISO will be uploaded
+#
+# @srcPath: The remote location of the ISO data. Must be in a format that
+# can be understood by the command indicated in @method.
+#
+# @method: The method (command) to use to upload the data
+#
+# Since: 4.10.0
+##
+{'command': {'class': 'StoragePool', 'name': 'uploadIso'},
+ 'data': {'spUUID': 'UUID', 'srcPath': 'str',
+ 'method': 'UploadVolumeMethod'}}
+
+
+##
# @StorageDomain.validate:
#
# Check that the Storage Domain is accessible.
diff --git a/vdsm_cli/vdsClient.py b/vdsm_cli/vdsClient.py
index ff7ccc8..c1f5268 100644
--- a/vdsm_cli/vdsClient.py
+++ b/vdsm_cli/vdsClient.py
@@ -962,6 +962,17 @@
return status['status']['code'], status['status']['message']
return 0, ''
+ def uploadIso(self, args):
+ spUUID = args[0]
+ srcPath = args[1]
+ method = ''
+ if len(args) > 2:
+ method = args[2]
+ status = self.s.uploadIso(spUUID, srcPath, method)
+ if status['status']['code']:
+ return status['status']['code'], status['status']['message']
+ return 0, ''
+
def uploadVolume(self, args):
sdUUID = args[0]
spUUID = args[1]
@@ -2048,6 +2059,11 @@
'<new disk size>',
'Extend volume (SAN only)'
)),
+ 'uploadIso': (serv.uploadIso,
+ ('<spUUID> <srcPath> [<method>]',
+ 'Upload ISO file into the specified storage pool.'
+ ' <method> is one of [wget|rsync] and is optional'
+ )),
'uploadVolume': (serv.uploadVolume,
('<sdUUID> <spUUID> <imgUUID> <volUUID> <srcPath> '
'<size>',
--
To view, visit http://gerrit.ovirt.org/7849
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id78e46513c38789d08e63a38026b28bebb9a2b12
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ryan Harper <ryanh(a)us.ibm.com>
9 years, 5 months
Change in vdsm[master]: [WIP]add mem cgroup support to vdsm
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: [WIP]add mem cgroup support to vdsm
......................................................................
[WIP]add mem cgroup support to vdsm
add vdsm mem cgroup support,
New version libvirt memtune function has a bug,
tested uncompleted until I fix the bug.
Change-Id: If2ad220e21b114985ead4bd64e81133173566444
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M vdsm/API.py
M vdsm/BindingXMLRPC.py
M vdsm/define.py
M vdsm/libvirtvm.py
M vdsm_api/vdsmapi-schema.json
M vdsm_cli/vdsClient.py
6 files changed, 90 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/31/8031/1
diff --git a/vdsm/API.py b/vdsm/API.py
index 566d6e5..f5889f9 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -37,6 +37,7 @@
import storage.volume
import storage.sd
import storage.image
+import storage.storage_exception as se
from vdsm.define import doneCode, errCode, Kbytes, Mbytes
import caps
from vdsm.config import config
@@ -555,6 +556,19 @@
message = USER_SHUTDOWN_MESSAGE
return v.shutdown(delay, message)
+ def tuneMem(self, tuneParams):
+ try:
+ v = self._cif.vmContainer[self._UUID]
+ for key in tuneParams:
+ tuneParams[key] = storage.misc.validateN(
+ tuneParams[key], key)
+ except KeyError:
+ return errCode['noVM']
+ except se.InvalidParameterException:
+ return errCode['tuneMemErr']
+
+ return v.tuneMem(tuneParams)
+
def _createSysprepFloppyFromInf(self, infFileBinary, floppyImage):
try:
rc, out, err = utils.execCmd([constants.EXT_MK_SYSPREP_FLOPPY,
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index 826c125..fe7b9d5 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -265,6 +265,10 @@
vm = API.VM(vmId)
return vm.snapshot(snapDrives)
+ def vmTuneMem(self, params):
+ vm = API.VM(params.pop('vmId'))
+ return vm.tuneMem(params)
+
def vmMerge(self, vmId, mergeDrives):
vm = API.VM(vmId)
return vm.merge(mergeDrives)
@@ -765,7 +769,8 @@
(self.vmHotplugDisk, 'hotplugDisk'),
(self.vmHotunplugDisk, 'hotunplugDisk'),
(self.vmHotplugNic, 'hotplugNic'),
- (self.vmHotunplugNic, 'hotunplugNic'))
+ (self.vmHotunplugNic, 'hotunplugNic'),
+ (self.vmTuneMem, 'tuneMem'))
def getIrsMethods(self):
return ((self.domainActivate, 'activateStorageDomain'),
diff --git a/vdsm/define.py b/vdsm/define.py
index 049d36c..ba71bf6 100644
--- a/vdsm/define.py
+++ b/vdsm/define.py
@@ -117,6 +117,9 @@
'momErr': {'status':
{'code': 54,
'message': 'Failed to set mom policy'}},
+ 'tuneMemErr': {'status':
+ {'code': 56,
+ 'message': 'Failed to tune Mem'}},
'recovery': {'status':
{'code': 99,
'message':
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 4dc47e3..048fa7d 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -1887,6 +1887,22 @@
(snapFlags & libvirt.VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE
== libvirt.VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE)}
+ def tuneMem(self, tuneParams):
+ try:
+ self._dom.setMemoryParameters(tuneParams)
+ for param in tuneParams:
+ self.conf[param] = tuneParams[param]
+ self.saveState()
+ return {'status': doneCode}
+ except libvirt.libvirtError, e:
+ self.log.error("TuneMem failed:%s",
+ e.message, exc_info=True)
+ return errCode['tuneMemErr']
+ except LookupError:
+ self.log.error('TuneMem failed: unrecongnized params',
+ exc_info=True)
+ return errCode['tuneMemErr']
+
def _runMerge(self):
for mergeStatus in self.conf.get('liveMerge', []):
if mergeStatus['status'] != MERGESTATUS.NOT_STARTED:
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index c0440d2..509a90c 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -5099,6 +5099,34 @@
{'command': {'class': 'VM', 'name': 'mergeStatus'},
'returns': ['MergeStatus']}
+##
+# @TuneMemParams:
+#
+# Parameters for @VM.tuneMem.
+#
+# @hard_limit: Maximum memory the VM can consume
+#
+# @soft_limit: Memory limit during contention
+#
+# @min_gurantee: Min memory guranteed to the VM
+#
+# Since: 4.10.0
+##
+{'type': 'TuneMemParams',
+ 'data': {'hard_limit': 'uint', 'soft_limit': 'uint',
+ 'min_gurantee': 'uint'}}
+##
+# @VM.tuneMem:
+#
+# Tune memory hard limits and min allocation guranteed.
+#
+# @TuneMemParams: Tunning parameters for memory
+#
+# Since: 4.10.0
+##
+{'command': {'class': 'VM', 'name': 'tuneMem'},
+ 'data': {'tuneParams': 'TuneMemParams'}}
+
## Category: @Volume ###########################################################
##
# @Volume:
diff --git a/vdsm_cli/vdsClient.py b/vdsm_cli/vdsClient.py
index fe2f083..8787c28 100644
--- a/vdsm_cli/vdsClient.py
+++ b/vdsm_cli/vdsClient.py
@@ -204,6 +204,16 @@
return self.ExecAndExit(self.s.create(params))
+ def tuneMem(self, args):
+ params = {}
+ params['vmId'] = args[0]
+ if len(args) > 1:
+ for param in args[1:]:
+ if '=' in param:
+ key, value = line.split("=", 1)
+ params[key] = value
+ return self.ExecAndExit(self.s.tuneMem(params))
+
def hotplugNic(self, args):
nic = self._parseDriveSpec(args[1])
nic['type'] = 'interface'
@@ -1801,6 +1811,19 @@
'Optional additional parameters in dictionary format,'
' name:value,name:value'
)),
+ 'tuneMem': (serv.tuneMem,
+ ('<vmId>'
+ '[hard_limit=value soft_limit=value min_gurantee]',
+ 'Parameters list: r=required, o=optional',
+ 'r vmId: The vm to be tuned',
+ 'o hard_limit=<value>: '
+ 'maximum memory the VM can use(in KiB)',
+ 'o soft_limit=<value>:'
+ 'memory limit to enforce during memory contention',
+ 'o min_gurantee=<value>:'
+ 'min memory guranteed to the VM',
+ 'Tune memory hard limits and min allocation gurantee'
+ )),
'migrate': (serv.do_migrate,
('vmId=<id> method=<offline|online> src=<host:[port]> '
'dst=<host:[port]>',
--
To view, visit http://gerrit.ovirt.org/8031
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If2ad220e21b114985ead4bd64e81133173566444
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
9 years, 5 months