Commit Graph

86 Commits

Author SHA1 Message Date
jacky06 e8f3525cd3 Update hacking version
Use latest release 1.1.0 and compatible changes w.r.t pep8

Change-Id: I682333b289738848694636ca994dba005e9690cf
2019-03-20 23:47:40 +08:00
Zuul 5e6c2740ec Merge "Replace file() with open() for Python 3 compatibility" 2018-07-23 09:09:39 +00:00
naichuans 8e3b52feac os-xenapi: add utility to setup guest VM logs
Add code to copy guest logs to /var/logs/xen/guest and set rotation

Change-Id: Ied7dadad2c3b7b6e9a05cf49d1ad16eac5cf9204
2018-07-16 09:47:06 +00:00
Vu Cong Tuan 0101e2e932 Replace file() with open() for Python 3 compatibility
The built-in named 'file' has been removed since Python 3.0 [1]
This patch replaces it by 'open' which is the same under Python 2 and 3.

[1] https://docs.python.org/release/3.0/whatsnew/3.0.html#builtins

Change-Id: Id39efad099358a76743693cc6e32bddca57e8e45
2018-07-05 10:44:00 +07:00
Zuul e071ac72b2 Merge "VDI-Streaming: support customizing compress level" 2018-04-18 07:56:13 +00:00
Jianghua Wang 13bda2280f VDI-Streaming: support customizing compress level
As uploading image, it will compress the vdh file and generate the
gzipped tar file. This commit will change it to use default compress
level as 6; and also allow the API's user to specify a customizing
compress level basing on demand.

Change-Id: If343326d7a501b25662fecb0b57d7637acabe250
2018-04-18 03:20:07 +00:00
Jianghua Wang 6953134a13 Avoid using the module of future in xapi plugin
In XenServer's dom0 (e.g. XS7.0/7.1), the module of future is
not available. So this commit is to avoid using *future*. Instead
it import check_output from different modules basing if *future*
module is available of not.

Change-Id: Ib75b2b7965e63033ea933f7cb4a4a54a2f48ef75
Partial-Bug: #1762130
2018-04-08 09:21:55 +00:00
Jianghua Wang 3e3b38e74a VDI-streaming: support non-default SR
If the SR is not the default one, the nova option of "sr_matching_filter"
can be used to get proper SR. In order to support it with VDI streaming,
we should add a new parameter - sr_ref which will be passed down by
nova code.

Change-Id: I624ee58f9c630f1712e066f3523ee6db45775e5c
2018-03-29 13:10:44 +00:00
Jianghua Wang 4e26270ea8 Fix random failures in test_glance
We had some change in source code (glance.py) to make os-xenapi
be compitable with both py2 and py3. But the modules in the UT
have not been changed accordingly. So some mocks on module's
method don't take effective.
This commit is to fix the failures in test_glance.

Change-Id: I42cbe4f5dc5cec5d28394b9502196ff9c9bb8761
Closes-Bug: 1757928
2018-03-22 04:01:44 +00:00
Zuul 5696d0bd00 Merge "Fix for py3 compat" 2018-02-27 21:38:58 +00:00
Jianghua Wang 2c0eb79cd7 Use module name (__name__) for getLogger()
We usually use a period-separated hierarchical module name as
the logger's name. But we have three scripts are using a hardcoded
name. This commit is to change them to use __name__ to make them
consistent with others. By using the period-separated hierarchical
module name, it's easier to know which module generated the log
lines so it's also easier to get the file name.

