Commit Graph

830 Commits

Author SHA1 Message Date
Stephen Finucane adb28f503c xenapi: Remove driver and tests
Change-Id: I42b302afbb1cfede7a0f7b16485a596cd70baf17
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-09-11 14:09:06 +01:00
Stephen Finucane 21fecc7060 trivial: Remove log translations
We neither need nor want these translated so remove them. A couple of
logs with unnecessary brackets or weird indentation were identified in
the process, and these are also modified. Note that exceptions must
still be translated. Refer to [1] for more details.

[1] https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html

Change-Id: I4573a7c5f3a7b5716a15fbd15ad9336807843a03
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-05-27 09:40:47 +00:00
zhufl 2fd877310c Add missing parameter vdi_uuid in log message
This is to add missing parameter vdi_uuid in the log message.

Change-Id: If5a2e4245586c54cf575508ab2a5269bd205cb66
2020-01-03 17:09:21 +08:00
Stephen Finucane ec09c06c5a trivial: Remove unused constants, functions
Change-Id: I5943cce6434ece0c6152caf8e097486064296032
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-04-03 13:37:29 +00:00
Michael Still 38343cb1b2 Remove utils.execute() calls from xenapi.
They do not please me.

Change-Id: Ibe2f478288db42f8168b52dfc14d85ab92ace74b
2018-12-04 16:04:30 +11:00
Jack Ding 728f20e8f4 Add I/O Semaphore to limit concurrent disk ops
Introduce an I/O semaphore to limit the number of concurrent
disk-IO-intensive operations. This could reduce disk contention from
image operations like image download, image format conversion, snapshot
extraction, etc.

The new config option max_concurrent_disk_ops can be set in nova.conf
per compute host and would be virt-driver-agnostic. It is default to 0
which means no limit.

blueprint: io-semaphore-for-concurrent-disk-ops
Change-Id: I897999e8a4601694213f068367eae9608cdc7bbb
Signed-off-by: Jack Ding <jack.ding@windriver.com>
2018-11-21 15:57:11 -05:00
Matthew Edmonds d7ed9a550b Make Xen code py3-compatible
A couple places in the Xen code have been using syntax that is
python2-specific. This replaces those instances with code that will
work in both python2 and python3.

PEP 3108 [1] moves urllib.urlopen to urllib.request.urlopen. The six
module is used in order to work in both python2 and python3 [2].

PEP 3110 [3] changed the grammar for except clauses, such that the
'as' keyword is now required in place of a comma when specifying an
exception variable.

[1] https://www.python.org/dev/peps/pep-3108/
[2] https://pythonhosted.org/six/#module-six.moves.urllib.request
[3] https://www.python.org/dev/peps/pep-3110/

Change-Id: I1235d767718a4207f4cef3e5b140319d003ad7b0
2018-08-10 20:04:19 +00:00
Bob Ball eec0fe59ff XenAPI: Pass expected return codes to resize2fs
None is not tolerated by ProcessUtils, therefore make sure that [0] is passed as the
expected return code

Change-Id: I7d6335633479dfd7715444ef4aefc85ed41b8fa3
Closes-Bug: #1771137
2018-05-14 16:27:56 +01:00
jianghua wang 238b89b36e XenAPI: deprecate the config for image handler class path
This commit is to deprecate the config of image_upload_handler
which need to be configured with a class path string. And we
should make download handler be configurable to be consistent
with the upload handler.

So it contains the following changes:
1. deprecate the option of "image_upload_handler".
2. added a new option of "image_handler" which will be used to
choose a short name from the supported image handler plugins.
The proper handler will be loaded at runtime basing on the
option setting.

TODO(jianghuaw): For the legacy handler of VdiThroughDevStore
which has no download function implemented. For downloading, it
is handled in a different way (call xenapi.vm_utils._stream_disk()).
We keep it as it is now. In the future, we should consider to
move _stream_disk to VdiThroughDevStore's download().

Change-Id: I37860e63de32d988525cdc32440fe711777263e6
Blueprint: xenapi-image-handler-option-improvement
2018-05-11 07:44:03 +00:00
Michael Still fd154e71c2 Move xenapi partition copies to privsep.
I am unsure if I should be concerned about the lack of error
checking here, but this is how it was originally.

