Commit Graph

69 Commits

Author SHA1 Message Date
Takashi Kajinami b488f42332 Bump hacking
hacking 3.1.x is too old.

Change-Id: Ic5131276ac1d1a1a959d0a5b16398ae12fae0c18
2024-01-27 23:57:00 +09:00
ricolin 129dc9b28b Add service_network_host option for port host
Network port host can be totally different than manila host,
So it's weird to force binding host to only manila host.
`service_network_host` allow we specify host for network ports
when `dhss` is True.

Change-Id: I3d9a3bbc81f18d60a0710d9336ad6f97176875be
2023-10-04 14:34:07 +00:00
Mohammed Naser 809253f3e8 Respect provided "host" when plugging ports
When creating port bindings for ports inside Neutron, Manila
just uses the hostname using "socket.gethostname()" rather
than the one provided via CONF.host

The default behaviour of CONF.host is "socket.gethostname()"
anyways, so it should work just fine.

Closes-Bug: #2037580
Change-Id: I4181a6f1527c80bf356d6363300b2d420921e7fa
2023-09-27 18:29:29 +00:00
Zuul b35ed8cf71 Merge "Nova: Remove unused image apis" 2023-02-21 01:08:12 +00:00
Takashi Kajinami 6a75bec7b9 service instance: Read public ssh key directly
... instead of executing the cat command as an external process.

One benefit of using an external process is that we could avoid
eventlet threads being blocked, but ssh public keys are usually tiny
and is not expected to cause huge blocking.

Change-Id: I5b03e26df36d6cc7564625b16d613b001b6dee0b
2023-02-16 19:08:07 +00:00
Takashi Kajinami 39a031e65c Nova: Remove unused image apis
Currently images are managed by Glance, instead of Nova, and these
implementations are no longer used.

Change-Id: Iabd4591b6782b135faa137a1e14a1fb760127ee6
2022-07-18 11:17:37 +00:00
haixin a73b299374 Remove usage of six lib for third party/vendors drivers.
Python2 is no longer supported, so in this patch
set we remove the usage of the six (py2 and py3
compatibility library) in favor of py3 syntax.

Change-Id: I3ddfad568a1b578bee23a6d1a96de9551e336bb4
2022-01-29 03:01:17 +00:00
David Caro abfa2e2311
service_instance: allow overriding the instance name
This uses the method _get_service_instance_name to generate the name
of the share service instance, instead of using directly the share
service id.

Note that it changes the default value of the
service_instance_name_template option to match the current default and
keep backwards compatibility.

Closes-Bug: #1945463
Change-Id: I3ee10f53315a37b47bd66eba082502b4209f4d95
Signed-off-by: David Caro <me@dcaro.es>
2021-10-26 10:58:51 +02:00
junboli 1982b90c07 Fix NFS/CIFS share creation failure issue
When the image count is over 25, there might not get
manila-service-image, because current manila shares
creation is using novaclient to get image info, but
novaclient can only get 25 images due to pagination
of glance server, So this change is to switch to use
glanceclient instead of novaclient to get image info,
because glanceclient can iter all image info, while
novaclient is rarely maintained with stuff of image
API.

Change-Id: Id1715d0b9cb3a4aeedeb23d9b1d9924a78d18dc6
Closes-Bug: #1741425
2020-06-30 12:46:28 -04:00
Zuul 1f7982e7f3 Merge "Get ports filtered by subnet id on share-server cleanup" 2020-05-27 12:30:15 +00:00
George Melikov d5fc7d2802 Get ports filtered by subnet id on share-server cleanup
Neutron can filter ports by subnet-id by itself, so:
- Don't send all ports in Neutron on every share-server removal
- Don't send fixed-ips fields (which are nearly half of total data)

Closes-Bug: #1879754
Change-Id: If42c9a0a662a62bbe2a02b6baee6ae13eedd8c97
Signed-off-by: George Melikov <mail@gmelikov.ru>
2020-05-21 18:26:49 +03:00
Goutham Pacha Ravi 598223985a Use unittest.mock instead of third party lib
mock was adopted into standard python
in version 3.3 [1]. Since manila no longer
supports python2.7, we can use the inbuilt
mock package rather than the third party
lib.

Fix some issues with imports that weren't
following our import conventions of grouping
imports [3]

Add a hacking test to ensure we don't regress
on this.

