Move nova zvm virt driver to separate namespace
Currently, nova zvm virt driver is in nova namespace. This result in some troubles when generating config file, generating docs and packaging. All changes in this commit are trying to move nova zvm virt driver code into new namespace - nova_zvm . Change-Id: I5251069dfd24ff4e337e9308439415482eb2234c
This commit is contained in:
parent
cee0d80f1b
commit
2e3d781d86
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,7 +1,9 @@
|
|||||||
*.log
|
*.log
|
||||||
*.pyc
|
*.pyc
|
||||||
|
*.swp
|
||||||
.autogenerated
|
.autogenerated
|
||||||
.coverage
|
.coverage
|
||||||
|
.eggs
|
||||||
.project
|
.project
|
||||||
.pydevproject
|
.pydevproject
|
||||||
.settings
|
.settings
|
||||||
@ -16,5 +18,7 @@ cover/*
|
|||||||
covhtml
|
covhtml
|
||||||
dist/
|
dist/
|
||||||
doc/build/
|
doc/build/
|
||||||
|
doc/source/_static/
|
||||||
|
etc/*.sample
|
||||||
nova_zvm_virt_driver.egg-info/
|
nova_zvm_virt_driver.egg-info/
|
||||||
.python-version
|
.python-version
|
||||||
|
@ -3,7 +3,7 @@ test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
|||||||
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||||
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
|
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
|
||||||
${PYTHON:-python} -m subunit.run discover \
|
${PYTHON:-python} -m subunit.run discover \
|
||||||
-t ./nova/tests/unit/virt/zvm/ ./nova/tests/unit/virt/zvm \
|
-t ./nova_zvm/tests/unit/virt/zvm/ ./nova_zvm/tests/unit/virt/zvm \
|
||||||
$LISTOPT $IDOPTION
|
$LISTOPT $IDOPTION
|
||||||
test_id_option=--load-list $IDFILE
|
test_id_option=--load-list $IDFILE
|
||||||
test_list_option=--list
|
test_list_option=--list
|
||||||
|
18
nova/__init__.py
Normal file
18
nova/__init__.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Copyright 2017 IBM Corp.
|
||||||
|
#
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
# Required to play nicely with namespace composition (PEP420).
|
||||||
|
__import__('pkg_resources').declare_namespace(__name__)
|
18
nova/virt/__init__.py
Normal file
18
nova/virt/__init__.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Copyright 2017 IBM Corp.
|
||||||
|
#
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
# Required to play nicely with namespace composition (PEP420).
|
||||||
|
__import__('pkg_resources').declare_namespace(__name__)
|
@ -1,29 +0,0 @@
|
|||||||
# Copyright 2013 IBM Corp.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
"""A connection to an IBM z/VM Virtualization system.
|
|
||||||
|
|
||||||
Generally, OpenStack z/VM virt driver will call xCat REST API to operate
|
|
||||||
to z/VM hypervisors.xCat has a control point(a virtual machine) in z/VM
|
|
||||||
system, which enables xCat management node to control the z/VM system.
|
|
||||||
OpenStack z/VM driver will communicate with xCat management node through
|
|
||||||
xCat REST API. Thus OpenStack can operate to z/VM system indirectly.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from nova.virt.zvm import driver
|
|
||||||
|
|
||||||
|
|
||||||
ZVMDriver = driver.ZVMDriver
|
|
File diff suppressed because it is too large
Load Diff
0
nova_zvm/tests/__init__.py
Normal file
0
nova_zvm/tests/__init__.py
Normal file
0
nova_zvm/tests/unit/__init__.py
Normal file
0
nova_zvm/tests/unit/__init__.py
Normal file
0
nova_zvm/tests/unit/virt/zvm/__init__.py
Normal file
0
nova_zvm/tests/unit/virt/zvm/__init__.py
Normal file
@ -21,11 +21,6 @@ import time
|
|||||||
|
|
||||||
import mock
|
import mock
|
||||||
from mox3 import mox
|
from mox3 import mox
|
||||||
from oslo_concurrency import processutils
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_serialization import jsonutils
|
|
||||||
from oslo_utils import fileutils
|
|
||||||
|
|
||||||
from nova.compute import power_state
|
from nova.compute import power_state
|
||||||
from nova.compute import vm_states
|
from nova.compute import vm_states
|
||||||
from nova import context
|
from nova import context
|
||||||
@ -38,15 +33,20 @@ from nova.tests.unit import fake_instance
|
|||||||
from nova.virt import configdrive as virt_configdrive
|
from nova.virt import configdrive as virt_configdrive
|
||||||
from nova.virt import fake
|
from nova.virt import fake
|
||||||
from nova.virt import hardware
|
from nova.virt import hardware
|
||||||
from nova.virt.zvm import configdrive
|
from oslo_concurrency import processutils
|
||||||
from nova.virt.zvm import dist
|
from oslo_config import cfg
|
||||||
from nova.virt.zvm import driver
|
from oslo_serialization import jsonutils
|
||||||
from nova.virt.zvm import exception
|
from oslo_utils import fileutils
|
||||||
from nova.virt.zvm import imageop
|
|
||||||
from nova.virt.zvm import instance
|
from nova_zvm.virt.zvm import configdrive
|
||||||
from nova.virt.zvm import networkop
|
from nova_zvm.virt.zvm import dist
|
||||||
from nova.virt.zvm import utils as zvmutils
|
from nova_zvm.virt.zvm import driver
|
||||||
from nova.virt.zvm import volumeop
|
from nova_zvm.virt.zvm import exception
|
||||||
|
from nova_zvm.virt.zvm import imageop
|
||||||
|
from nova_zvm.virt.zvm import instance
|
||||||
|
from nova_zvm.virt.zvm import networkop
|
||||||
|
from nova_zvm.virt.zvm import utils as zvmutils
|
||||||
|
from nova_zvm.virt.zvm import volumeop
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
@ -250,7 +250,7 @@ class ZVMDriverTestCases(ZVMTestCase):
|
|||||||
self._old_inst[k] = ''
|
self._old_inst[k] = ''
|
||||||
|
|
||||||
@mock.patch.object(driver.ZVMDriver, 'update_host_status')
|
@mock.patch.object(driver.ZVMDriver, 'update_host_status')
|
||||||
@mock.patch('nova.virt.zvm.driver.ZVMDriver._get_xcat_version')
|
@mock.patch('nova_zvm.virt.zvm.driver.ZVMDriver._get_xcat_version')
|
||||||
def setUp(self, mock_version, mock_update):
|
def setUp(self, mock_version, mock_update):
|
||||||
super(ZVMDriverTestCases, self).setUp()
|
super(ZVMDriverTestCases, self).setUp()
|
||||||
self._setup_fake_inst_obj()
|
self._setup_fake_inst_obj()
|
||||||
@ -348,7 +348,7 @@ class ZVMDriverTestCases(ZVMTestCase):
|
|||||||
# return {"data": [{"node": [{"name": ["os000001"], "data": [stat]}]}]}
|
# return {"data": [{"node": [{"name": ["os000001"], "data": [stat]}]}]}
|
||||||
return self._set_reachable(stat)
|
return self._set_reachable(stat)
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance.get_info')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance.get_info')
|
||||||
def test_get_info(self, mk_get_info):
|
def test_get_info(self, mk_get_info):
|
||||||
_fake_inst_obj = hardware.InstanceInfo(state=0x01, mem_kb=131072,
|
_fake_inst_obj = hardware.InstanceInfo(state=0x01, mem_kb=131072,
|
||||||
num_cpu=4, cpu_time_ns=330528353,
|
num_cpu=4, cpu_time_ns=330528353,
|
||||||
@ -362,9 +362,10 @@ class ZVMDriverTestCases(ZVMTestCase):
|
|||||||
self.assertEqual(330528353, inst_info.cpu_time_ns)
|
self.assertEqual(330528353, inst_info.cpu_time_ns)
|
||||||
self.assertEqual(1048576, inst_info.max_mem_kb)
|
self.assertEqual(1048576, inst_info.max_mem_kb)
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.exception.ZVMXCATRequestFailed.format_message')
|
@mock.patch('nova_zvm.virt.zvm.exception.ZVMXCATRequestFailed.'
|
||||||
@mock.patch('nova.virt.zvm.exception.ZVMXCATRequestFailed.msg_fmt')
|
'format_message')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance.get_info')
|
@mock.patch('nova_zvm.virt.zvm.exception.ZVMXCATRequestFailed.msg_fmt')
|
||||||
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance.get_info')
|
||||||
def test_get_info_not_exist(self, mk_get_info, mk_msg_fmt, mk_fm):
|
def test_get_info_not_exist(self, mk_get_info, mk_msg_fmt, mk_fm):
|
||||||
mk_get_info.side_effect = exception.ZVMXCATRequestFailed
|
mk_get_info.side_effect = exception.ZVMXCATRequestFailed
|
||||||
_emsg = "Forbidden Invalid nodes and/or groups"
|
_emsg = "Forbidden Invalid nodes and/or groups"
|
||||||
@ -374,8 +375,8 @@ class ZVMDriverTestCases(ZVMTestCase):
|
|||||||
self.assertRaises(nova_exception.InstanceNotFound,
|
self.assertRaises(nova_exception.InstanceNotFound,
|
||||||
self.driver.get_info, self.instance)
|
self.driver.get_info, self.instance)
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.exception.ZVMXCATRequestFailed.msg_fmt')
|
@mock.patch('nova_zvm.virt.zvm.exception.ZVMXCATRequestFailed.msg_fmt')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance.get_info')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance.get_info')
|
||||||
def test_get_info_other_err(self, mk_get_info, mk_msg_fmt):
|
def test_get_info_other_err(self, mk_get_info, mk_msg_fmt):
|
||||||
mk_get_info.side_effect = exception.ZVMXCATRequestFailed
|
mk_get_info.side_effect = exception.ZVMXCATRequestFailed
|
||||||
mk_msg_fmt.return_value = "Other error"
|
mk_msg_fmt.return_value = "Other error"
|
||||||
@ -898,20 +899,20 @@ class ZVMDriverTestCases(ZVMTestCase):
|
|||||||
self.driver.reboot,
|
self.driver.reboot,
|
||||||
self.context, self.instance, {}, "SOFT")
|
self.context, self.instance, {}, "SOFT")
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance.power_off')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance.power_off')
|
||||||
def test_power_off(self, poff):
|
def test_power_off(self, poff):
|
||||||
self.driver.power_off(self.instance, 60, 10)
|
self.driver.power_off(self.instance, 60, 10)
|
||||||
poff.assert_called_once_with(60, 10)
|
poff.assert_called_once_with(60, 10)
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._power_state')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._power_state')
|
||||||
def test_power_off_inactive(self, pst):
|
def test_power_off_inactive(self, pst):
|
||||||
pst.side_effect = exception.ZVMXCATInternalError(
|
pst.side_effect = exception.ZVMXCATInternalError(
|
||||||
"Return Code: 200 Reason Code: 12")
|
"Return Code: 200 Reason Code: 12")
|
||||||
self.driver.power_off(self.instance, 60, 10)
|
self.driver.power_off(self.instance, 60, 10)
|
||||||
pst.assert_called_once_with("PUT", "softoff")
|
pst.assert_called_once_with("PUT", "softoff")
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._check_power_stat')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._check_power_stat')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._power_state')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._power_state')
|
||||||
def test_power_off_retry(self, pst, get_pst):
|
def test_power_off_retry(self, pst, get_pst):
|
||||||
get_pst.side_effect = [0x00, 0x04]
|
get_pst.side_effect = [0x00, 0x04]
|
||||||
self.driver.power_off(self.instance, 60, 10)
|
self.driver.power_off(self.instance, 60, 10)
|
||||||
@ -1934,15 +1935,15 @@ class ZVMInstanceTestCases(ZVMTestCase):
|
|||||||
self._set_fake_xcat_responses([self._generate_xcat_resp(info)])
|
self._set_fake_xcat_responses([self._generate_xcat_resp(info)])
|
||||||
self._instance.update_node_info(image_meta)
|
self._instance.update_node_info(image_meta)
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.utils.xcat_request')
|
@mock.patch('nova_zvm.virt.zvm.utils.xcat_request')
|
||||||
@mock.patch('nova.virt.zvm.utils.get_host')
|
@mock.patch('nova_zvm.virt.zvm.utils.get_host')
|
||||||
def test_deploy_node(self, get_host, xcat_req):
|
def test_deploy_node(self, get_host, xcat_req):
|
||||||
get_host.return_value = 'fake@fakehost'
|
get_host.return_value = 'fake@fakehost'
|
||||||
xcat_req.return_value = 'fake'
|
xcat_req.return_value = 'fake'
|
||||||
self._instance.deploy_node('fakeimg', '/fake/file', '0100')
|
self._instance.deploy_node('fakeimg', '/fake/file', '0100')
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.utils.xcat_request')
|
@mock.patch('nova_zvm.virt.zvm.utils.xcat_request')
|
||||||
@mock.patch('nova.virt.zvm.utils.get_host')
|
@mock.patch('nova_zvm.virt.zvm.utils.get_host')
|
||||||
def test_deploy_node_failed(self, get_host, xcat_req):
|
def test_deploy_node_failed(self, get_host, xcat_req):
|
||||||
get_host.return_value = 'fake@fakehost'
|
get_host.return_value = 'fake@fakehost'
|
||||||
xcat_req.side_effect = exception.ZVMXCATDeployNodeFailed(node="fake",
|
xcat_req.side_effect = exception.ZVMXCATDeployNodeFailed(node="fake",
|
||||||
@ -1950,8 +1951,8 @@ class ZVMInstanceTestCases(ZVMTestCase):
|
|||||||
self.assertRaises(exception.ZVMXCATDeployNodeFailed,
|
self.assertRaises(exception.ZVMXCATDeployNodeFailed,
|
||||||
self._instance.deploy_node, 'fakeimg', '/fake/file')
|
self._instance.deploy_node, 'fakeimg', '/fake/file')
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance.unlock_userid')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance.unlock_userid')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._delete_userid')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._delete_userid')
|
||||||
def test_delete_userid_is_locked(self, delete_uid, unlock_uid):
|
def test_delete_userid_is_locked(self, delete_uid, unlock_uid):
|
||||||
delete_uid.side_effect = [exception.ZVMXCATInternalError(
|
delete_uid.side_effect = [exception.ZVMXCATInternalError(
|
||||||
'Return Code: 400\nReason Code: 12\n'),
|
'Return Code: 400\nReason Code: 12\n'),
|
||||||
@ -1960,8 +1961,8 @@ class ZVMInstanceTestCases(ZVMTestCase):
|
|||||||
delete_uid.assert_called()
|
delete_uid.assert_called()
|
||||||
unlock_uid.assert_called_once_with('fakehcp')
|
unlock_uid.assert_called_once_with('fakehcp')
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance.unlock_devices')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance.unlock_devices')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._delete_userid')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._delete_userid')
|
||||||
def test_delete_userid_device_is_locked(self, delete_uid, unlock_dev):
|
def test_delete_userid_device_is_locked(self, delete_uid, unlock_dev):
|
||||||
delete_uid.side_effect = [exception.ZVMXCATInternalError(
|
delete_uid.side_effect = [exception.ZVMXCATInternalError(
|
||||||
'Return Code: 408\nReason Code: 12\n'),
|
'Return Code: 408\nReason Code: 12\n'),
|
||||||
@ -1974,9 +1975,9 @@ class ZVMInstanceTestCases(ZVMTestCase):
|
|||||||
mem = self._instance._modify_storage_format('0')
|
mem = self._instance._modify_storage_format('0')
|
||||||
self.assertEqual(0, mem)
|
self.assertEqual(0, mem)
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._get_rinv_info')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._get_rinv_info')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance.is_reachable')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance.is_reachable')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._check_power_stat')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._check_power_stat')
|
||||||
def test_get_info_cpumem(self, mk_get_ps, mk_is_reach,
|
def test_get_info_cpumem(self, mk_get_ps, mk_is_reach,
|
||||||
mk_get_rinv_info):
|
mk_get_rinv_info):
|
||||||
mk_get_ps.return_value = power_state.RUNNING
|
mk_get_ps.return_value = power_state.RUNNING
|
||||||
@ -1993,7 +1994,7 @@ class ZVMInstanceTestCases(ZVMTestCase):
|
|||||||
self.assertEqual(330528353, inst_info.cpu_time_ns)
|
self.assertEqual(330528353, inst_info.cpu_time_ns)
|
||||||
self.assertEqual(1048576, inst_info.max_mem_kb)
|
self.assertEqual(1048576, inst_info.max_mem_kb)
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._get_rinv_info')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._get_rinv_info')
|
||||||
def test_get_info_cpumempowerstat(self, mk_get_rinv_info):
|
def test_get_info_cpumempowerstat(self, mk_get_rinv_info):
|
||||||
mk_get_rinv_info.return_value = self._fake_inst_info_list_cpumempower
|
mk_get_rinv_info.return_value = self._fake_inst_info_list_cpumempower
|
||||||
|
|
||||||
@ -2007,10 +2008,10 @@ class ZVMInstanceTestCases(ZVMTestCase):
|
|||||||
self.assertEqual(3305.3, inst_info.cpu_time_ns)
|
self.assertEqual(3305.3, inst_info.cpu_time_ns)
|
||||||
self.assertEqual(1048576, inst_info.max_mem_kb)
|
self.assertEqual(1048576, inst_info.max_mem_kb)
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.exception.ZVMXCATInternalError.msg_fmt')
|
@mock.patch('nova_zvm.virt.zvm.exception.ZVMXCATInternalError.msg_fmt')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._get_rinv_info')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._get_rinv_info')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance.is_reachable')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance.is_reachable')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._check_power_stat')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._check_power_stat')
|
||||||
def test_get_info_inv_err(self, mk_get_ps, mk_is_reach, mk_get_rinv_info,
|
def test_get_info_inv_err(self, mk_get_ps, mk_is_reach, mk_get_rinv_info,
|
||||||
mk_msg_fmt):
|
mk_msg_fmt):
|
||||||
mk_get_ps.return_value = power_state.RUNNING
|
mk_get_ps.return_value = power_state.RUNNING
|
||||||
@ -2023,12 +2024,12 @@ class ZVMInstanceTestCases(ZVMTestCase):
|
|||||||
self.assertRaises(nova_exception.InstanceNotFound,
|
self.assertRaises(nova_exception.InstanceNotFound,
|
||||||
self._instance.get_info)
|
self._instance.get_info)
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.exception.ZVMInvalidXCATResponseDataError.'
|
@mock.patch('nova_zvm.virt.zvm.exception.ZVMInvalidXCATResponseDataError.'
|
||||||
'msg_fmt')
|
'msg_fmt')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._get_current_memory')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._get_current_memory')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._get_rinv_info')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._get_rinv_info')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance.is_reachable')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance.is_reachable')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._check_power_stat')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._check_power_stat')
|
||||||
def test_get_info_invalid_data(self, mk_get_ps, mk_is_reach,
|
def test_get_info_invalid_data(self, mk_get_ps, mk_is_reach,
|
||||||
mk_get_rinv_info, mk_get_mem, mk_msg_fmt):
|
mk_get_rinv_info, mk_get_mem, mk_msg_fmt):
|
||||||
mk_get_ps.return_value = power_state.RUNNING
|
mk_get_ps.return_value = power_state.RUNNING
|
||||||
@ -2047,9 +2048,9 @@ class ZVMInstanceTestCases(ZVMTestCase):
|
|||||||
self.assertEqual(0, inst_info.cpu_time_ns)
|
self.assertEqual(0, inst_info.cpu_time_ns)
|
||||||
self.assertEqual(1048576, inst_info.max_mem_kb)
|
self.assertEqual(1048576, inst_info.max_mem_kb)
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._get_rinv_info')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._get_rinv_info')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance.is_reachable')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance.is_reachable')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._check_power_stat')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._check_power_stat')
|
||||||
def test_get_info_down(self, mk_get_ps, mk_is_reach, mk_get_rinv_info):
|
def test_get_info_down(self, mk_get_ps, mk_is_reach, mk_get_rinv_info):
|
||||||
mk_get_ps.return_value = power_state.SHUTDOWN
|
mk_get_ps.return_value = power_state.SHUTDOWN
|
||||||
mk_is_reach.return_value = False
|
mk_is_reach.return_value = False
|
||||||
@ -2065,8 +2066,8 @@ class ZVMInstanceTestCases(ZVMTestCase):
|
|||||||
self.assertEqual(0, inst_info.cpu_time_ns)
|
self.assertEqual(0, inst_info.cpu_time_ns)
|
||||||
self.assertEqual(1048576, inst_info.max_mem_kb)
|
self.assertEqual(1048576, inst_info.max_mem_kb)
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance.is_reachable')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance.is_reachable')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance._check_power_stat')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance._check_power_stat')
|
||||||
def test_get_info_paused(self, mk_get_ps, mk_is_reach):
|
def test_get_info_paused(self, mk_get_ps, mk_is_reach):
|
||||||
mk_get_ps.return_value = power_state.RUNNING
|
mk_get_ps.return_value = power_state.RUNNING
|
||||||
mk_is_reach.return_value = False
|
mk_is_reach.return_value = False
|
||||||
@ -2085,8 +2086,8 @@ class ZVMInstanceTestCases(ZVMTestCase):
|
|||||||
self.assertEqual(0, inst_info.cpu_time_ns)
|
self.assertEqual(0, inst_info.cpu_time_ns)
|
||||||
self.assertEqual(1048576, inst_info.max_mem_kb)
|
self.assertEqual(1048576, inst_info.max_mem_kb)
|
||||||
|
|
||||||
@mock.patch('nova.virt.zvm.utils.xdsh')
|
@mock.patch('nova_zvm.virt.zvm.utils.xdsh')
|
||||||
@mock.patch('nova.virt.zvm.instance.ZVMInstance.get_userid')
|
@mock.patch('nova_zvm.virt.zvm.instance.ZVMInstance.get_userid')
|
||||||
def test_unlock_devices(self, get_uid, xdsh):
|
def test_unlock_devices(self, get_uid, xdsh):
|
||||||
get_uid.return_value = 'fakeuid'
|
get_uid.return_value = 'fakeuid'
|
||||||
xdshv1 = {'data': [['Locked type: DEVICE\nDevice address: 0100\n'
|
xdshv1 = {'data': [['Locked type: DEVICE\nDevice address: 0100\n'
|
0
nova_zvm/virt/__init__.py
Normal file
0
nova_zvm/virt/__init__.py
Normal file
29
nova_zvm/virt/zvm/__init__.py
Normal file
29
nova_zvm/virt/zvm/__init__.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Copyright 2013 IBM Corp.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
"""A connection to an IBM z/VM Virtualization system.
|
||||||
|
|
||||||
|
Generally, OpenStack z/VM virt driver will call xCat REST API to operate
|
||||||
|
to z/VM hypervisors.xCat has a control point(a virtual machine) in z/VM
|
||||||
|
system, which enables xCat management node to control the z/VM system.
|
||||||
|
OpenStack z/VM driver will communicate with xCat management node through
|
||||||
|
xCat REST API. Thus OpenStack can operate to z/VM system indirectly.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from nova_zvm.virt.zvm import driver
|
||||||
|
|
||||||
|
|
||||||
|
ZVMDriver = driver.ZVMDriver
|
@ -15,13 +15,13 @@
|
|||||||
import os
|
import os
|
||||||
import tarfile
|
import tarfile
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as logging
|
|
||||||
|
|
||||||
from nova import exception
|
from nova import exception
|
||||||
from nova import utils
|
from nova import utils
|
||||||
from nova.virt import configdrive
|
from nova.virt import configdrive
|
||||||
from nova.virt.zvm import utils as zvmutils
|
from oslo_config import cfg
|
||||||
|
from oslo_log import log as logging
|
||||||
|
|
||||||
|
from nova_zvm.virt.zvm import utils as zvmutils
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
@ -14,12 +14,12 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
|
from nova.i18n import _
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from nova.i18n import _
|
from nova_zvm.virt.zvm import exception
|
||||||
from nova.virt.zvm import exception
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
|
2045
nova_zvm/virt/zvm/driver.py
Normal file
2045
nova_zvm/virt/zvm/driver.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -20,18 +20,18 @@ import shutil
|
|||||||
import tarfile
|
import tarfile
|
||||||
import xml.dom.minidom as Dom
|
import xml.dom.minidom as Dom
|
||||||
|
|
||||||
from oslo_concurrency import processutils
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as logging
|
|
||||||
from oslo_utils import excutils
|
|
||||||
|
|
||||||
from nova import exception as nova_exception
|
from nova import exception as nova_exception
|
||||||
from nova.i18n import _, _LW
|
from nova.i18n import _, _LW
|
||||||
from nova.image import glance
|
from nova.image import glance
|
||||||
from nova import utils
|
from nova import utils
|
||||||
from nova.virt import images
|
from nova.virt import images
|
||||||
from nova.virt.zvm import exception
|
from oslo_concurrency import processutils
|
||||||
from nova.virt.zvm import utils as zvmutils
|
from oslo_config import cfg
|
||||||
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import excutils
|
||||||
|
|
||||||
|
from nova_zvm.virt.zvm import exception
|
||||||
|
from nova_zvm.virt.zvm import utils as zvmutils
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
@ -17,18 +17,18 @@ import binascii
|
|||||||
import six
|
import six
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as logging
|
|
||||||
|
|
||||||
from nova.compute import power_state
|
from nova.compute import power_state
|
||||||
from nova import exception as nova_exception
|
from nova import exception as nova_exception
|
||||||
from nova.i18n import _, _LW
|
from nova.i18n import _, _LW
|
||||||
from nova.virt import hardware
|
from nova.virt import hardware
|
||||||
from nova.virt.zvm import const
|
from oslo_config import cfg
|
||||||
from nova.virt.zvm import dist
|
from oslo_log import log as logging
|
||||||
from nova.virt.zvm import exception
|
|
||||||
from nova.virt.zvm import utils as zvmutils
|
from nova_zvm.virt.zvm import const
|
||||||
from nova.virt.zvm import volumeop
|
from nova_zvm.virt.zvm import dist
|
||||||
|
from nova_zvm.virt.zvm import exception
|
||||||
|
from nova_zvm.virt.zvm import utils as zvmutils
|
||||||
|
from nova_zvm.virt.zvm import volumeop
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from nova.virt.zvm import exception
|
from nova_zvm.virt.zvm import exception
|
||||||
from nova.virt.zvm import utils as zvmutils
|
from nova_zvm.virt.zvm import utils as zvmutils
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
@ -12,9 +12,10 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
import nova.virt.zvm.driver
|
from nova_zvm.virt.zvm import conf as zvm_conf
|
||||||
|
|
||||||
|
|
||||||
def list_opts():
|
def list_opts():
|
||||||
@ -23,8 +24,8 @@ def list_opts():
|
|||||||
# we keep this into DEFAULT.
|
# we keep this into DEFAULT.
|
||||||
('DEFAULT',
|
('DEFAULT',
|
||||||
itertools.chain(
|
itertools.chain(
|
||||||
nova.virt.zvm.conf.zvm_image_opts,
|
zvm_conf.zvm_image_opts,
|
||||||
nova.virt.zvm.conf.zvm_opts,
|
zvm_conf.zvm_opts,
|
||||||
nova.virt.zvm.conf.zvm_user_opts,
|
zvm_conf.zvm_user_opts,
|
||||||
)),
|
)),
|
||||||
]
|
]
|
@ -23,19 +23,19 @@ import socket
|
|||||||
import ssl
|
import ssl
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as logging
|
|
||||||
from oslo_serialization import jsonutils
|
|
||||||
from oslo_utils import excutils
|
|
||||||
|
|
||||||
from nova import block_device
|
from nova import block_device
|
||||||
from nova.compute import power_state
|
from nova.compute import power_state
|
||||||
from nova import exception as nova_exception
|
from nova import exception as nova_exception
|
||||||
from nova.i18n import _, _LE, _LI, _LW
|
from nova.i18n import _, _LE, _LI, _LW
|
||||||
from nova.virt import driver
|
from nova.virt import driver
|
||||||
from nova.virt.zvm import const
|
from oslo_config import cfg
|
||||||
from nova.virt.zvm import dist
|
from oslo_log import log as logging
|
||||||
from nova.virt.zvm import exception
|
from oslo_serialization import jsonutils
|
||||||
|
from oslo_utils import excutils
|
||||||
|
|
||||||
|
from nova_zvm.virt.zvm import const
|
||||||
|
from nova_zvm.virt.zvm import dist
|
||||||
|
from nova_zvm.virt.zvm import exception
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
@ -17,21 +17,20 @@ import re
|
|||||||
import six
|
import six
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import nova.context
|
||||||
|
from nova.i18n import _, _LW
|
||||||
|
from nova.objects import block_device as block_device_obj
|
||||||
|
from nova.objects import instance as instance_obj
|
||||||
|
from nova.volume import cinder
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
|
|
||||||
import nova.context
|
from nova_zvm.virt.zvm import const
|
||||||
from nova.i18n import _, _LW
|
from nova_zvm.virt.zvm import dist
|
||||||
from nova.objects import block_device as block_device_obj
|
from nova_zvm.virt.zvm import exception
|
||||||
from nova.objects import instance as instance_obj
|
from nova_zvm.virt.zvm import utils as zvmutils
|
||||||
from nova.virt.zvm import const
|
|
||||||
from nova.virt.zvm import dist
|
|
||||||
from nova.virt.zvm import exception
|
|
||||||
from nova.virt.zvm import utils as zvmutils
|
|
||||||
from nova.volume import cinder
|
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
@ -18,6 +18,7 @@ classifier =
|
|||||||
|
|
||||||
[files]
|
[files]
|
||||||
packages =
|
packages =
|
||||||
|
nova_zvm
|
||||||
nova/virt/zvm
|
nova/virt/zvm
|
||||||
|
|
||||||
[build_sphinx]
|
[build_sphinx]
|
||||||
@ -44,4 +45,4 @@ output_file = nova_zvm/locale/nova-zvm.pot
|
|||||||
|
|
||||||
[entry_points]
|
[entry_points]
|
||||||
oslo.config.opts =
|
oslo.config.opts =
|
||||||
nova_zvm = nova.virt.zvm.opts:list_opts
|
nova_zvm = nova_zvm.virt.zvm.opts:list_opts
|
||||||
|
17
tox.ini
17
tox.ini
@ -14,15 +14,13 @@ deps = -r{toxinidir}/requirements.txt
|
|||||||
commands = python setup.py testr --slowest --testr-args='{posargs}'
|
commands = python setup.py testr --slowest --testr-args='{posargs}'
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
commands = flake8
|
commands = flake8 {posargs}
|
||||||
|
|
||||||
[testenv:py27]
|
[testenv:py27]
|
||||||
commands = /bin/cp -r {toxinidir}/nova/virt/zvm {toxinidir}/.tox/py27/src/nova/nova/virt/
|
commands = python setup.py testr --slowest --testr-args='{posargs}'
|
||||||
python setup.py testr --slowest --testr-args='{posargs}'
|
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = /bin/cp -r {toxinidir}/nova/virt/zvm {toxinidir}/.tox/venv/src/nova/nova/virt/
|
commands = {posargs}
|
||||||
{posargs}
|
|
||||||
|
|
||||||
[testenv:cover]
|
[testenv:cover]
|
||||||
commands = python setup.py testr --coverage --testr-args='{posargs}'
|
commands = python setup.py testr --coverage --testr-args='{posargs}'
|
||||||
@ -44,11 +42,8 @@ deps = bandit
|
|||||||
commands = bandit -r nova/virt/zvm -n 5 -ll
|
commands = bandit -r nova/virt/zvm -n 5 -ll
|
||||||
|
|
||||||
[testenv:genconfig]
|
[testenv:genconfig]
|
||||||
commands =
|
commands = oslo-config-generator --config-file=etc/nova/nova-zvm-oslo-conf-generator.conf
|
||||||
/bin/cp -r {toxinidir}/nova/virt/zvm/ {toxinidir}/.tox/genconfig/src/nova/nova/virt/
|
|
||||||
oslo-config-generator --config-file=etc/nova/nova-zvm-oslo-conf-generator.conf
|
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
commands =
|
commands = python setup.py build_sphinx
|
||||||
/bin/cp -r {toxinidir}/nova/virt/zvm/ {toxinidir}/.tox/docs/src/nova/nova/virt/
|
|
||||||
python setup.py build_sphinx
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user