Change-Id: I9c1dfd5a90a53d90a44baae4874965bf8f48cea1
blueprint: hurrah-for-privsep
2018-04-13 07:19:39 +10:00
Michael Still e2926a2046 Sync xenapi and libvirt on what flags to pass e2fsck.
I can't see a good reason for the two drivers to use different
flags, and this simplifies the code a little.

Change-Id: I55cdc22ce8f95dff0cfd1a31b58582fc4b3ea48f
blueprint: hurrah-for-privsep-again
2018-04-13 07:15:44 +10:00
Michael Still 7b43fb4ebd Move xenapi disk resizing to privsep.
The same pattern as the rest of the changes. This means that privsep now
needs to let you pass flags to e2fsck, which I don't love and will remove
in a later patch.

Change-Id: I6c695c04ae586fec6adc354257638116277dda88
blueprint: hurrah-for-privsep
2018-04-13 07:09:58 +10:00
naichuans c0187a010c xenapi: Support live migration in pooled multi-nodes environment
The previous implementation doesn't support live migration in
pool-based multi-hosts OpenStack environments. Modify code to
support it.
In this patch we will,
1. Support live migration in XAPI pool:
    -Add code to support resource pre-check before live migration.
    -Add code to support resource clean after live migration.
    -Add code to support using local storage in xapi pool.

Depends-On: I80007bb897a1f7eda47ebda82e08fe270f97ff40
Implements: blueprint live-migration-in-xapi-pool
Change-Id: I6437a315f1400a73f7a149bed5550f6d6dd1406f
2018-04-11 10:44:21 +00:00
Michael Still cc0d8ab9ff Move xenapi xenstore_read's to privsep.
Self explainatory really.

Change-Id: I1d63dd771e4f44ac131c37563bff42b970c44a09
blueprint: hurrah-for-privsep
2018-04-04 06:29:33 +10:00
Michael Still fef1435167 Move makefs to privsep
Change-Id: I388d31d5e9c1cff10bc534ba69be899e67681ce6
blueprint: hurrah-for-privsep
2018-02-28 07:15:08 +11:00
Michael Still e94151c1c3 Convert users of tune2fs to privsep.
xenapi likes enabling and disabling ext3 filesystem journals. They can
do that via privsep now.

Change-Id: Iad8198fbd01aa80bde0a6b295963391715c5cd48
blueprint: hurrah-for-privsep
2018-02-28 07:14:51 +11:00
Michael Still 635d205268 Move remaining uses of parted to privsep.
Including updating their unit tests. We can now remove parted from
the rootwrap configuration.

Change-Id: I8cbfe296238976001e38997842059ec2f137f660
blueprint: hurrah-for-privsep
2018-01-24 22:26:36 +00:00
Michael Still 38469b81a9 Start moving users of parted to privsep.
This isn't all calls, but a step along the way. Note that I moved
a xenapi unit test to being the first unit test for privsep directly.
I'm not sure if I love this way of testing (having the "meat" of
the method undecorated and having a wrapper), but I've been unable
to come up with a way to mock away the entrypoint wrapper.

Change-Id: I35d4e7c6c43cbcbc1549aa28796ff97f447a4b03
blueprint: hurrah-for-privsep
2018-01-22 21:37:53 +00:00
Zuul 1472dcf880 Merge "conf: Remove deprecated 'remap_vbd_dev' option" 2017-12-27 15:14:23 +00:00
Stephen Finucane 29c962f3ba conf: Remove deprecated 'remap_vbd_dev' option
This flag was deprecated in a previous cycle. The flag, the feature that
the flag enabled, and a related flag that was not deprecated but should
have been, can now be removed.

Change-Id: I6b38b4e69c0aace4b109f0d083ef665a5c032a15
2017-12-27 11:23:31 +00:00
Jianghua Wang e18608d579 XenAPI: resolve VBD unplug failure with VM_MISSING_PV_DRIVERS error
The virtual block device(VBD) hot unplugging should be done when VM has
paravirtualization(PV) driver installed. But we observed failures with
VM_MISSING_PV_DRIVERS error on a real PV VM sometime.

Actually it's a race condition. At VM booting, it needs some time for
the PV driver to be connected. If the VBD.unplug operation goes before
the PV driver connected to xen, it will failed with VM_MISSING_PV_DRIVERS.

