summaryrefslogtreecommitdiffstats
path: root/nova/block_device.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix and enable H403 testsDirk Mueller2013-06-121-1/+2
| | | | | | Multi-line doc-strings should end on a new, separate line. Change-Id: I4cf0cfe92b634ef77971863a4df41ef43531bc20
* Create an image BDM for every instanceNikola Dipanov2013-06-101-0/+15
| | | | | | | | | | | | | | This patch makes every boot create a block device mapping if the instance was started with an image. These block devices are not used anywhere at the moment but will be used in the future as part of a more flexible block device API. This patch also makes sure they are deleted once the instance is deleted as well. Change-Id: Ia89d531be71c460f1f82fcfce34b270639a23061 blueprint: improve-block-device-handling
* BDM class and transformation functionsNikola Dipanov2013-06-081-1/+162
| | | | | | | | | | | | | | | This patch adds the utility functions that will help us switch between versions of block device mapping data. In order to accomplish this, and to have a more structured approach to dealing with block device mapping data in the future, this patch introduces a BlockDeviceDict class which is a thin wrapper around a standard dict that makes it easier to reason about which fields are present in the dictionary, and introduces said conversion routines. blueprint: improve-block-device-handling Change-Id: I9370333059b8c9aaf92010470b8475a913d329b2
* Add missing tests for db.block_device_mapping_* methodsBoris Pavlovic2013-03-131-1/+1
| | | | | | | | | | | | | There was no tests in test_db_api for block_device_mapping_* methods. Add tests to ensure that all works. Also these tests allow us to refactor work with session in these methods. Fix bug in is_ephemeral we should return True or False not instance of _sre.SRE_Match or None. blueprint db-api-tests Change-Id: I3cac17e7d2c8d0b2608fb9a78ea29210f025222b
* Fix rebuild with volumes attachedRick Harris2013-01-301-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch assumes that the correct behavior for instance rebuild is to maintain attached volumes across a rebuild operation. Two important changes are: 1) Detaching all volumes during a rebuild so that they won't be 'in-use' when prep_block_devices is called to reattach them. 2) xenapi: Allowing additional volumes, not just root volumes, to be attached before boot. To handle this, we cycle through all block-device-mappings, not just the root-device, create the VDI, and later, create the VBD. Small changes include: * Using `connection_data` instead of `dev_params` (to match other parts of the code base) * Renaming `get_vdis_for_boot_from_vol` to `get_vdi_uuid_for_volume` to reflect its more general and simpler semantics. Fixes bug 1071547 Change-Id: Ie54a16be4bae2a718ed7d506f32777d0847b9089
* DRYing up volume_in_mapping code.Rick Harris2013-01-301-0/+25
| | | | | | | | | | | Libvirt, VMWare, and Xen drivers all reimplement this method. This refactors the code into the `block_device` module so all drivers can share it. Future Work: Refactor xen so that strip_prefix doesn't need to be passed to `volume_in_mapping`. Change-Id: I026b655f2eb7ea9cebe84058749c05ce93bcb7d4
* fix N402 for rest of novaSean Dague2013-01-091-4/+4
| | | | | | | fix N402 (single line docstrings should end in a period) for rest of nova files Change-Id: I57d0d9ab01345dd83e544e476d79d2c2ca68ee51
* fix N401 errors, stop ignoring all N4* errorsSean Dague2013-01-071-1/+1
| | | | | | | | | | | | | | | | | We had previously been ignoring all our custom N4xx hacking.py errors. This fixes all the N401 errors "doc strings should not start with a space" and reduces the ignore set down to N402 only "single line docstrings should end with period". It also fixes the N401 parser to catch only docstrings, and not tripple quoted string blocks used later on in a function. Clean up a few of the more crazy uses of """ in our code Clean up additional funky comments to make indents a bit more consistent, and pull in lines when possible. Change-Id: I9040a1d2ca7efda83bd5e425b95d1408b5b63577
* Move compute_driver into nova.virt.driverMark McLoughlin2012-11-211-5/+2
| | | | | | | | | | | | | | | | Commit 9102f80 moved compute_driver from nova.compute.manager into nova.config. We're trying to get away from so many global options, so where to put it? The config option is used for two things - loading the driver and, in a bunch of random places, checking if it matches a specific value. It seems to make perfect to sense to encapsulate both as functions in nova.virt.driver and move the option there. blueprint: scope-config-opts Change-Id: I28a71df5b682c6bd381401f63da49d91fb187125
* Use CONF.import_opt() for nova.config optsMark McLoughlin2012-11-201-1/+1
| | | | | | | | | | | | | The only reason for importing nova.config now is where one of the options defined in that file is needed. Rather than importing nova.config using an import statement, use CONF.import_opt() so that it is clear which option we actually require. In future, we will move many options out of nova.config so many of these import_opt() calls will either go away or cause a module other than nova.config to be imported. Change-Id: I0646efddecdf2530903afd50c1f4364cb1d5dce1
* Remove nova.config.CONFMark McLoughlin2012-11-201-1/+2
| | | | | | | | | | | | | | | Modules import nova.config for two reasons right now - firstly, to reference nova.config.CONF and, secondly, if they use one of the options defined in nova.config. Often modules import nova.openstack.common.cfg and nova.config which is a bit pointless since they could just use cfg.CONF if they just want to nova.config in order to reference CONF. Let's just use cfg.CONF everywhere and we can explicitly state where we actually require options defined in nova.config. Change-Id: Ie4184a74e3e78c99658becb18dce1c2087e450bb
* Remove nova.flagsMark McLoughlin2012-11-171-1/+0
| | | | | | | | Now that options have all moved from nova.flags to nova.config, we can safely remove the nova.flags imports and replace them with nova.config imports. Change-Id: Ic077a72dd6419bbf1e1babe71acfa43c4e8b55c8
* Switch from FLAGS to CONF in misc modulesMark McLoughlin2012-11-041-2/+3
| | | | | | | | | | | Use the global CONF variable instead of FLAGS. This is purely a cleanup since FLAGS is already just another reference to CONF. We leave the nova.flags imports until a later cleanup commit since removing them may cause unpredictable problems due to config options not being registered. Change-Id: Ib110ba8d1837780e90b0d3fe13f8e6b68ed15f65
* Always use bdm in instance_block_mapping on XenClay Gerrard2012-10-041-1/+8
| | | | | | | | | | | | | | | | It doesn't seem that Xen will set the 'root_device_name' property on instances. This is causing instance_block_mapping to return early without evaluating the bdm before returning the list of device_names in use. I'm not sure why instance_block_mapping does this (optimization?) but on Xen at least it seems that it should not. Added a check for Xen compute_driver flag in instance_block_mapping to "guess" the root_device_name (similarlly to what is done in compute.utils for swap and ephemeral). fixes bug #1061944 Change-Id: If5b1a2b7377232c78f0629a3624552ecf6ceb0ee
* Automatically convert device namesVishvananda Ishaya2012-09-041-0/+8
| | | | | | | | | | | | | | | | In the past, users have been able to specify xvda or xvdb and it has worked. We are now validating device names against the expected name from the backend, and this causes confusion, especially for lxc which expecting device names to be /dev/a /dev/b /dev/c etc. This patch addresses the issue by automatically converting between different formats. The proper format for the backend will be returned by the api. Includes tests to verify that the conversion works and that the lxc values work as expected. Fixes bug 1046020 Change-Id: Iffa552ba05f89f70b6fb93043edf8882c8412215
* Allow nova to guess device if not passed to attachVishvananda Ishaya2012-08-151-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | partial fix for bug 1004328 Only the xen hypervisor actually respects the device name that is passed in attach_volume. For other hypervisors it makes much more sense to automatically generate a unique name. This patch generates a non-conflicting device name if one is not passed to attach_volume. It also validates the passed in volume name to make sure another device isn't already attached there. A corresponding change to novaclient and horizon will greatly improve the user experience of attaching a volume. It moves some common code out of metadata/base so that it can be used to get a list of block devices. The code was functionally tested as well and block device name generation works properly. This adds a new method to the rpcapi to validate a device name. It also adds server_id to the volumes extension, since it was omitted by mistake. The next step is to modify the libvirt driver to match the serial number of the device to the volume uuid so that the volume can always be found at /dev/disk/by-id/virtio-<uuid>. DocImpact Change-Id: I0b9454fc50a5c93b4aea38545dcee98f68d7e511
* EC2 DescribeImages reports correct rootDeviceTypeEoghan Glynn2012-07-171-1/+1
| | | | | | | | | | | | Fixes LP 1024354 A root device type of instance-store was incorrectly reported for boot-from-volume images (i.e. the analogue of EBS-backed AMIs). When comparing the block device mapping device name with the root device name, we now tolerate a missing leading '/dev/' path. Change-Id: I1d3bda780deee52f5d41e3af041aba7e6305dfde
* Boot from volume for XenRenuka Apte2012-07-091-0/+9
| | | | | | | | | | | | | Implements bp xenapi-boot-from-volume Ensure boot from volume works for XenAPI (tested using XenServer). 1. Add strip_prefix to block_device to make the command mountpoint agnostic. 2. Pass block device and delete on terminate information to driver layer. 3. Add ability to recognize and boot from the specified nova volume. Change-Id: If117087086eab809217d2b173f921bf9319a52c7
* Refactor metadata code out of ec2/cloud.pyVishvananda Ishaya2011-11-171-0/+3
| | | | | | part 2 of blueprint separate-nova-metadata Change-Id: Id41e48434ff3a38e524a1c64757a21bd461c06b8
* block_device: introduce helper function to check swap or ephemeral deviceIsaku Yamahata2011-07-231-0/+36
| | | | | and move generic function, mappings_prepend_dev() from ec2utils to block_device
* ec2utils: factor generic helper function into generic placeIsaku Yamahata2011-07-231-0/+35
This patch moves out a helper function, properties_root_device_name(), into generic file nova/block_device.py.