Change-Id: I373ce9b44caf2b9baffb753e6db7ad8789219f4b
2018-02-22 07:46:03 +00:00
Thomas Goirand 3599f53516 Fix for py3 compat
Fixes os_xenapi/dom0/etc/xapi.d/plugins/*.py wrt Python 3 compatibility,
also remove some tests in os_xenapi/tests/plugins/test_glance.py that
are too Py2 centric.

Change-Id: Iab721f6a47dc023f01670076ef7d1de107a913ae
2018-02-21 08:54:22 +01:00
Jianghua Wang 15f56c9f9c Kolla: Include bridge name for host's ipv4s.
Sometime we need to know if a domu's interface is conneted
to a same bridge (network) as dom0's interface. This commit
is to add bridge name for each ipv4 entry in the xenapi facts.

Change-Id: I8a6e1507cfa2c935b18e2fed04abaa06df9b0e51
2018-01-26 10:23:15 +00:00
naichuans ad90523b23 os-xenapi: Fix bugs related with sshclient modifications
SSHClient.ssh will return three values instead of two, modify
related codes to avoid error.

Change-Id: Idbee3d277e1a89aba683ce2dd38649ffa29c55df
2018-01-26 10:12:34 +00:00
naichuans 5ae81fe3fb os-xenapi: Add setting function to support logging
Add function to support logging

Change-Id: I7b77089b38219467a983c78548787d6dfdafade4
2018-01-24 03:00:59 +00:00
Jianghua Wang b1bf53ccd6 XenAPI-Kolla: Gather domU's vifs in facts
This commit is to gather domU's vifs in facts. So that the compute
VM's interfaces' vif information will be included in the xenapi_facts.
When deploy OpenStack on XenServers, the vif information can be used
by deployment scripts (e.g. in Kolla-ansible, it can use the vif's
bridge to support provider networks by setting the bridge mappings).

Change-Id: I9a6bebe19ed488bb2173d5dc2daa14e236411243
2018-01-23 13:30:42 +00:00
Zuul 638faee5fe Merge "os-xenapi: refine ssh client to return error code" 2018-01-22 05:19:23 +00:00
Zuul 374a37662b Merge "os-xenapi: Add utility to enable conntrack service" 2018-01-22 05:14:03 +00:00
naichuans 4f14c344f6 os-xenapi: refine ssh client to return error code
Refine ssh client code to return error code instead of exception

Change-Id: I008a7878440fad07bac9696d2006f276e6d0f5f1
2018-01-22 03:16:50 +00:00
naichuans 02e19615ac os-xenapi: Add utility to enable conntrack service
Add utility to enable conntrack service

Change-Id: I8cd77832ed90c1b7c951d36402b52d9a3e9f9d98
2018-01-22 03:14:42 +00:00
Zuul 9bbdd8edeb Merge "Fix compatibility issue when using netifaces" 2018-01-19 10:55:54 +00:00
Jianghua Wang fd35c7dc3e Fix compatibility issue when using netifaces
Force using unicode before pass the string to ipaddress.IPv4Interface().

Change-Id: Idebb198ad2751a77e7399a3809a3951f6c899dee
Closes-Bug: #1743673
2018-01-19 09:14:34 +00:00
naichuans a925260450 os-xenapi: enable linux bridge on dom0
Add script to remove linux bridge black list to  enable linux
bridge on dom0

Change-Id: I831a9eb4703abd2001f0861ecf7db92d31f60aad
2018-01-17 06:58:11 +00:00
Jianghua Wang f88521682e Introduce command: xenapi_bootstrap for kolla deployment.
This commit introduces a command which can be invoked by kolla
playbook to bootstrap XenAPI - xenapi_bootstrap. This command
will invoke some modules's functions to do needed boostrap
tasks. At the moment it includes:
* configure himn
* configure iptalbes to allow traffic
* install xapi plugins to dom0
* gather XenAPI facts and save them into a file
  The facts file will used others e.g. kolla deployment can
  get facts from it and populate relative configures basing
  on the facts.

Change-Id: Ie2d7d40f2755580aac4a10f3d302190a8bd4fe6f
2018-01-09 14:36:05 +00:00
Jianghua Wang ebefaa7d0a Kolla-on-XenServer: Add dom0's ip addresses into xenapi facts
This commit is to add dom0's IPs in the xenapi facts. So that
kolla-ansible can use the proper IP address for vxlan tunnel or
other places when require dom0's IPs.

Change-Id: Iede11b4a529ff1885b588bf01d7ff15dc6185092
2018-01-09 14:36:05 +00:00
Zuul 12065324bc Merge "os-xenapi: Add script for iptable configure" 2018-01-09 14:08:02 +00:00
naichuans 60e43c9046 os-xenapi: Add script for iptable configure
Add a script to do iptable configuration

Change-Id: I0c984bbb1fecebdee6ca9afac238c0c5ba5e5bd8
2018-01-09 09:02:56 +00:00
Jianghua Wang 870e502850 Refactor for get_xenapi_facts
This commit contains the following changes:
1. remove it from cmd; as there is no need to expose this as a
   separate command. Making this as an util which will be invoked
   by xenapi_bootstrap.
2. rename the general function of get_hostname to be get_remote_hostname
   and move it to common_functions.
3. change the keywords for the facts items to make it more clear.

Change-Id: Ie786b3085c29f9a1faf2c51a1a704ded1010af7b
2018-01-05 09:22:13 +00:00
Zuul e961b45553 Merge "os-xenapi: add unit test for himn utils" 2018-01-04 07:29:47 +00:00
Jianghua Wang aa48f8223a Adding utils to install XAPI plugins to dom0
When deploy OpenStack on XenServer, we need install some XAPI
plugins to dom0. This commit is to add utils for this purpose.
If the os-xenapi version is different from the os-xenapi which
contains the utils. Users can specify the version to the utils.
So that the utils will download the right version of os-xenapi
and copy plugins from there. Otherwise the utils will by default
copy plugins from current installed packages.

Change-Id: I269a444b952f63fd73b3825b23dc95d6e825ce8f
2018-01-03 09:23:02 +00:00
naichuans 6059e681f6 os-xenapi: add unit test for himn utils
Add unit test for himn utils

Change-Id: I5154b5ed3346f8c5d81e117ad09351be4fd7e9ff
2018-01-03 09:00:27 +00:00
Zuul 4cafb55ce0 Merge "Add a new command to get facts for XenAPI" 2017-12-26 07:09:44 +00:00
Jianghua Wang a69cf17f67 Add a new command to get facts for XenAPI
This commit is to add a new command - get_xenapi_facts
which will gather facts for XenAPI. When deploy OpenStack
on XenServer, the facts can be used by deploy approach(e.g.
kolla-ansible).

Change-Id: Ia606d6ddc651cfa0b75fa34d8f14bc156d9dbe27
2017-12-26 05:29:24 +00:00
Jianghua Wang fb917711f4 Fix a format issue within ifcfg
Change-Id: I957e1a572522f1210707ddf5054f591bfaa4d03b
2017-12-25 11:11:37 +00:00
naichuans 7b6aa0ad9b os-xenapi: Add utils to support HIMN configure
Add utils to do HIMN configuration. If the local HIMN interface
is up and gets IP address allocated, we can get the interface
via checking if the local interface has an IP belong to the same
network as the dom0's HIMN IP which should be supplied. Otherwise
read xenstore to get mac address and find the interface via mac.
After identified the interface, we populate the ifcfg file to
ensure this interface will be up in the future across boots.

Change-Id: I5f8cd53710edb714f0c4c1dc50c1d4472f2e365f
Depends-on: Ia363afc1fc932bf44a7ac956a5bc27978bb47868
2017-12-25 08:20:21 +00:00
Jianghua Wang 99ea3ef3fa Introduce an utility for ssh commands
This is to introduce a new utility which can be used by other
scripts to setup ssh connection to remote hosts and run commands
remotely or copy files to remote hosts via scp.

Change-Id: Ia363afc1fc932bf44a7ac956a5bc27978bb47868
2017-12-20 20:00:53 -08:00
Jianghua Wang 05881a946a Add more objects for XenAPI.
Change-Id: I54cd775d030a3856df550daa8e83f968a22f2d8d
2017-10-19 16:14:38 +00:00
naichuans 7dce682e2a os-xenapi: Fix configure driver creating issue
In pooled environment, there would be an error when we create a
VM with configure driver on slave hosts. It is happened because
the streaming connection is created between slave compute node and
master Dom0. Change the connection back to slave Dom0 to fix this
error.

Change-Id: I02a740be3acf8973b6a324cf3563e427fc11534b
2017-09-18 09:51:38 +00:00
naichuans 4056689f0b os-xenapi: fix tempest test error from glance
The image_id argument is not used anymore, but I still passed it
to `_update_image_meta_v2` function, which lead to a tempest test
error. This patch is used to fix this error.
Modify the unit test to prevent similar issues.

Change-Id: I8cb9f6bd31f2f3ac2e4688253aee255b774f1b69
2017-09-12 05:54:42 +00:00
jianghua wang 2b97fb50c1 Support VDI streaming
This is to support streaming VHD tgz files to/from XAPI. In
this way, it will avoid the restriction that SRs must be
file system based SR (e.g. ext and nfs) for XenServer
OpenStack. So that we can support other types of SRs
e.g. lvm, iscsi and etc.

Change-Id: I2cfe7340d48071bf96bc7ba0ad19f5a0b12b5378
2017-08-30 07:44:57 +00:00
Jianghua Wang e7a915be9f XenAPI: fix the ephemeral disk failure on XS7.x
In XS7.x, sfdisk V2.23 is installed. But there is a bug which
causing it complaining wrong cylinder number is specified for
the partition's end. And that bug has been fixed since 2.26.
At here the solution is to use the option of '--force" before
V2.26.

Change-Id: I5f1a3c182ee1874383bd5f0cecbad18d96e8b58f
Closes-Bug: #1701153
2017-08-02 09:11:13 +00:00
naichuans 755876c19f os-xenapi: Add XAPI pools support for openstack on xenserver
Need to complete implementation for XAPI pools
Fix os-xenapi client session couldn't connect to xapi pool slave
issue. Now multi-node openstack envrionment could boot up VM on
slave node.
There are also many old unit test be broken, modify it to fit
new code changes

Change-Id: Ie1b49a206b57219083059871f326926cc4628142
2017-08-01 08:40:09 +00:00
Jenkins a6a612295a Merge "os-xenapi: fix CI to fit the change that glance-api use uwsgi" 2017-07-20 07:38:29 +00:00
Jenkins 5cf1e7deff Merge "os-xenapi: Grammatical errors about swap host function" 2017-07-19 11:10:53 +00:00
naichuans cc580828e7 os-xenapi: fix CI to fit the change that glance-api use uwsgi
Need change xenapi code to fit the change that glance-api switched
to uwsgi and add back the glance relative tests. Use urlparser to
get the suffix of the endepoint to build the http url. Using it in
glance service request in order to specify glance service

Change-Id: I5abdba24dc77c165100ba7d20cc731ce6076a4c7
2017-07-19 09:37:02 +00:00
naichuans c09eea88cf os-xenapi: Grammatical errors about swap host function
There is an exception thrown out during xapi pool test, which caused
by a urllib parse gramatical error

Change-Id: I1354ff52b8d6567a5d31ee3842372f6a1f6fae0c
2017-07-19 01:26:06 +00:00
Jenkins 12d45d06b6 Merge "Revert "Replace basestring with six.string_types"" 2017-07-18 02:25:55 +00:00
Jianghua Wang d1003f4f65 Revert "Replace basestring with six.string_types"
This reverts commit 5149040872.

Change-Id: I36e04cb0704607749319f0cf449122c08cd793f9
2017-07-16 03:10:30 +00:00
jianghua wang 0e64d44fd2 Fix an error in VM migration with volumes
It shouldn't use name arguement for call_plugin().

Change-Id: I7e30741c1af2cff1bd47367fd0ac656c3a4e449b
Closes-Bug: #1703805
2017-07-12 12:02:34 +01:00
Jenkins b338f128dd Merge "Replace basestring with six.string_types" 2017-07-11 01:47:47 +00:00