The fix is to retry unplug. If really there is no PV driver installed in
VM, failed after the attempts.

Change-Id: I6b788ba24aa3e7c061dac06c52570ff3818bc91a
Closes-Bug: #1727134
2017-10-28 08:57:35 +00:00
Zuul bbb1a72257 Merge "Move kpartx calls to privsep." 2017-10-25 18:59:54 +00:00
Michael Still b12f0a6026 Move kpartx calls to privsep.
The same pattern as before.

Change-Id: Ia97d7023523208f834cb088bf290b0f3c01016bc
blueprint: hurrah-for-privsep
2017-10-24 12:24:16 +00:00
naichuans 693ace79fb xenapi: cached images should be cleaned up by time
For xenapi driver, there needs to be some way to delete cached
images based on when they were created. add an optional arg to
control delete operation.

Change-Id: I24fc45e989aa951aab55a261fce77f7e3667d988
Closes-bug: 1481689
2017-10-23 16:29:16 +00:00
Michael Still 7ad72b0922 Cleanup mount / umount and associated rmdir calls
Add a new filesytem mounting helper in privsep, and then start
moving things across to it. This currently implements mount and
unmount. We get to cleanup some rmdir calls while we're at it
which is nice as well.

I've added an upgrade note mentioning that we no longer ignore
the value of stderr from mount calls, as requesed in code review.

Change-Id: Ib5e585fa4bfb99617cd3ca983674114d323a3cce
blueprint: hurrah-for-privsep
2017-10-18 17:52:58 +11:00
Eric Fried 5db9389c01 Trim the fat from InstanceInfo
nova.virt.hardware.InstanceInfo had several fields that have never been
used since their inception two and a half years ago [1].  This change set
removes them.  They are (were):

max_mem_kb: (int) the maximum memory in KBytes allowed
mem_kb: (int) the memory in KBytes used by the instance
num_cpu: (int) the number of virtual CPUs for the
         instance
cpu_time_ns: (int) the CPU time used in nanoseconds

We also rename the 'id' field to 'internal_id' for two reasons: First,
because 'id' is a builtin; second, to emphasize that this is not
(necessarily) tied to the Instance's real id/uuid.

[1] https://review.openstack.org/#/c/133777

Change-Id: I5fe5c8121800e2b8da0860d53d818b7bd83c9e9d
2017-07-25 10:27:23 -05:00
Ngo Quoc Cuong 6c3520ac5b Remove translation of log messages
The i18n team has decided not to translate the logs because it
seems like it not very useful; operators prefer to have them in
English so that they can search for those strings on the internet.

Partially fix on nova/virt other paths will be fixed on next commits

Change-Id: Ie7821aa4a5147cdb0616741bd1a1b1fc22080440
2017-06-13 11:20:28 +07:00
Huan Xie 812cfc14f8 XenAPI: Remove bittorrent.py which is already deprecated
With XenAPI driver, bit torrent related configurations are
deprecated since 15.0.0, this patch is to remove it as a
cleanup action under XenAPI driver

Change-Id: I5589f76f397a02a46e45cf571fd180842c0fdf17
2017-06-07 19:09:58 -07:00
Huan Xie a2f6aac01d XenAPI: use os-xenapi 0.2.0 in nova
This patch is to change nova project to use os-xenapi 0.2.0 which
has added python interfaces for calling dom0 plugins
1. use os_xenapi.client.host_network
2. use os_xenapi.client.disk_management
3. use os_xenapi.client.vm_management
4. use os_xenapi.client.host_xenstore
5. use os_xenapi.client.host_agent
6. use os_xenapi.client.host_management
7. use os_xenapi.client.host_glance

Change-Id: Id87b83ef3ca496525f63b9c7b731e8a22c693e02
2017-06-06 22:01:24 -07:00
Sergey Nikitin dcf962069c Completed implementation of instance diagnostics for Xen
Added data about NICs, CPUs and disks.

blueprint: restore-vm-diagnostics

Change-Id: I3ab0c843f626951ce422ff530b5bc2d266a3d9a2
2017-06-04 15:47:40 +04:00
Sergey Nikitin a6335343cf Replace diagnostics objects with Nova diagnostics objects
New objects are children of NovaObject class. Such parent
will give us a good control of objects versioning. Also it
will force contributors to dump objects version in case of
any changes. These objects will be used to transmit data
via RPC. Old objects were used only for storing data.
During RPC transmission they are transform into dictionaries.
It is not right approach because we will have some problems
in case of adding new diagnostics fields.