[1] https://docs.python.org/3/library/unittest.mock.html
[2] http://lists.openstack.org/pipermail/openstack-discuss/2020-March/013281.html
[3] https://docs.openstack.org/hacking/latest/user/hacking.html#imports

Co-Authored-By: Sean McGinnis <sean.mcginnis@gmail.com>
Change-Id: If857a49fbf526983e712282a25d7e8bef5093533
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2020-04-17 16:24:27 -07:00
Andreas Jaeger 8730b1638b Hacking: Fix F601
Fix:
F601 dictionary key 'qos' repeated with different values

Change-Id: Ie957c3ed84f13363ec53a5b26c52002e79d6f5b8
2020-04-01 09:21:01 +02:00
Mohammed Naser e7858ad084 Refactor route clearing to linux interface
The code for clearing routes currently lives inside the
service_instance module but it belongs better inside the linux
interface ones.

This patch refactors it into there, which can allow for a true
noop driver as all network operations would happen inside that
section.

Change-Id: I9fa29e9e5ed7dd2c620b56efab559f4cec25aced
2020-02-04 10:57:45 +01:00
Mohammed Naser a8f9174ca6 clear_outdated_routes: reduce neutron calls
This patch refactors the code which clears routes into another
function which already gets all of the subnets to avoid hitting
the Neutron API twice, and allowing us to eventually refactor
all of this code into the linux interface management API.

Change-Id: I6e1debce1ac379d15190db82299bdd92c9ff7734
2020-02-04 10:57:45 +01:00
Mohammed Naser e8adbf3cd4 generic: Refactor network functions to l3_init
There's a few functions which are used inside service_instance
which do networking that can live inside the linux interface
driver code.

This patch refactors them into there as this helps allow for
the noop driver.

Change-Id: Ib79ae3f08843414a552c89cd9a254b5e562123b8
2020-02-04 10:57:45 +01:00
Mohammed Naser e224b83d7e Use StrOpt for instance type
The instance type ID can be a string for quite sometime (such as
a UUID by default).

Change-Id: Iad9f742c1dd2dfc9b99f0756123af0cf51389c55
2020-02-04 10:57:39 +01:00
ericxiett a7aa847097 Fix error that failed to get image for booting server
Glance image list API supports pagination, but `_get_service_image`
uses novaclient.glance.list() that only return images in one page.
When the image needed by share server is not returned in the first
page, the exception occurs. This patch uses `find_image` method
to get the image.
Since latest novaclient has no proxy to lookup image, so only
novaclient.glance.

Change-Id: I57b15b7ebb29c545c9780a90734988565fa1f6b7
Closes-Bug: #1844046
2019-12-13 01:31:22 +00:00
ericxiett 6b1a5e0119 Fix timeout when compute server was soft-deleted
When set 'reclaim_instance_interval' larger than 0, share server
was deleted cause that the server exists until
reclaim_instance_interval. This patch checks status 'soft_deleted'
of instance to avoid the timeout.

Change-Id: Ib481c1699b19ee8c37473081f1aec780ed384e9d
Closes-Bug: #1844596
2019-09-25 21:26:49 +08:00
Goutham Pacha Ravi 3bd1e5054a [pylint] Fix/ignore pylint errors in test modules
- Add ignores to pylint false positives in the
  test modules.
- Remove unnecessary fake data
- Fix wrong mock methods used in tests

Change-Id: I64ffff15cc546c67e7e545b1da7ec0efa002bdc5
2019-02-28 08:36:11 -08:00
Goutham Pacha Ravi a75fe3d7cc Allow configuration of a back end specific availability zone
"storage_availability_zone" in the [DEFAULT] section of
manila's configuration file has allowed deployers to configure
and manage both service (scheduler, share manager) and storage
system availability. However, quite often manila's services
(api, scheduler, share and data managers) are run on a dedicated
control plane that is a different failure domain from that of
the storage that manila manages.

Also, when using share replication, deployers would need to
run multiple manila share manager services with different
configuration files, each with their own
"storage_availability_zone".

To allow flexibility of separating service and storage
availability zones, we introduce a new configuration option
"backend_availability_zone" within the share driver/backend
section. When this option is used, it will override the value
of the "storage_availability_zone" from the [DEFAULT] section.

