Skip to content

Commit

Permalink
Allow local_gb size to be 0. libvirt uses local_gb as a secondary dri…
Browse files Browse the repository at this point in the history
…ve, but XenServer uses it as the root partition's size. Now we support both.

Include some random PEP8 fixes.
  • Loading branch information
jk0 authored and Tarmac committed Aug 16, 2011
2 parents ef0e505 + 0610893 commit d9d9c8c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion nova/compute/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,13 @@ def _check_image_size():
instance_type = self.db.instance_type_get(context,
instance_type_id)
allowed_size_gb = instance_type['local_gb']

# NOTE(jk0): Since libvirt uses local_gb as a secondary drive, we
# need to handle potential situations where local_gb is 0. This is
# the default for m1.tiny.
if allowed_size_gb == 0:
return

allowed_size_bytes = allowed_size_gb * 1024 * 1024 * 1024

LOG.debug(_("image_id=%(image_id)d, image_size_bytes="
Expand Down Expand Up @@ -1369,7 +1376,7 @@ def pre_live_migration(self, context, instance_id, time=None,
# In addition, this method is creating filtering rule
# onto destination host.
self.driver.ensure_filtering_rules_for_instance(instance_ref,
network_info)
network_info)

# Preparation for block migration
if block_migration:
Expand Down
4 changes: 2 additions & 2 deletions nova/virt/libvirt/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1538,9 +1538,9 @@ def ensure_filtering_rules_for_instance(self, instance_ref, network_info,
# If any instances never launch at destination host,
# basic-filtering must be set here.
self.firewall_driver.setup_basic_filtering(instance_ref, network_info)
# setting up n)ova-instance-instance-xx mainly.
# setting up nova-instance-instance-xx mainly.
self.firewall_driver.prepare_instance_filter(instance_ref,
network_info)
network_info)

# wait for completion
timeout_count = range(FLAGS.live_migration_retry_count)
Expand Down

0 comments on commit d9d9c8c

Please sign in to comment.