Version of compute RPC was bumped.

Also some changes were made in libvirt driver method
get_instance_diagnostics(). These changes were made to fill
new fields of 'Diagnostics' object.

Implementation of method get_instance_diagnostics()
for other virt drivers will be changed in future patches.

blueprint: restore-vm-diagnostics

Change-Id: I5e2d116df045f803c654f7810b939b5fc859cfbf
2017-05-30 00:39:45 +04:00
wanghongxu 5bb705bf7b code comment redundant
Change-Id: I75808f30587c048d83d98cb61de12aaad99667a8
Closes-Bug: #1676039
2017-03-28 09:49:00 +08:00
Zhou Jianming fd786bd509 'uplug' word spelling mistake
Change-Id: Ibbe0143a2f3ad64eee377b5dc38d0b4c5f128f83
Fixes: Bug 1675712
2017-03-24 17:50:47 +08:00
Gábor Antal 6eaf6dcb1e Removed unnecessary parantheses and fixed formation
Some place in Nova, return value has unnecessary parentheses,
or return keyword is not followed by a space when returning a value,
which is a bad format and might be ambigous. For example:

    return(1)
    return{
        'a': 1
    }

As noone would write returns like:

    return1
    return'(empty)'

In this patchset we get rid of this bad formation.
Also, I've added a hacking rule which helps to prevent this in future.

TrivialFix

Change-Id: I4ff85d0240bf8719188ebd06fc0e98a81c1d1203
2017-02-09 14:03:53 +01:00
Spencer Yu 70730c09ab [2/3]Replace six.iteritems() with .items()
1.As mentioned in [1], we should avoid using
six.iteritems to achieve iterators. We can
use dict.items instead, as it will return
iterators in PY3 as well. And dict.items/keys
will more readable. 2.In py2, the performance
about list should be negligible, see the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

The patch list:
    1. cells.
    2. compute api.
    3. image.
    4. network.
    5. objects.
    6. scheduler.
    7. virt.
    8. other resources.

Partial-Implements: blueprint replace-iteritems-with-items

Change-Id: Ic6e469eb80ee1774de1374bb36f38b5134b6b311
2017-01-09 09:11:00 +00:00
Stephen Finucane 4a7502a5c9 objects: Move 'vm_mode' to 'fields.VMMode'
Resolve the relevant TODO. Migrate tests in the process.

Change-Id: I372266b158667683cad973f20976619c34538491
2016-11-25 16:19:44 +00:00
Takashi NATSUME 4eb89c206e Add a hacking rule for string interpolation at logging
String interpolation should be delayed to be handled
by the logging code, rather than being done
at the point of the logging call.
So add the following hacking rule for it.

- [N354] String interpolation should be delayed at logging calls.

See the oslo i18n guideline.

* http://docs.openstack.org/developer/oslo.i18n/guidelines.html

Change-Id: Ief6d3ee3539c0857098fffdb7acfeec3e0fed6eb
Closes-Bug: #1596829
2016-10-11 08:39:48 +00:00
hussainchachuliya ebb51d50dc Replace uuid4() with generate_uuid() from oslo_utils
As of now, UUID is being generated using either uuid.uuid4()
or uuidutils.generate_uuid(). In order to maintain consistency,
we propose to use uuidutils.generate_uuid() from oslo_utils.

Change-Id: I69d4b979fc0e37bc351f9b5516dae899e7e7dba0
2016-09-23 14:39:09 +05:30
Stephen Finucane 6bb1fd776f plugins/xenserver: Add '.py' extension
All Python files, except executables, should have a '.py' extension.
This wasn't being done for files in the 'plugins/xenserver' folder,
likely because it seems unnatural to call a "plugin" with a file
extension.

Begin working towards a resolution for this by renaming all files to
include a '.py' extension. To avoid forcing operators to upgrade the
Nova service and per-host plugins at the same time, continue to
reference the old, non-'.py' filenames, using symlinks to ensure the
references continue to work. Once Ocata has been released, these
symlinks can be removed, the API version updated and the reference
updated to include the '.py' extension.