Change-Id: Ice99a880dd7be7af94dea86b31a6db88be3d7d9b
Implements: bp per-backend-availability-zones
2019-01-23 17:13:24 +00:00
Jan Vondra eb0b81a8a5 Generic driver - Limiting SSH access from tenant network
Added new config option limit_ssh_access. If set to true the
neutron security groups are set up to block port 22 from other
subnets than service network in service instance.

Change-Id: I3c247ac2c55e5c74dbb0c8e31144bb865fd48710
Closes-bug: #1714288
2018-06-09 22:40:09 +00:00
Tom Barron b70b85386a Revert Id905d47600bda9923cebae617749c8286552ec94
Change-Id: I185145e5738bb5251d7c50bd04255f0045fd82f8
2018-02-07 17:13:52 -05:00
Zuul 7bf8148fdf Merge "Fix NFS/CIFS share creation failure issue" 2018-02-07 03:23:58 +00:00
haobing1 3c3d899837 Disable security group rule when create port
Use "driver_handles_share_servers=True" backend driver.
When create service neutron port to connect with service instances,
we should set the port security group is disable, to prevent be added
the default security group in neutron. Because some cases the default
security group would lead to the port can not connect with the service
instances.

Change-Id: Ib13e4f80c5a54b2b863b511ebb6e8f82700a3639
Closes-Bug:#1720283
2018-01-19 10:16:37 +08:00
junboli 51dd510636 Fix NFS/CIFS share creation failure issue
When the image count is over 25, there might not get
manila-service-image, because current manila shares
creation is using novaclient to get image info, but
novaclient can only get 25 images due to pagination
of glance server, So this change is to switch to use
glanceclient instead of novaclient to get image info,
because glanceclient can iter all image info, while
novaclient is rarely maintained with stuff of image
API.

Change-Id: Id905d47600bda9923cebae617749c8286552ec94
Closes-Bug: #1741425
2018-01-12 09:25:04 +08:00
junboli 5bfe68664a Raise error when image status is not active
when the image is not active status, it should be raise
error, because there is no need to take an error status
image to create share server.

Change-Id: Ib31b9a627a9bbd413e46bfc09775e0c6d30ac084
Closes-Bug: #1740010
2018-01-02 18:46:55 +00:00
zhongjun2 2b40e5618f Enable IPv6 in manila(network plugins and drivers)
Please read spec for design detail [1].

Support IPv6 in IP drivers, networks and share
type extra specs.

Co-Authored-By: TommyLikeHu(tommylikehu@gmail.com)
Co-Authored-By: Ben Swartzlander <ben@swartzlander.org>

[1] f7202a6cfe32a057f752a4e393f848f8a0211c36

DocImpact

Partial-Implements: blueprint support-ipv6-access
Change-Id: I96d3389262e9829b8b4344870cdf5c76abd22828
2017-07-27 18:28:15 +08:00
zhongjun 341161eead Use parenthesis instead of backslashes in tests folder
Use parenthesis instead of backslashes in tests folder

TrivialFix
Change-Id: I6c2ea07b0bfc5852b28e44989406cc10eb972e53
2017-06-19 17:56:01 +08:00
Valeriy Ponomaryov 5d5666b10e [Generic driver] Fix incompatibility with novaclient
Novaclient has removed lots of proxies to other clients such as
'images' [1], 'networks' [2] and 'security_groups' [3].
So, fix incompatibilities the way we can work with old and
new novaclient versions.

[1] I2d9fd0243d42538bd1417a42357c17b09368d2a5
[2] I8c520100a0016eed3959619c71dae037ebd72939
[3] I6fa14f43d48f1e035ef54bd2d0078506f0c6d6e0

Change-Id: Id7383329b2491f76579f042cbed06585c2214815
Closes-Bug: #1691445
2017-06-06 13:05:10 +03:00
Tom Barron 0f33dcf62b Remove nova net support from service_instance
Nova network was deprecated in Newton and is no longer supported for
regular deployments in Ocata [1].

As a first step towards removal and cleanup of nova network plugin
from manila, remove support for it from the service instance module.

[1] http://docs.openstack.org/releasenotes/nova/unreleased.html

Partially-implements: bp remove-nova-net-plugin

