Zhiteng Huang [Fri, 9 Nov 2012 06:37:21 +0000 (14:37 +0800)]
Remove unused volume API method - remove_from_compute()
remove_from_compute() method in cinder.volume.api is never used
by others and it is also broken since the interface in Nova has
been changed to remove_volume_connection(), thus it should be
removed from Cinder.
Zhiteng Huang [Sat, 6 Oct 2012 17:11:41 +0000 (01:11 +0800)]
Scheduler API clean up and refactor
Unlike Nova scheduler, which has to consider serving compute and volume
scheduling, Cinder scheduler only serves volume scheduling, so there's no
need to keep generic interface 'schedule'. Instead, 'schedule_create_volume'
is added (if missing) to manager/driver class and chance/simple scheduler
driver implementation.
Also this patch changes the interface between API service and scheduler to
allow more information about volume is passed to scheduler for advanced
scheduling while maintained backward compatibility. And this change bumps
scheduler RPC API to version 1.2.
John Griffith [Tue, 6 Nov 2012 18:08:58 +0000 (11:08 -0700)]
Remove dm_setup(remove) call in volume_delete.
While it makes sense to perform the dm_setup(remove) before
performing the lvm remove, it seems to cause some buffer IO
errors as evident by kern.log.
I'm also a bit suspicous in that it seems the delete timeouts
we see seems to have increased in frequency with this addition.
I propose this step is removed until we completely understand the
impact of the kernel error on Precise kernels.
john-griffith [Tue, 6 Nov 2012 06:26:07 +0000 (23:26 -0700)]
Add ability to disable secure volume delete.
Due to gating issues caused by secure delete on LVM volumes,
add the ability to disable via flag.secure_delete.
Default will be set to True, but we add a way for the gate tests
to disable this until we can come up with a fix for
https://bugs.launchpad.net/cinder/+bug/1023755 OR implement an alternative
secure delete method that doesn' suck.
Rushi Agrawal [Sat, 3 Nov 2012 06:51:28 +0000 (12:21 +0530)]
Fix run_tests.sh ambiguous usage msg and behaviour for -x option
In commit
https://github.com/openstack/cinder/commit/ 50792c2ff41fdc7e73b3e3c51f4510366debfd14,
the committer wanted to add an option in run_tests.sh for generating XML
coverage report, but ended up accidentally overriding the default nose
option -x. But, the usage message still showed that using option -x will
'Stop running tests after the first error or failure'. So, I changed the
option to generate XML report to -X (capitalized 'x'). So now both -x and
-X options are available, with different purposes.
clayg [Thu, 25 Oct 2012 09:55:13 +0000 (02:55 -0700)]
Add admin only action for force detach
This action calls the same methods nova would after it successfully
detaches a volume. By exposing it to the administrator it makes it's
easier to repair un-syncronized state between services. Generally when
the host is no longer attached, but the volume state is wrong.
Future work: The Iscsi based drivers don't seem to use
initialize_connection and terminate_connection to create the export for
the volume. This would be more useful with drivers that do that.
I added the force parameter to terminate_connection for drivers that may
want to differintiate between a normal terminate and the force detach.
Future Nova work: Nova will want an admin action to update the bdm
tables - today it's a bit of nova-manage shell work.
The openssl popen call to verify the token returns an error code
of 2 when a file doesn't exist. Normally this is caught and the
relevant file is downloaded, but monkeypatching os causes this
error code to be eaten and cinder to return a 401. Note that this
is likely a race condition that depends on exactly when greenthreads
are switching that is causing the return code from Popen to get
overwritten.
It is possible that this is exposing an underlying bug in eventlet
but the workaround is simply to make sure that we don't monkeypatch
os.
Moved RBDDriver, SheepdogDriver into their own respective driver
files under cinder/volume/drivers/*. Moved FakeISCSIDriver and
LoggingVolumeDriver into a fake driver file under the tests,
since that's the only place where those are used.
Minor optimization in create_volume in HpSanISCSIDriver
Removing extra call to getClusterInfo in HpSANISCSIDriver
on every create_volume call. The cluster info is now
being lazily stored in a local variable.
Clay Gerrard [Wed, 31 Oct 2012 20:25:55 +0000 (15:25 -0500)]
Return volume type name on volume create
Update openstack api controller for volumes to fully inflate the
returned volume model on create to populate the volume_type fields so
the response serializer will return the name of the volume_type instead
of the id on volume create requests. Returning the name on create is
consistent with the show and index commands.
Sean Dague [Wed, 31 Oct 2012 14:10:29 +0000 (10:10 -0400)]
pin sqlalchemy to the 0.7 series
sqlalchemy 0.8 beta has hit mirrors, and changes dependencies, thus
breaking jenkins. This pins it to 0.7 series until all the projects
agree to move forward to 0.8.
Brian Waldon [Tue, 30 Oct 2012 22:06:12 +0000 (15:06 -0700)]
Add VolumeTenantAttribute API extension
Expose the ID of the project to which a volume belongs through a
new API extension. This is only presented to Admins by default.
Visibility can be controlled with the 'volume_tenant_attribute'
policy rule.
The inability to deduce an /action request from the logs
makes diagnosing integration with nova difficult. This change
logs the action method and arguments
John Griffith [Wed, 24 Oct 2012 22:28:02 +0000 (16:28 -0600)]
Detect and fix issues caused by vol ID migration
The migration from volume ID to UUID neglected to update the provider_location
field on the volume. As a result the iqn and volume name no long match and
existing volumes are no longer able to be attached after an upgrade
(essex -> folsom and then nova-vol->cinder).
This patch adds a method to the volume driver that will check for the
mismatch of volume name in the iqn during service start up. If
detected it will update the provider_location field in the database
to include the new ID. Also it will create a symlink to the device backing
file that also has the correct naming convention.
Note: We don't disturb an connections that are currently attached.
For this case we add a check in manager.detach and do any provider_location
cleanup that's needed at that time. This ensures that connections
persist on restarts of tgtd and reboot.
The SolarisISCSIDriver and HpSanISCSIDriver have been removed from
san.py and placed in their own files. The default SanISCSIDriver
implementing some common methods still resides in san.py. These
san drivers have now been grouped in the san module.
Brian Waldon [Sat, 27 Oct 2012 22:36:30 +0000 (15:36 -0700)]
Add VolumeHostAttribute API extension
Expose the host on which a volume resides through a new API
extension. This is only presented to Admins by default. This
can be controlled with the 'volume_host_attribute' policy
rule.
Zhiteng Huang [Wed, 3 Oct 2012 09:10:57 +0000 (17:10 +0800)]
Add default volume type flag
Where using volume type scheduler, 'volume type' is an essential input for
scheduler to perform sophysticated scheduling. This patch adds a new
flag 'default_volume_type to allow admin to set one volume type as the
default type for volume creation if user doesn't specify any.
Also add more clear 404 message to API if create request provided non-existing
volume type.
Note: Setting the 'default_volume_type' flag to non-existing volume type
is problematic and should be avoided, and the outcome of such behavior is
equivlant to setting default volume type to None.
This is part of patch set implementing 'volume-type-scheduler'.
jking-6 [Wed, 24 Oct 2012 17:15:03 +0000 (13:15 -0400)]
Allow the user to update a volume's metadata
The fix mainly involves updating the VolumeController's update method
to allow the 'metadata' key to be a valid key in a request body.
The _translate_volume_summary_view method is updated to check for a
'metadata' key in the vol parameter after checking first for
'volume_metadata'. This is to avoid making a third call to the
database after updating the volume model. This solution introduces
the least amount of new code.
Eric Harney [Mon, 22 Oct 2012 22:02:17 +0000 (18:02 -0400)]
Ensure device node exists before wiping during volume deletion
If the LVM device node is missing when a Cinder volume is deleted,
a large amount of data will be written to /dev/. Check that the
device node exists before performing a _copy_volume('/dev/zero'...)
to wipe it. Fixes bug 1070023.
Clay Gerrard [Mon, 22 Oct 2012 21:47:12 +0000 (16:47 -0500)]
Update volume and snapshot status on delete
Change the status of "deleting" resources at the same time we update boolean
flag for deleted. Makes dumb queries looking for stuck statuses a little
easier.
Eric Harney [Wed, 10 Oct 2012 14:38:22 +0000 (10:38 -0400)]
Error message references incorrect variable
In remove_iscsi_target() for the TgtAdm class, the "Failed to
create iscsi target for volume id:" message references a
variable that doesn't exist -- use the correct variable name.
Loosen anyjson dependency to avoid clash with ceilometer
Ceilometer depends on anyjson 0.3.1, whereas cinder requires
exacly 0.2.4.
The net effect is a devstack with ceilometer installed will
appear to work initially, as ceilometer is sparked up after
cinder. However, if any of the cinder services are subsequently
restarted, they fail with:
Zhiteng Huang [Mon, 8 Oct 2012 07:36:39 +0000 (15:36 +0800)]
Configuration Options clean up
Small clean up of configuration options including:
* unused config opts:
- reclaim_instance_interval
* rename 'instance' in config opts name/help message to 'volume'
- 'instance_usage_audit_period' to 'volume_usage_audit_period'
- help message of 'volume_name_template'
This change also re-generates cinder.conf.sample file.
This ensures that we fail-fast if the tgtd configuration does
not include the directory for volume iscsi target configs,
instead of only blowing up when tgtd is restarted.
Russell Bryant [Fri, 21 Sep 2012 18:51:17 +0000 (14:51 -0400)]
Remove unused code: check_for_export.
This code has been unused since cinder was split from nova. It used to
be used as a safety check during live migration. The check was removed
recently in nova, since it wasn't being used with Cinder anyway (just
nova-volumes).
An alternative approach would be to expose this from Cinder somehow if
we feel it's important, but until then, there's no reason to keep dead
code around.
This patch syncs the cinder driver code with that of the nova code,
as we received comments in the review process there. All changes are
minor: (1) removing unnecessary type checks of the flags, (2) not
using getattr to access the FLAGS, and (3) using the self.flags()
infrastructure that test.TestCase provides.
Currently nova and cinder have to have the same set of az's for
the ec2 api to work properly. Therefore, set the default az for
cinder to nova so they will match.
Includes a hack to az to set cinder to nova to work around gate
issues. The hack can be removed once the gate sets the zone to
nova properly.
John Griffith [Thu, 20 Sep 2012 23:27:13 +0000 (17:27 -0600)]
Add lun number (0) to model_update in HpSanDriver
The HpSanDriver was not setting the lun number in model_update
and as a result default value of 1 was being used. Trouble is the
Lun number used by LeftHand is 0, so the connect info would be
wrong and fail when trying to attach the volume.
Even when the san_is_local config option was set to false, the
SolarisISCSIDriver's _execute method was accidentally set to
util.execute by the VolumeDriver's __init__ method.
The code in nova for logging added an extra root handler to be
able to log messages to the console during log setup. This handler
was removed in the setup method. The common setup method no longer
removes this handler, so don't create it. Note that there may be
a small period before the logging setup is finished where messages
will not appear.
Python ignores SIGPIPE on startup, because it prefers to check every
write and raise an IOError exception rather than taking the signal. Most
Unix subprocesses don't expect to work this way. This patch (adapted
from Colin Watson's post at http://tinyurl.com/2a7mzh5) sets SIGPIPE
back to the default action for cinder.utils.execute and cinder-rootwrap
created subprocesses.