Change-Id: Icf4cf2424c15276a6c01778fb92f76bbdc9b2068
Closes-bug: #1302831
2016-09-21 10:56:39 +01:00
Michael Still 64cbd7c51a Add support for vd2 user context to other drivers
This patch adds support for passing the user context through to
vendordata2 to all the other drivers. libvirt got this in the
original patch, so this is a catch up for the others.

Change-Id: I1e1f0aa1a41626970ae3291caaf8d1d1661f68e6
Blueprint: vendordata-reboot
2016-08-10 12:39:30 +10:00
Bob Ball eac75d49d0 XenAPI: Add option for running nova independently from hypervisor
Add the independent compute option and ensure appropriate failure cases
for all incompatible options.

Change-Id: I76c1e3a80da8142639328b204aea5da59551eea3
Implements-blueprint: xenapi-independent-nova
2016-06-27 13:41:27 +01:00
Bob Ball 5915da7402 XenAPI: Stream config drive to XAPI
Rather than mounting a guest disk into the compute node,
create the config drive locally and stream it to the
XenServer hypervisor.

Change-Id: I324538decbadf63e78ba86e20e3d41687b0a195a
Implements-Blueprint: xenapi-independent-nova
2016-06-27 13:41:27 +01:00
Bob Ball 3e85b80649 XenAPI: Perform disk operations in dom0
Move some disk operations from DomU to Dom0 to allow Nova
to run independently from the hypervisor.

Some disk types can be created in Dom0 (e.g. swap, ext3) but
others cannot.  Add support here for creating those that can
in Dom0.  This will be documented in the independent_compute
config flag in the last patch in this series.

Implements: blueprint xenapi-independent-nova
Change-Id: I634e783a5e19f9710544920e12300b299fc06b36
2016-06-27 13:41:15 +01:00
Jenkins ea692a5656 Merge "xenapi: Image cache cannot be disabled" 2016-05-23 16:52:29 +00:00
Pushkar Umaranikar d619ad6ba1 Config options: Centralize netconf options
The config options of the section
"nova/netconf" got moved to the
new central location
"nova/conf/netconf.py"

Change-Id: I8a17b6f00b15e03de55385fc0206bdc82441304a
Depends-On: I0da2ad7daa942b85c3395dc4861c6e18368ece88
Implements: blueprint centralize-config-options-newton
2016-04-24 18:15:05 +00:00
Jianghua Wang bc10d29e41 XenAPI: specify block size for writing config drive.
When writing config drive, dd by default uses 512B as the block
size. It costs more than 3mins to write the 64M config drive.
It's longer than expected: Some health checking(fuel's heat
checking) on XenServer may failed due to timeout. So we need
improve the performance via specifying a bigger block size
with dd.

Change-Id: I359e17d6d5838f4028df0bd47e4825de420eb383
Closes-Bug: #1567857
2016-04-10 19:05:54 -07:00
Hemanth Makkapati 8caaf3572e config options: centralize xenserver vm_utils opts
Moves configuration options under nova/virt/xenapi/vm_utils.py to
nova/conf/xenserver.py.

bp centralize-config-options-newton

Change-Id: I2da39474c23466b5755e75667edfd7fc9ea134d2
2016-04-05 10:46:56 -05:00
Swapnil Kulkarni (coolsvap) a023c32c70 Replace deprecated LOG.warn with LOG.warning
LOG.warn is deprecated. It still used in a few places.
Updated to non-deprecated LOG.warning.

Change-Id: I42c7b6a172b64a3c1ac6e0703df48ac2ddf8390a
Partial-Bug:#1508442
2016-03-15 11:57:56 +00:00
John Hua 0bb080ba04 xenapi: Image cache cannot be disabled
Image cache should be able to be disabled by setting cache_images = none
in nova.conf. Currently the condition judgment is wrong.

Change-Id: I5ebff2c1f7534b06233a4d41d7f5f2e5e3b60b5a
Closes-Bug: #1161471
2016-03-14 15:19:24 +08:00
Takashi NATSUME 897cb7c2d3 Fix string interpolations at logging calls
Skip creating the formatted log message
if the message is not going to be emitted
because of the log level.

TrivialFix
Change-Id: Iba9f47163a0ac3aca612818272db6d536b238975
2016-03-07 12:05:58 +09:00