Change-Id: I846b760fa7c01f7f86768399a2bfad9ced7e57cd
2017-01-03 13:35:58 -05:00
Tom Barron b85248bce6 Use assertTrue rather than assertEqual(True, ...)
Manila unit tests contain several occurences of
assertEqual(True, ...) instead of assertTrue(...).

Fix these occurences and add hacking check so new
occurences don't creep into the codebase.

Closes-Bug: #1584948

Change-Id: Ib586590b9efcb5253e8c09ee735a8ffb62b44d74
2016-05-23 19:07:54 -04:00
Valeriy Ponomaryov fe6bd97afe Fix handling of share server details after error
Manila share manager has possibility to save share servers
details even if it failed to be created on some step.
To use it, share driver should attach 'detail_data' attr
to exception with dict of share server details.
But, if such data not provided or has unexpected type, then
manager writes "warnings" to LOG. So, make it have "debug" level
of logging because here is nothing to do for admin/operator.

Also, fix Generic driver's case when it does not provide information
when has it - on negative result of
share server network availability check.

Change-Id: If8926ad383669fd5ccbe69cf13b574bc044f19be
Closes-Bug: #1547076
2016-03-14 16:47:03 +02:00
Rodrigo Barbieri 447f2b1656 Implement admin network in generic driver
Implemented admin network support in generic driver
by creating extra ports in service instance.
In order to implement admin export location, Admin must
specify admin_network_id and admin_subnet_id
in driver configuration in manila.conf to create ports
between host and network of choice.

Possible scenarios are covered by this change:
*1: service network.
*2: service network and tenant network.
*3: service network and admin network.
*4: tenant network and admin network.

Admin network and tenant network configurations have
higher priority than service network. If both are
present, service network is not used.

Only admin network export locations are
is_admin_only = True.

Included additional admin_only export location
when creating shares and creating shares from
snapshots.

Removed deprecated 'service_ip' property of
server backend details.

Implements: blueprint admin-network-generic-driver
Change-Id: I8d8694ac3d83aa12a756112dfefebd7e17e32383
2016-03-01 17:08:38 -03:00
Béla Vancsics ecbc7f7fd2 Use assertIsNone instead of assertEqual(None, ***)
Instead of using assertEqual(None, ***), developers should
use assertIsNone(***).

TrivialFix

Change-Id: I9c7a7569e50bb87f50e48a54cfbf03d19727de4b
2016-02-25 08:22:35 +01:00
Rodrigo Barbieri 97531facd1 Fix neutron port concurrency in generic driver
As observed in several failed gate tests, there is a concurrency
issue between nova+neutron and Manila in generic driver.
This patch addresses this.

Change-Id: Ie5f01c937f30d994dc3c2df3f647cc90f29245ff
Closes-bug: #1548350
2016-02-22 13:40:09 -03:00
Matt Riedemann 21baff116a Avoid KeyError on instance_id in ensure_service_instance
There are cases where the server details don't have an instance_id
set but we need to check for that so we can avoid a KeyError. We
also log this case as a warning like the InstanceNotFound in the same
method. Ideally we'd log the share server ID for context but we don't
have that available in this method which is given ShareServerBackendDetails
key/values.

Change-Id: I8cabf7f3a5a3480a1f55a19fbdcebfc272906332
Closes-Bug: #1542365
2016-02-09 09:39:07 -08:00
Shaohui Wang dcf514838b Avoid service_instance neutron port clash in HA
Currently, after getting the list of ports from neutron,
we filter based on the device_id. In HA, two nodes will
share the same device_id. Hence, ports on different HA
backends are reported together causing a
ServiceInstanceException, not allowing for port creation
on the required backend.
This patch will use both device_id and binding:host_id
properties to filter neutron port lists to check for
valid port clashes if any.

Closes-Bug: #1519326
Change-Id: I81a16c360b1e8fffccddef5f358136e5fbde81e4
2015-12-03 12:24:07 +00:00
Yusuke Hayashi 8ce1530e21 Fix order of arguments in assertEqual
Fix incorrect order assertEqual(observed, expected) as below.
  assertEqual(observed, expected) => assertEqual(expected, observed)

Target of this patch:
  manila/tests/share/*

Note:
I also fix following asserts around above fixed parts.
  assertEqual(xx, True), assertEqual(True, xx) => assertTrue(xx)

As for assertFalse,
I do not convert assertEqual(xx, False) to assertFalse(xx)
because assertFalse(None) does not raise exception.

Change-Id: I56688105ab3b77e4f71bde472763a9c02c43664b
Partial-Bug: #1259292
2015-10-04 03:43:17 +09:00
Rodrigo Barbieri f5add61a8d Share Migration support in generic driver
Added minimal Share Migration support to generic driver,
so the Generic Migration procedure can work.

The approach to support is to add a field to Share Server
backend_details named service_ip with the port IP address that
allows the controller to access the Share Servers (same IP address
which they SSH through), this IP is used to return the access rule
required for the generic migration procedure.

For "driver_handles_share_servers=False" mode, configuration falls
back to common implementation in Core code and its parameters.

Optimized migration for Generic Driver will be included
as a separate patch.

Change-Id: Ie7d19a44c9ab05c5a6a79c30478be23b2e8a3ba2
Implements: blueprint share-migration
2015-09-06 22:52:56 -03:00
Yusuke Hayashi cb0a5c9829 Replace assertEqual(None, *) with assertIsNone in tests
Replace assertEqual(None, *) with assertIsNone in tests to have
more clear messages in case of failure.

Closes-Bug: #1280522
Change-Id: I2d5285add72678b5a61b4f66879c4d066afc34c7
2015-08-23 09:07:13 +09:00
Jenkins 2feafe5aa5 Merge "Service Instance: Add instance reboot method" 2015-08-27 04:27:46 +00:00
Igor Malinovskiy 6e054ff49b Use service availability_zone for Share Server VM
Update ServiceInstanceManager to respect AZ when
creating Nova VM's.

Partially-Implements: blueprint availability-zones

Change-Id: I5c734a6b82c4eec189951ba35e076e36699e1c10
2015-08-26 15:49:25 +00:00
Jenkins e48fbd8dc1 Merge "Lazy Load Services" 2015-08-26 06:31:41 +00:00
Ryan Hefner 4f861423a0 Lazy Load Services
When the Manila share service starts, it instantiates
the Neutron network helper, which makes a call to the
Neutron service. If the service is started and the
Neutron service is unaccessible, the share service will
fail to even start.

This patch lazy loads those parameters so that they are
only loaded when needed (and presumably when the Neutron
service is up).

Change-Id: I1857c0cb6fc41afd0d01916addc1fd216070ffd7
Closes-Bug: #1481331
2015-08-24 16:55:00 -04:00
Lucian Petrut 8d9ef0b7c8 Service Instance: Add instance reboot method
This patch adds a method in the Service Instance manager class,
responsible of rebooting service instances.

This will be used by the soon to be introduced Windows Driver.

Change-Id: Id82803339f5ddfef64eaf30a72d2c1632c4c6a9b
Partially-implements: blueprint windows-smb-support
2015-08-20 13:34:22 +03:00
Jenkins a991b8f7d5 Merge "Decouple some of the Service Instance logic" 2015-08-13 07:46:17 +00:00
Lucian Petrut dc0ac06fbb Decouple some of the Service Instance logic
This patch moves some of the logic from the Service Instance class
to separate methods, which can easily be overridden or re-used.

This will let us introduce Windows Service Instance support,
inheriting the Service Instance class.

Change-Id: I253f5ad9f12fc63ad189059aa667ab4e7d10484a
Partially-implements: blueprint windows-smb-support
2015-08-06 19:53:45 +03:00
Julia Varlamova 8b9c48688c Fix list creation
List creation '[x for i in 1,2,3,....]'  causes SyntaxError
in Python 3.

Add range() function for Python 3 compatibility.

Partially-Implements: bp py3-compatibility

Change-Id: Id7cc9b9c2e45f17e76bb5e698d7628a455452400
2015-07-31 06:32:37 -04:00
Clinton Knight 0a39557c74 Fix slow unit tests
As of liberty.2, the Manila unit tests are taking ~60 seconds to run
on my system. A dozen or so of the tests consistently take an integral
number of seconds to run (i.e. 1, 2, 3 or 4 seconds), indicating the
presence of a time.sleep() call in the code that hasn't been mocked.
By mocking time.sleep() and time.time() in just a few files, the time
needed to run the unit tests falls by a third to ~40 seconds (!).

Change-Id: I66a6d864823b10a4193eadf65a1c5d3028f2afa7
Closes-bug: 1478644
2015-07-28 18:46:25 +00:00