diff options
32 files changed, 323 insertions, 240 deletions
diff --git a/doc/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json b/doc/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json index e5748a4cd..6e477722d 100644 --- a/doc/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json +++ b/doc/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json @@ -1,7 +1,7 @@ { "quota_class_set": { "cores": 20, - "fixed_ips": 10, + "fixed_ips": -1, "floating_ips": 10, "id": "test_class", "injected_file_content_bytes": 10240, @@ -14,4 +14,4 @@ "security_group_rules": 20, "security_groups": 10 } -}
\ No newline at end of file +} diff --git a/doc/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml b/doc/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml index 8e7444634..91929d34a 100644 --- a/doc/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml +++ b/doc/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='UTF-8'?> <quota_class_set id="test_class"> <cores>20</cores> - <fixed_ips>10</fixed_ips> + <fixed_ips>-1</fixed_ips> <floating_ips>10</floating_ips> <injected_file_content_bytes>10240</injected_file_content_bytes> <injected_file_path_bytes>255</injected_file_path_bytes> @@ -12,4 +12,4 @@ <ram>51200</ram> <security_group_rules>20</security_group_rules> <security_groups>10</security_groups> -</quota_class_set>
\ No newline at end of file +</quota_class_set> diff --git a/doc/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json b/doc/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json index 6325bb562..c86f86063 100644 --- a/doc/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json +++ b/doc/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json @@ -1,7 +1,7 @@ { "quota_class_set": { "cores": 50, - "fixed_ips": 10, + "fixed_ips": -1, "floating_ips": 10, "injected_file_content_bytes": 10240, "injected_file_path_bytes": 255, @@ -13,4 +13,4 @@ "security_group_rules": 20, "security_groups": 10 } -}
\ No newline at end of file +} diff --git a/doc/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml b/doc/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml index 26a29fc23..23eb5088c 100644 --- a/doc/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml +++ b/doc/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='UTF-8'?> <quota_class_set> <cores>50</cores> - <fixed_ips>10</fixed_ips> + <fixed_ips>-1</fixed_ips> <floating_ips>10</floating_ips> <injected_file_content_bytes>10240</injected_file_content_bytes> <injected_file_path_bytes>255</injected_file_path_bytes> @@ -12,4 +12,4 @@ <ram>51200</ram> <security_group_rules>20</security_group_rules> <security_groups>10</security_groups> -</quota_class_set>
\ No newline at end of file +</quota_class_set> diff --git a/doc/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json b/doc/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json index efc35cf00..239c64d23 100644 --- a/doc/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json +++ b/doc/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json @@ -1,7 +1,7 @@ { "quota_set": { "cores": 20, - "fixed_ips": 10, + "fixed_ips": -1, "floating_ips": 10, "id": "fake_tenant", "injected_file_content_bytes": 10240, @@ -14,4 +14,4 @@ "security_group_rules": 20, "security_groups": 10 } -}
\ No newline at end of file +} diff --git a/doc/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml b/doc/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml index dd4c6d66d..76a9292c1 100644 --- a/doc/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml +++ b/doc/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='UTF-8'?> <quota_set id="fake_tenant"> <cores>20</cores> - <fixed_ips>10</fixed_ips> + <fixed_ips>-1</fixed_ips> <floating_ips>10</floating_ips> <injected_file_content_bytes>10240</injected_file_content_bytes> <injected_file_path_bytes>255</injected_file_path_bytes> @@ -12,4 +12,4 @@ <ram>51200</ram> <security_group_rules>20</security_group_rules> <security_groups>10</security_groups> -</quota_set>
\ No newline at end of file +</quota_set> diff --git a/doc/api_samples/os-quota-sets/quotas-show-get-resp.json b/doc/api_samples/os-quota-sets/quotas-show-get-resp.json index efc35cf00..239c64d23 100644 --- a/doc/api_samples/os-quota-sets/quotas-show-get-resp.json +++ b/doc/api_samples/os-quota-sets/quotas-show-get-resp.json @@ -1,7 +1,7 @@ { "quota_set": { "cores": 20, - "fixed_ips": 10, + "fixed_ips": -1, "floating_ips": 10, "id": "fake_tenant", "injected_file_content_bytes": 10240, @@ -14,4 +14,4 @@ "security_group_rules": 20, "security_groups": 10 } -}
\ No newline at end of file +} diff --git a/doc/api_samples/os-quota-sets/quotas-show-get-resp.xml b/doc/api_samples/os-quota-sets/quotas-show-get-resp.xml index dd4c6d66d..76a9292c1 100644 --- a/doc/api_samples/os-quota-sets/quotas-show-get-resp.xml +++ b/doc/api_samples/os-quota-sets/quotas-show-get-resp.xml @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='UTF-8'?> <quota_set id="fake_tenant"> <cores>20</cores> - <fixed_ips>10</fixed_ips> + <fixed_ips>-1</fixed_ips> <floating_ips>10</floating_ips> <injected_file_content_bytes>10240</injected_file_content_bytes> <injected_file_path_bytes>255</injected_file_path_bytes> @@ -12,4 +12,4 @@ <ram>51200</ram> <security_group_rules>20</security_group_rules> <security_groups>10</security_groups> -</quota_set>
\ No newline at end of file +</quota_set> diff --git a/doc/api_samples/os-quota-sets/quotas-update-post-resp.json b/doc/api_samples/os-quota-sets/quotas-update-post-resp.json index 14324e365..2be76d472 100644 --- a/doc/api_samples/os-quota-sets/quotas-update-post-resp.json +++ b/doc/api_samples/os-quota-sets/quotas-update-post-resp.json @@ -1,7 +1,7 @@ { "quota_set": { "cores": 20, - "fixed_ips": 10, + "fixed_ips": -1, "floating_ips": 10, "injected_file_content_bytes": 10240, "injected_file_path_bytes": 255, @@ -13,4 +13,4 @@ "security_group_rules": 20, "security_groups": 45 } -}
\ No newline at end of file +} diff --git a/doc/api_samples/os-quota-sets/quotas-update-post-resp.xml b/doc/api_samples/os-quota-sets/quotas-update-post-resp.xml index 5e6bb893e..e03a0bf5e 100644 --- a/doc/api_samples/os-quota-sets/quotas-update-post-resp.xml +++ b/doc/api_samples/os-quota-sets/quotas-update-post-resp.xml @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='UTF-8'?> <quota_set> <cores>20</cores> - <fixed_ips>10</fixed_ips> + <fixed_ips>-1</fixed_ips> <floating_ips>10</floating_ips> <injected_file_content_bytes>10240</injected_file_content_bytes> <injected_file_path_bytes>255</injected_file_path_bytes> @@ -12,4 +12,4 @@ <ram>51200</ram> <security_group_rules>20</security_group_rules> <security_groups>45</security_groups> -</quota_set>
\ No newline at end of file +</quota_set> diff --git a/nova/api/openstack/compute/contrib/simple_tenant_usage.py b/nova/api/openstack/compute/contrib/simple_tenant_usage.py index 0428c8a77..b653564c0 100644 --- a/nova/api/openstack/compute/contrib/simple_tenant_usage.py +++ b/nova/api/openstack/compute/contrib/simple_tenant_usage.py @@ -106,7 +106,7 @@ class SimpleTenantUsageController(object): def _get_flavor(self, context, compute_api, instance, flavors_cache): """Get flavor information from the instance's system_metadata, - allowing a fallback to lookup by-id for deleted instances only""" + allowing a fallback to lookup by-id for deleted instances only.""" try: return instance_types.extract_instance_type(instance) except KeyError: diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 6cb0bbb94..97e005de7 100755 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -744,6 +744,21 @@ class ComputeManager(manager.SchedulerDependentManager): return block_device_info + def _decode_files(self, injected_files): + """Base64 decode the list of files to inject.""" + if not injected_files: + return [] + + def _decode(f): + path, contents = f + try: + decoded = base64.b64decode(contents) + return path, decoded + except TypeError: + raise exception.Base64Exception(path=path) + + return [_decode(f) for f in injected_files] + def _run_instance(self, context, request_spec, filter_properties, requested_networks, injected_files, admin_password, is_first_time, node, instance): @@ -788,6 +803,10 @@ class ComputeManager(manager.SchedulerDependentManager): bdms = self.conductor_api.block_device_mapping_get_all_by_instance( context, instance) + # b64 decode the files to inject: + injected_files_orig = injected_files + injected_files = self._decode_files(injected_files) + rt = self._get_resource_tracker(node) try: limits = filter_properties.get('limits', {}) @@ -833,8 +852,9 @@ class ComputeManager(manager.SchedulerDependentManager): exc_info = sys.exc_info() # try to re-schedule instance: self._reschedule_or_reraise(context, instance, exc_info, - requested_networks, admin_password, injected_files, - is_first_time, request_spec, filter_properties, bdms) + requested_networks, admin_password, + injected_files_orig, is_first_time, request_spec, + filter_properties, bdms) else: # Spawn success: self._notify_about_instance_usage(context, instance, @@ -1067,6 +1087,7 @@ class ComputeManager(manager.SchedulerDependentManager): injected_files, admin_password, self._legacy_nw_info(network_info), block_device_info) + except Exception: with excutils.save_and_reraise_exception(): LOG.exception(_('Instance failed to spawn'), instance=instance) @@ -1180,11 +1201,6 @@ class ComputeManager(manager.SchedulerDependentManager): if filter_properties is None: filter_properties = {} - if injected_files is None: - injected_files = [] - else: - injected_files = [(path, base64.b64decode(contents)) - for path, contents in injected_files] @lockutils.synchronized(instance['uuid'], 'nova-') def do_run_instance(): diff --git a/nova/exception.py b/nova/exception.py index 1f32b0671..43f02b7cb 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -1200,3 +1200,7 @@ class UnsupportedVirtType(Invalid): class UnsupportedHardware(Invalid): message = _("Requested hardware '%(model)s' is not supported by " "the '%(virt)s' virt driver") + + +class Base64Exception(NovaException): + message = _("Invalid Base 64 data for file %(path)s") diff --git a/nova/locale/nova.pot b/nova/locale/nova.pot index c2e0ef6c5..8593e89a3 100644 --- a/nova/locale/nova.pot +++ b/nova/locale/nova.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: nova jenkins.nova.propose.translation.update.200\n" +"Project-Id-Version: nova jenkins.nova.propose.translation.update.201\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2013-03-28 00:03+0000\n" +"POT-Creation-Date: 2013-03-29 00:03+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -1292,27 +1292,27 @@ msgstr "" msgid "Running %(name)s post-hook: %(obj)s" msgstr "" -#: nova/manager.py:171 +#: nova/manager.py:172 #, python-format msgid "Skipping periodic task %(task)s because its interval is negative" msgstr "" -#: nova/manager.py:176 +#: nova/manager.py:177 #, python-format msgid "Skipping periodic task %(task)s because it is disabled" msgstr "" -#: nova/manager.py:237 +#: nova/manager.py:238 #, python-format msgid "Running periodic task %(full_task_name)s" msgstr "" -#: nova/manager.py:245 +#: nova/manager.py:246 #, python-format msgid "Error during %(full_task_name)s: %(e)s" msgstr "" -#: nova/manager.py:318 +#: nova/manager.py:315 msgid "Notifying Schedulers of capabilities ..." msgstr "" @@ -3232,7 +3232,7 @@ msgstr "" msgid "stop instance" msgstr "" -#: nova/api/openstack/compute/contrib/simple_tenant_usage.py:199 +#: nova/api/openstack/compute/contrib/simple_tenant_usage.py:226 msgid "Invalid start time. The start time cannot occur after the end time." msgstr "" @@ -4845,123 +4845,123 @@ msgstr "" msgid "This shouldn't be getting called except during testing." msgstr "" -#: nova/network/linux_net.py:215 +#: nova/network/linux_net.py:219 #, python-format msgid "Attempted to remove chain %s which does not exist" msgstr "" -#: nova/network/linux_net.py:250 +#: nova/network/linux_net.py:254 #, python-format msgid "Unknown chain: %r" msgstr "" -#: nova/network/linux_net.py:275 +#: nova/network/linux_net.py:279 #, python-format msgid "" "Tried to remove rule that was not there: %(chain)r %(rule)r %(wrap)r " "%(top)r" msgstr "" -#: nova/network/linux_net.py:420 +#: nova/network/linux_net.py:424 msgid "IPTablesManager.apply completed with success" msgstr "" -#: nova/network/linux_net.py:676 +#: nova/network/linux_net.py:680 #, python-format msgid "arping error for ip %s" msgstr "" -#: nova/network/linux_net.py:726 +#: nova/network/linux_net.py:730 #, python-format msgid "Removed %(num)d duplicate rules for floating ip %(float)s" msgstr "" -#: nova/network/linux_net.py:962 +#: nova/network/linux_net.py:966 #, python-format msgid "Pid %d is stale, skip killing dnsmasq" msgstr "" -#: nova/network/linux_net.py:1007 +#: nova/network/linux_net.py:1011 #, python-format msgid "Hupping dnsmasq threw %s" msgstr "" -#: nova/network/linux_net.py:1009 +#: nova/network/linux_net.py:1013 #, python-format msgid "Pid %d is stale, relaunching dnsmasq" msgstr "" -#: nova/network/linux_net.py:1084 +#: nova/network/linux_net.py:1089 #, python-format msgid "killing radvd threw %s" msgstr "" -#: nova/network/linux_net.py:1086 +#: nova/network/linux_net.py:1091 #, python-format msgid "Pid %d is stale, relaunching radvd" msgstr "" -#: nova/network/linux_net.py:1218 +#: nova/network/linux_net.py:1223 #, python-format msgid "Error clearing stale veth %s" msgstr "" -#: nova/network/linux_net.py:1377 +#: nova/network/linux_net.py:1382 #, python-format msgid "Starting VLAN interface %s" msgstr "" -#: nova/network/linux_net.py:1409 +#: nova/network/linux_net.py:1414 #, python-format msgid "Failed unplugging VLAN interface '%s'" msgstr "" -#: nova/network/linux_net.py:1411 +#: nova/network/linux_net.py:1416 #, python-format msgid "Unplugged VLAN interface '%s'" msgstr "" -#: nova/network/linux_net.py:1433 +#: nova/network/linux_net.py:1438 #, python-format msgid "Starting Bridge %s" msgstr "" -#: nova/network/linux_net.py:1445 +#: nova/network/linux_net.py:1450 #, python-format msgid "Adding interface %(interface)s to bridge %(bridge)s" msgstr "" -#: nova/network/linux_net.py:1481 +#: nova/network/linux_net.py:1486 #, python-format msgid "Failed to add interface: %s" msgstr "" -#: nova/network/linux_net.py:1518 +#: nova/network/linux_net.py:1529 #, python-format msgid "Failed unplugging bridge interface '%s'" msgstr "" -#: nova/network/linux_net.py:1521 +#: nova/network/linux_net.py:1532 #, python-format msgid "Unplugged bridge interface '%s'" msgstr "" -#: nova/network/linux_net.py:1690 +#: nova/network/linux_net.py:1721 #, python-format msgid "Starting bridge %s " msgstr "" -#: nova/network/linux_net.py:1698 +#: nova/network/linux_net.py:1729 #, python-format msgid "Done starting bridge %s" msgstr "" -#: nova/network/linux_net.py:1718 +#: nova/network/linux_net.py:1749 #, python-format msgid "Failed unplugging gateway interface '%s'" msgstr "" -#: nova/network/linux_net.py:1720 +#: nova/network/linux_net.py:1751 #, python-format msgid "Unplugged gateway interface '%s'" msgstr "" @@ -5152,49 +5152,49 @@ msgstr "" msgid "Fail to delete port %(portid)s with failure: %(exception)s" msgstr "" -#: nova/network/quantumv2/api.py:314 +#: nova/network/quantumv2/api.py:315 #, python-format msgid "deallocate_for_instance() for %s" msgstr "" -#: nova/network/quantumv2/api.py:323 +#: nova/network/quantumv2/api.py:324 #, python-format msgid "Failed to delete quantum port %(portid)s " msgstr "" -#: nova/network/quantumv2/api.py:342 +#: nova/network/quantumv2/api.py:343 #, python-format msgid "Failed to delete quantum port %(port_id)s " msgstr "" -#: nova/network/quantumv2/api.py:364 +#: nova/network/quantumv2/api.py:365 #, python-format msgid "get_instance_nw_info() for %s" msgstr "" -#: nova/network/quantumv2/api.py:396 +#: nova/network/quantumv2/api.py:397 #, python-format msgid "" "Unable to update port %(portid)s on subnet %(subnet_id)s with failure: " "%(exception)s" msgstr "" -#: nova/network/quantumv2/api.py:426 +#: nova/network/quantumv2/api.py:427 #, python-format msgid "Unable to update port %(portid)s with failure: %(exception)s" msgstr "" -#: nova/network/quantumv2/api.py:436 +#: nova/network/quantumv2/api.py:437 #, python-format msgid "validate_networks() for %s" msgstr "" -#: nova/network/quantumv2/api.py:693 +#: nova/network/quantumv2/api.py:694 #, python-format msgid "Multiple floating IP pools matches found for name '%s'" msgstr "" -#: nova/network/quantumv2/api.py:798 +#: nova/network/quantumv2/api.py:799 #, python-format msgid "Network %(net)s for port %(port_id)s not found!" msgstr "" @@ -6263,12 +6263,12 @@ msgstr "" msgid "uuid" msgstr "" -#: nova/tests/test_xenapi.py:884 +#: nova/tests/test_xenapi.py:897 #, python-format msgid "Creating files in %s to simulate guest agent" msgstr "" -#: nova/tests/test_xenapi.py:895 +#: nova/tests/test_xenapi.py:908 #, python-format msgid "Removing simulated guest agent files in %s" msgstr "" @@ -9215,7 +9215,7 @@ msgstr "" msgid "Migrated VM to host %s" msgstr "" -#: nova/virt/vmwareapi/vmops.py:1050 nova/virt/xenapi/vmops.py:1316 +#: nova/virt/vmwareapi/vmops.py:1050 nova/virt/xenapi/vmops.py:1324 #, python-format msgid "Found %(instance_count)d hung reboots older than %(timeout)d seconds" msgstr "" @@ -9373,19 +9373,19 @@ msgstr "" msgid "Mountpoint %(mountpoint)s detached from instance %(instance_name)s" msgstr "" -#: nova/virt/xenapi/agent.py:88 nova/virt/xenapi/vmops.py:1556 +#: nova/virt/xenapi/agent.py:88 nova/virt/xenapi/vmops.py:1564 #, python-format msgid "TIMEOUT: The call to %(method)s timed out. args=%(args)r" msgstr "" -#: nova/virt/xenapi/agent.py:92 nova/virt/xenapi/vmops.py:1560 +#: nova/virt/xenapi/agent.py:92 nova/virt/xenapi/vmops.py:1568 #, python-format msgid "" "NOT IMPLEMENTED: The call to %(method)s is not supported by the agent. " "args=%(args)r" msgstr "" -#: nova/virt/xenapi/agent.py:97 nova/virt/xenapi/vmops.py:1565 +#: nova/virt/xenapi/agent.py:97 nova/virt/xenapi/vmops.py:1573 #, python-format msgid "The call to %(method)s returned an error: %(e)s. args=%(args)r" msgstr "" @@ -9511,32 +9511,32 @@ msgstr "" msgid "Got exception: %s" msgstr "" -#: nova/virt/xenapi/fake.py:680 nova/virt/xenapi/fake.py:784 -#: nova/virt/xenapi/fake.py:803 nova/virt/xenapi/fake.py:871 +#: nova/virt/xenapi/fake.py:687 nova/virt/xenapi/fake.py:791 +#: nova/virt/xenapi/fake.py:810 nova/virt/xenapi/fake.py:878 msgid "Raising NotImplemented" msgstr "" -#: nova/virt/xenapi/fake.py:682 +#: nova/virt/xenapi/fake.py:689 #, python-format msgid "xenapi.fake does not have an implementation for %s" msgstr "" -#: nova/virt/xenapi/fake.py:716 +#: nova/virt/xenapi/fake.py:723 #, python-format msgid "Calling %(localname)s %(impl)s" msgstr "" -#: nova/virt/xenapi/fake.py:721 +#: nova/virt/xenapi/fake.py:728 #, python-format msgid "Calling getter %s" msgstr "" -#: nova/virt/xenapi/fake.py:724 +#: nova/virt/xenapi/fake.py:731 #, python-format msgid "Calling setter %s" msgstr "" -#: nova/virt/xenapi/fake.py:786 +#: nova/virt/xenapi/fake.py:793 #, python-format msgid "" "xenapi.fake does not have an implementation for %s or it has been called " @@ -9698,324 +9698,324 @@ msgstr "" msgid "Unable to destroy VBD %s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:405 +#: nova/virt/xenapi/vm_utils.py:408 #, python-format msgid "Creating %(vbd_type)s-type VBD for VM %(vm_ref)s, VDI %(vdi_ref)s ... " msgstr "" -#: nova/virt/xenapi/vm_utils.py:408 +#: nova/virt/xenapi/vm_utils.py:411 #, python-format msgid "Created VBD %(vbd_ref)s for VM %(vm_ref)s, VDI %(vdi_ref)s." msgstr "" -#: nova/virt/xenapi/vm_utils.py:424 +#: nova/virt/xenapi/vm_utils.py:437 #, python-format msgid "Unable to destroy VDI %s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:456 +#: nova/virt/xenapi/vm_utils.py:469 #, python-format msgid "" "Created VDI %(vdi_ref)s (%(name_label)s, %(virtual_size)s, %(read_only)s)" " on %(sr_ref)s." msgstr "" -#: nova/virt/xenapi/vm_utils.py:470 +#: nova/virt/xenapi/vm_utils.py:483 msgid "SR not present and could not be introduced" msgstr "" -#: nova/virt/xenapi/vm_utils.py:495 +#: nova/virt/xenapi/vm_utils.py:508 #, python-format msgid "block device info: %s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:581 +#: nova/virt/xenapi/vm_utils.py:594 #, python-format msgid "Cloned VDI %(vdi_ref)s from VDI %(vdi_to_clone_ref)s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:601 +#: nova/virt/xenapi/vm_utils.py:614 #, python-format msgid "No primary VDI found for %(vm_ref)s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:614 +#: nova/virt/xenapi/vm_utils.py:627 msgid "Starting snapshot for VM" msgstr "" -#: nova/virt/xenapi/vm_utils.py:664 +#: nova/virt/xenapi/vm_utils.py:677 #, python-format msgid "Destroying cached VDI '%(vdi_uuid)s'" msgstr "" -#: nova/virt/xenapi/vm_utils.py:911 +#: nova/virt/xenapi/vm_utils.py:930 #, python-format msgid "" "Fast cloning is only supported on default local SR of type ext. SR on " "this system was found to be of type %(sr_type)s. Ignoring the cow flag." msgstr "" -#: nova/virt/xenapi/vm_utils.py:967 +#: nova/virt/xenapi/vm_utils.py:986 #, python-format msgid "Unrecognized cache_images value '%s', defaulting to True" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1001 +#: nova/virt/xenapi/vm_utils.py:1020 #, python-format msgid "Fetched VDIs of type '%(vdi_type)s' with UUID '%(vdi_uuid)s'" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1013 +#: nova/virt/xenapi/vm_utils.py:1032 #, python-format msgid "" "download_vhd %(image_id)s, attempt %(attempt_num)d/%(max_attempts)d, " "params: %(params)s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1026 +#: nova/virt/xenapi/vm_utils.py:1045 #, python-format msgid "download_vhd failed: %r" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1060 +#: nova/virt/xenapi/vm_utils.py:1079 #, python-format msgid "Invalid value '%s' for xenapi_torrent_images" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1071 +#: nova/virt/xenapi/vm_utils.py:1090 #, python-format msgid "Asking xapi to fetch vhd image %(image_id)s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1135 +#: nova/virt/xenapi/vm_utils.py:1154 #, python-format msgid "vdi_uuid=%(cur_vdi_uuid)s vdi_size_bytes=%(vdi_size_bytes)d" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1150 +#: nova/virt/xenapi/vm_utils.py:1169 #, python-format msgid "image_size_bytes=%(size_bytes)d, allowed_size_bytes=%(allowed_size_bytes)d" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1154 +#: nova/virt/xenapi/vm_utils.py:1173 #, python-format msgid "" "Image size %(size_bytes)d exceeded instance_type allowed size " "%(allowed_size_bytes)d" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1176 +#: nova/virt/xenapi/vm_utils.py:1195 #, python-format msgid "Fetching image %(image_id)s, type %(image_type_str)s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1189 +#: nova/virt/xenapi/vm_utils.py:1208 #, python-format msgid "Size for image %(image_id)s: %(virtual_size)d" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1198 +#: nova/virt/xenapi/vm_utils.py:1217 #, python-format msgid "" "Kernel/Ramdisk image is too large: %(vdi_size)d bytes, max %(max_size)d " "bytes" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1217 +#: nova/virt/xenapi/vm_utils.py:1236 #, python-format msgid "Copying VDI %s to /boot/guest on dom0" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1231 +#: nova/virt/xenapi/vm_utils.py:1250 #, python-format msgid "Kernel/Ramdisk VDI %s destroyed" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1240 +#: nova/virt/xenapi/vm_utils.py:1259 msgid "Failed to fetch glance image" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1281 +#: nova/virt/xenapi/vm_utils.py:1300 #, python-format msgid "Detected %(image_type_str)s format for image %(image_ref)s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1312 +#: nova/virt/xenapi/vm_utils.py:1331 #, python-format msgid "Looking up vdi %s for PV kernel" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1330 +#: nova/virt/xenapi/vm_utils.py:1349 #, python-format msgid "" "Image format is None: trying to determine PV status using pygrub; if " "instance with vdi %s does not boot correctly, try with image metadata." msgstr "" -#: nova/virt/xenapi/vm_utils.py:1336 +#: nova/virt/xenapi/vm_utils.py:1355 #, python-format msgid "Unknown image format %(disk_image_type)s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1367 +#: nova/virt/xenapi/vm_utils.py:1386 #, python-format msgid "VDI %s is still available" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1463 +#: nova/virt/xenapi/vm_utils.py:1482 #, python-format msgid "Unable to parse rrd of %(vm_uuid)s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1490 +#: nova/virt/xenapi/vm_utils.py:1509 #, python-format msgid "Re-scanning SR %s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1518 +#: nova/virt/xenapi/vm_utils.py:1537 #, python-format msgid "Flag sr_matching_filter '%s' does not respect formatting convention" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1536 +#: nova/virt/xenapi/vm_utils.py:1555 msgid "" "XenAPI is unable to find a Storage Repository to install guest instances " "on. Please check your configuration and/or configure the flag " "'sr_matching_filter'" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1549 +#: nova/virt/xenapi/vm_utils.py:1568 msgid "Cannot find SR of content-type ISO" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1557 +#: nova/virt/xenapi/vm_utils.py:1576 #, python-format msgid "ISO: looking at SR %(sr_rec)s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1559 +#: nova/virt/xenapi/vm_utils.py:1578 msgid "ISO: not iso content" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1562 +#: nova/virt/xenapi/vm_utils.py:1581 msgid "ISO: iso content_type, no 'i18n-key' key" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1565 +#: nova/virt/xenapi/vm_utils.py:1584 msgid "ISO: iso content_type, i18n-key value not 'local-storage-iso'" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1569 +#: nova/virt/xenapi/vm_utils.py:1588 msgid "ISO: SR MATCHing our criteria" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1571 +#: nova/virt/xenapi/vm_utils.py:1590 msgid "ISO: ISO, looking to see if it is host local" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1574 +#: nova/virt/xenapi/vm_utils.py:1593 #, python-format msgid "ISO: PBD %(pbd_ref)s disappeared" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1577 +#: nova/virt/xenapi/vm_utils.py:1596 #, python-format msgid "ISO: PBD matching, want %(pbd_rec)s, have %(host)s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1580 +#: nova/virt/xenapi/vm_utils.py:1599 msgid "ISO: SR with local PBD" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1602 +#: nova/virt/xenapi/vm_utils.py:1621 #, python-format msgid "" "Unable to obtain RRD XML for VM %(vm_uuid)s with server details: " "%(server)s." msgstr "" -#: nova/virt/xenapi/vm_utils.py:1618 +#: nova/virt/xenapi/vm_utils.py:1637 #, python-format msgid "Unable to obtain RRD XML updates with server details: %(server)s." msgstr "" -#: nova/virt/xenapi/vm_utils.py:1672 +#: nova/virt/xenapi/vm_utils.py:1691 #, python-format msgid "Invalid statistics data from Xenserver: %s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1732 +#: nova/virt/xenapi/vm_utils.py:1751 #, python-format msgid "VHD %(vdi_uuid)s has parent %(parent_uuid)s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1819 +#: nova/virt/xenapi/vm_utils.py:1838 #, python-format msgid "" "Parent %(parent_uuid)s doesn't match original parent " "%(original_parent_uuid)s, waiting for coalesce..." msgstr "" -#: nova/virt/xenapi/vm_utils.py:1829 +#: nova/virt/xenapi/vm_utils.py:1848 #, python-format msgid "VHD coalesce attempts exceeded (%(max_attempts)d), giving up..." msgstr "" -#: nova/virt/xenapi/vm_utils.py:1864 +#: nova/virt/xenapi/vm_utils.py:1883 #, python-format msgid "Timeout waiting for device %s to be created" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1884 +#: nova/virt/xenapi/vm_utils.py:1903 #, python-format msgid "Disconnecting stale VDI %s from compute domU" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1897 +#: nova/virt/xenapi/vm_utils.py:1916 #, python-format msgid "Plugging VBD %s ... " msgstr "" -#: nova/virt/xenapi/vm_utils.py:1900 +#: nova/virt/xenapi/vm_utils.py:1919 #, python-format msgid "Plugging VBD %s done." msgstr "" -#: nova/virt/xenapi/vm_utils.py:1902 +#: nova/virt/xenapi/vm_utils.py:1921 #, python-format msgid "VBD %(vbd_ref)s plugged as %(orig_dev)s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1905 +#: nova/virt/xenapi/vm_utils.py:1924 #, python-format msgid "VBD %(vbd_ref)s plugged into wrong dev, remapping to %(dev)s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1910 +#: nova/virt/xenapi/vm_utils.py:1929 #, python-format msgid "Destroying VBD for VDI %s ... " msgstr "" -#: nova/virt/xenapi/vm_utils.py:1918 +#: nova/virt/xenapi/vm_utils.py:1937 #, python-format msgid "Destroying VBD for VDI %s done." msgstr "" -#: nova/virt/xenapi/vm_utils.py:1945 +#: nova/virt/xenapi/vm_utils.py:1964 #, python-format msgid "Running pygrub against %s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1953 +#: nova/virt/xenapi/vm_utils.py:1972 #, python-format msgid "Found Xen kernel %s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1955 +#: nova/virt/xenapi/vm_utils.py:1974 msgid "No Xen kernel found. Booting HVM." msgstr "" -#: nova/virt/xenapi/vm_utils.py:1957 +#: nova/virt/xenapi/vm_utils.py:1976 msgid "" "Error while executing pygrub! Please, ensure the binary is installed " "correctly, and available in your PATH; on some Linux distros, pygrub may " @@ -10023,251 +10023,247 @@ msgid "" "mode." msgstr "" -#: nova/virt/xenapi/vm_utils.py:1974 +#: nova/virt/xenapi/vm_utils.py:1993 msgid "Partitions:" msgstr "" -#: nova/virt/xenapi/vm_utils.py:1980 +#: nova/virt/xenapi/vm_utils.py:1999 #, python-format msgid " %(num)s: %(ptype)s %(size)d sectors" msgstr "" -#: nova/virt/xenapi/vm_utils.py:2005 +#: nova/virt/xenapi/vm_utils.py:2024 #, python-format msgid "" "Writing partition table %(primary_first)d %(primary_last)d to " "%(dev_path)s..." msgstr "" -#: nova/virt/xenapi/vm_utils.py:2018 +#: nova/virt/xenapi/vm_utils.py:2037 #, python-format msgid "Writing partition table %s done." msgstr "" -#: nova/virt/xenapi/vm_utils.py:2072 +#: nova/virt/xenapi/vm_utils.py:2091 #, python-format msgid "" "Starting sparse_copy src=%(src_path)s dst=%(dst_path)s " "virtual_size=%(virtual_size)d block_size=%(block_size)d" msgstr "" -#: nova/virt/xenapi/vm_utils.py:2105 +#: nova/virt/xenapi/vm_utils.py:2124 #, python-format msgid "" "Finished sparse_copy in %(duration).2f secs, %(compression_pct).2f%% " "reduction in size" msgstr "" -#: nova/virt/xenapi/vm_utils.py:2157 +#: nova/virt/xenapi/vm_utils.py:2176 msgid "Manipulating interface files directly" msgstr "" -#: nova/virt/xenapi/vm_utils.py:2166 +#: nova/virt/xenapi/vm_utils.py:2185 #, python-format msgid "Failed to mount filesystem (expected for non-linux instances): %s" msgstr "" -#: nova/virt/xenapi/vm_utils.py:2278 +#: nova/virt/xenapi/vm_utils.py:2297 msgid "This domU must be running on the host specified by xenapi_connection_url" msgstr "" -#: nova/virt/xenapi/vmops.py:134 nova/virt/xenapi/vmops.py:784 +#: nova/virt/xenapi/vmops.py:139 nova/virt/xenapi/vmops.py:792 #, python-format msgid "Updating progress to %(progress)d" msgstr "" -#: nova/virt/xenapi/vmops.py:169 +#: nova/virt/xenapi/vmops.py:174 #, python-format msgid "Importing image upload handler: %s" msgstr "" -#: nova/virt/xenapi/vmops.py:182 +#: nova/virt/xenapi/vmops.py:187 msgid "Error: Agent is disabled" msgstr "" -#: nova/virt/xenapi/vmops.py:290 +#: nova/virt/xenapi/vmops.py:295 msgid "Starting instance" msgstr "" -#: nova/virt/xenapi/vmops.py:376 +#: nova/virt/xenapi/vmops.py:381 msgid "Removing kernel/ramdisk files from dom0" msgstr "" -#: nova/virt/xenapi/vmops.py:449 +#: nova/virt/xenapi/vmops.py:454 #, python-format msgid "Block device information present: %s" msgstr "" -#: nova/virt/xenapi/vmops.py:480 +#: nova/virt/xenapi/vmops.py:485 msgid "Failed to spawn, rolling back" msgstr "" -#: nova/virt/xenapi/vmops.py:559 -msgid "Detected ISO image type, creating blank VM for install" -msgstr "" - -#: nova/virt/xenapi/vmops.py:576 +#: nova/virt/xenapi/vmops.py:584 msgid "Auto configuring disk, attempting to resize partition..." msgstr "" -#: nova/virt/xenapi/vmops.py:622 +#: nova/virt/xenapi/vmops.py:630 msgid "Starting VM" msgstr "" -#: nova/virt/xenapi/vmops.py:628 +#: nova/virt/xenapi/vmops.py:636 msgid "Waiting for instance state to become running" msgstr "" -#: nova/virt/xenapi/vmops.py:642 +#: nova/virt/xenapi/vmops.py:650 #, python-format msgid "" "Latest agent build for %(hypervisor)s/%(os)s/%(architecture)s is " "%(version)s" msgstr "" -#: nova/virt/xenapi/vmops.py:645 +#: nova/virt/xenapi/vmops.py:653 #, python-format msgid "No agent build found for %(hypervisor)s/%(os)s/%(architecture)s" msgstr "" -#: nova/virt/xenapi/vmops.py:656 +#: nova/virt/xenapi/vmops.py:664 #, python-format msgid "Instance agent version: %s" msgstr "" -#: nova/virt/xenapi/vmops.py:687 +#: nova/virt/xenapi/vmops.py:695 msgid "Setting VCPU weight" msgstr "" -#: nova/virt/xenapi/vmops.py:695 +#: nova/virt/xenapi/vmops.py:703 #, python-format msgid "Could not find VM with name %s" msgstr "" -#: nova/virt/xenapi/vmops.py:753 +#: nova/virt/xenapi/vmops.py:761 msgid "Finished snapshot and upload for VM" msgstr "" -#: nova/virt/xenapi/vmops.py:757 +#: nova/virt/xenapi/vmops.py:765 #, python-format msgid "Migrating VHD '%(vdi_uuid)s' with seq_num %(seq_num)d" msgstr "" -#: nova/virt/xenapi/vmops.py:765 +#: nova/virt/xenapi/vmops.py:773 msgid "Failed to transfer vhd to new host" msgstr "" -#: nova/virt/xenapi/vmops.py:802 +#: nova/virt/xenapi/vmops.py:810 #, python-format msgid "Resizing down VDI %(vdi_uuid)s from %(old_gb)dGB to %(new_gb)dGB" msgstr "" -#: nova/virt/xenapi/vmops.py:808 nova/virt/xenapi/vmops.py:858 +#: nova/virt/xenapi/vmops.py:816 nova/virt/xenapi/vmops.py:866 msgid "Clean shutdown did not complete successfully, trying hard shutdown." msgstr "" -#: nova/virt/xenapi/vmops.py:887 +#: nova/virt/xenapi/vmops.py:895 msgid "Resize down not allowed without auto_disk_config" msgstr "" -#: nova/virt/xenapi/vmops.py:932 +#: nova/virt/xenapi/vmops.py:940 #, python-format msgid "Resizing up VDI %(vdi_uuid)s from %(old_gb)dGB to %(new_gb)dGB" msgstr "" -#: nova/virt/xenapi/vmops.py:937 +#: nova/virt/xenapi/vmops.py:945 msgid "Resize complete" msgstr "" -#: nova/virt/xenapi/vmops.py:981 +#: nova/virt/xenapi/vmops.py:989 msgid "Starting halted instance found during reboot" msgstr "" -#: nova/virt/xenapi/vmops.py:987 +#: nova/virt/xenapi/vmops.py:995 msgid "" "Reboot failed due to bad volumes, detaching bad volumes and starting " "halted instance" msgstr "" -#: nova/virt/xenapi/vmops.py:1081 +#: nova/virt/xenapi/vmops.py:1089 msgid "Unable to find root VBD/VDI for VM" msgstr "" -#: nova/virt/xenapi/vmops.py:1085 +#: nova/virt/xenapi/vmops.py:1093 msgid "Destroying VDIs" msgstr "" -#: nova/virt/xenapi/vmops.py:1112 +#: nova/virt/xenapi/vmops.py:1120 msgid "Using RAW or VHD, skipping kernel and ramdisk deletion" msgstr "" -#: nova/virt/xenapi/vmops.py:1119 +#: nova/virt/xenapi/vmops.py:1127 msgid "instance has a kernel or ramdisk but not both" msgstr "" -#: nova/virt/xenapi/vmops.py:1126 +#: nova/virt/xenapi/vmops.py:1134 msgid "kernel/ramdisk files removed" msgstr "" -#: nova/virt/xenapi/vmops.py:1153 +#: nova/virt/xenapi/vmops.py:1161 msgid "Destroying VM" msgstr "" -#: nova/virt/xenapi/vmops.py:1182 +#: nova/virt/xenapi/vmops.py:1190 msgid "VM is not present, skipping destroy..." msgstr "" -#: nova/virt/xenapi/vmops.py:1233 +#: nova/virt/xenapi/vmops.py:1241 #, python-format msgid "Instance is already in Rescue Mode: %s" msgstr "" -#: nova/virt/xenapi/vmops.py:1267 +#: nova/virt/xenapi/vmops.py:1275 msgid "VM is not present, skipping soft delete..." msgstr "" -#: nova/virt/xenapi/vmops.py:1320 +#: nova/virt/xenapi/vmops.py:1328 msgid "Automatically hard rebooting" msgstr "" -#: nova/virt/xenapi/vmops.py:1460 +#: nova/virt/xenapi/vmops.py:1468 msgid "Injecting network info to xenstore" msgstr "" -#: nova/virt/xenapi/vmops.py:1479 +#: nova/virt/xenapi/vmops.py:1487 msgid "Creating vifs" msgstr "" -#: nova/virt/xenapi/vmops.py:1488 +#: nova/virt/xenapi/vmops.py:1496 #, python-format msgid "Creating VIF for network %(network_ref)s" msgstr "" -#: nova/virt/xenapi/vmops.py:1491 +#: nova/virt/xenapi/vmops.py:1499 #, python-format msgid "Created VIF %(vif_ref)s, network %(network_ref)s" msgstr "" -#: nova/virt/xenapi/vmops.py:1519 +#: nova/virt/xenapi/vmops.py:1527 msgid "Injecting hostname to xenstore" msgstr "" -#: nova/virt/xenapi/vmops.py:1615 +#: nova/virt/xenapi/vmops.py:1623 #, python-format msgid "" "Destination host:%(hostname)s must be in the same aggregate as the source" " server" msgstr "" -#: nova/virt/xenapi/vmops.py:1647 +#: nova/virt/xenapi/vmops.py:1655 msgid "Migrate Receive failed" msgstr "" -#: nova/virt/xenapi/vmops.py:1695 +#: nova/virt/xenapi/vmops.py:1703 msgid "VM.assert_can_migratefailed" msgstr "" -#: nova/virt/xenapi/vmops.py:1732 +#: nova/virt/xenapi/vmops.py:1740 msgid "Migrate Send failed" msgstr "" diff --git a/nova/openstack/common/db/sqlalchemy/session.py b/nova/openstack/common/db/sqlalchemy/session.py index cf6713581..010254e7a 100644 --- a/nova/openstack/common/db/sqlalchemy/session.py +++ b/nova/openstack/common/db/sqlalchemy/session.py @@ -264,7 +264,8 @@ sql_opts = [ os.path.abspath(os.path.join(os.path.dirname(__file__), '../', '$sqlite_db')), help='The SQLAlchemy connection string used to connect to the ' - 'database'), + 'database', + secret=True), cfg.StrOpt('sqlite_db', default='nova.sqlite', help='the filename to use with sqlite'), diff --git a/nova/openstack/common/db/sqlalchemy/utils.py b/nova/openstack/common/db/sqlalchemy/utils.py index 6a9cb846f..3f5ae737a 100644 --- a/nova/openstack/common/db/sqlalchemy/utils.py +++ b/nova/openstack/common/db/sqlalchemy/utils.py @@ -2,7 +2,7 @@ # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. -# Copyright 2010-2011 OpenStack Foundation +# Copyright 2010-2011 OpenStack Foundation. # Copyright 2012 Justin Santa Barbara # All Rights Reserved. # diff --git a/nova/quota.py b/nova/quota.py index 3903a6add..8aaa3ed31 100644 --- a/nova/quota.py +++ b/nova/quota.py @@ -44,7 +44,7 @@ quota_opts = [ default=10, help='number of floating ips allowed per project'), cfg.IntOpt('quota_fixed_ips', - default=10, + default=-1, help=('number of fixed ips allowed per project (this should be ' 'at least the number of instances allowed)')), cfg.IntOpt('quota_metadata_items', diff --git a/nova/tests/api/openstack/compute/contrib/test_quota_classes.py b/nova/tests/api/openstack/compute/contrib/test_quota_classes.py index 8286661a0..c4f79118e 100644 --- a/nova/tests/api/openstack/compute/contrib/test_quota_classes.py +++ b/nova/tests/api/openstack/compute/contrib/test_quota_classes.py @@ -25,7 +25,7 @@ from nova.tests.api.openstack import fakes def quota_set(class_name): return {'quota_class_set': {'id': class_name, 'metadata_items': 128, 'ram': 51200, 'floating_ips': 10, - 'fixed_ips': 10, 'instances': 10, + 'fixed_ips': -1, 'instances': 10, 'injected_files': 5, 'cores': 20, 'injected_file_content_bytes': 10240, 'security_groups': 10, @@ -45,7 +45,7 @@ class QuotaClassSetsTest(test.TestCase): 'cores': 20, 'ram': 51200, 'floating_ips': 10, - 'fixed_ips': 10, + 'fixed_ips': -1, 'metadata_items': 128, 'injected_files': 5, 'injected_file_path_bytes': 255, @@ -64,7 +64,7 @@ class QuotaClassSetsTest(test.TestCase): self.assertEqual(qs['cores'], 20) self.assertEqual(qs['ram'], 51200) self.assertEqual(qs['floating_ips'], 10) - self.assertEqual(qs['fixed_ips'], 10) + self.assertEqual(qs['fixed_ips'], -1) self.assertEqual(qs['metadata_items'], 128) self.assertEqual(qs['injected_files'], 5) self.assertEqual(qs['injected_file_path_bytes'], 255) @@ -90,7 +90,7 @@ class QuotaClassSetsTest(test.TestCase): def test_quotas_update_as_admin(self): body = {'quota_class_set': {'instances': 50, 'cores': 50, 'ram': 51200, 'floating_ips': 10, - 'fixed_ips': 10, 'metadata_items': 128, + 'fixed_ips': -1, 'metadata_items': 128, 'injected_files': 5, 'injected_file_content_bytes': 10240, 'injected_file_path_bytes': 255, @@ -108,7 +108,7 @@ class QuotaClassSetsTest(test.TestCase): def test_quotas_update_as_user(self): body = {'quota_class_set': {'instances': 50, 'cores': 50, 'ram': 51200, 'floating_ips': 10, - 'fixed_ips': 10, 'metadata_items': 128, + 'fixed_ips': -1, 'metadata_items': 128, 'injected_files': 5, 'injected_file_content_bytes': 10240, 'security_groups': 10, @@ -136,7 +136,7 @@ class QuotaTemplateXMLSerializerTest(test.TestCase): injected_file_content_bytes=20, ram=50, floating_ips=60, - fixed_ips=10, + fixed_ips=-1, instances=70, injected_files=80, security_groups=10, @@ -161,7 +161,7 @@ class QuotaTemplateXMLSerializerTest(test.TestCase): injected_file_content_bytes='20', ram='50', floating_ips='60', - fixed_ips='10', + fixed_ips='-1', instances='70', injected_files='80', security_groups='10', @@ -175,7 +175,7 @@ class QuotaTemplateXMLSerializerTest(test.TestCase): '</injected_file_content_bytes>' '<ram>50</ram>' '<floating_ips>60</floating_ips>' - '<fixed_ips>10</fixed_ips>' + '<fixed_ips>-1</fixed_ips>' '<instances>70</instances>' '<injected_files>80</injected_files>' '<cores>90</cores>' diff --git a/nova/tests/api/openstack/compute/contrib/test_quotas.py b/nova/tests/api/openstack/compute/contrib/test_quotas.py index 1ff7e60ab..c95c41614 100644 --- a/nova/tests/api/openstack/compute/contrib/test_quotas.py +++ b/nova/tests/api/openstack/compute/contrib/test_quotas.py @@ -26,7 +26,7 @@ from nova.tests.api.openstack import fakes def quota_set(id): return {'quota_set': {'id': id, 'metadata_items': 128, - 'ram': 51200, 'floating_ips': 10, 'fixed_ips': 10, + 'ram': 51200, 'floating_ips': 10, 'fixed_ips': -1, 'instances': 10, 'injected_files': 5, 'cores': 20, 'injected_file_content_bytes': 10240, 'security_groups': 10, 'security_group_rules': 20, @@ -45,7 +45,7 @@ class QuotaSetsTest(test.TestCase): 'cores': 20, 'ram': 51200, 'floating_ips': 10, - 'fixed_ips': 10, + 'fixed_ips': -1, 'metadata_items': 128, 'injected_files': 5, 'injected_file_path_bytes': 255, @@ -62,7 +62,7 @@ class QuotaSetsTest(test.TestCase): self.assertEqual(qs['cores'], 20) self.assertEqual(qs['ram'], 51200) self.assertEqual(qs['floating_ips'], 10) - self.assertEqual(qs['fixed_ips'], 10) + self.assertEqual(qs['fixed_ips'], -1) self.assertEqual(qs['metadata_items'], 128) self.assertEqual(qs['injected_files'], 5) self.assertEqual(qs['injected_file_path_bytes'], 255) @@ -83,7 +83,7 @@ class QuotaSetsTest(test.TestCase): 'cores': 20, 'ram': 51200, 'floating_ips': 10, - 'fixed_ips': 10, + 'fixed_ips': -1, 'metadata_items': 128, 'injected_files': 5, 'injected_file_path_bytes': 255, @@ -109,13 +109,13 @@ class QuotaSetsTest(test.TestCase): def test_quotas_update_as_admin(self): body = {'quota_set': {'instances': 50, 'cores': 50, 'ram': 51200, 'floating_ips': 10, - 'fixed_ips': 10, 'metadata_items': 128, + 'fixed_ips': -1, 'metadata_items': 128, 'injected_files': 5, 'injected_file_content_bytes': 10240, 'injected_file_path_bytes': 255, 'security_groups': 10, 'security_group_rules': 20, - 'key_pairs': 100, 'fixed_ips': 10}} + 'key_pairs': 100, 'fixed_ips': -1}} req = fakes.HTTPRequest.blank('/v2/fake4/os-quota-sets/update_me', use_admin_context=True) @@ -126,7 +126,7 @@ class QuotaSetsTest(test.TestCase): def test_quotas_update_as_user(self): body = {'quota_set': {'instances': 50, 'cores': 50, 'ram': 51200, 'floating_ips': 10, - 'fixed_ips': 10, 'metadata_items': 128, + 'fixed_ips': -1, 'metadata_items': 128, 'injected_files': 5, 'injected_file_content_bytes': 10240, 'security_groups': 10, @@ -163,7 +163,7 @@ class QuotaSetsTest(test.TestCase): expected_resp = {'quota_set': { 'instances': 50, 'cores': 50, 'ram': 51200, 'floating_ips': 10, - 'fixed_ips': 10, 'metadata_items': 128, + 'fixed_ips': -1, 'metadata_items': 128, 'injected_files': 5, 'injected_file_content_bytes': 10240, 'injected_file_path_bytes': 255, @@ -174,7 +174,7 @@ class QuotaSetsTest(test.TestCase): # when PUT JSON format with empty string for quota body = {'quota_set': {'instances': 50, 'cores': 50, 'ram': '', 'floating_ips': 10, - 'fixed_ips': 10, 'metadata_items': 128, + 'fixed_ips': -1, 'metadata_items': 128, 'injected_files': 5, 'injected_file_content_bytes': 10240, 'injected_file_path_bytes': 255, @@ -189,7 +189,7 @@ class QuotaSetsTest(test.TestCase): # when PUT XML format with empty string for quota body = {'quota_set': {'instances': 50, 'cores': 50, 'ram': {}, 'floating_ips': 10, - 'fixed_ips': 10, 'metadata_items': 128, + 'fixed_ips': -1, 'metadata_items': 128, 'injected_files': 5, 'injected_file_content_bytes': 10240, 'injected_file_path_bytes': 255, @@ -216,7 +216,7 @@ class QuotaXMLSerializerTest(test.TestCase): injected_file_content_bytes=20, ram=50, floating_ips=60, - fixed_ips=10, + fixed_ips=-1, instances=70, injected_files=80, security_groups=10, @@ -240,7 +240,7 @@ class QuotaXMLSerializerTest(test.TestCase): injected_file_content_bytes='20', ram='50', floating_ips='60', - fixed_ips='10', + fixed_ips='-1', instances='70', injected_files='80', security_groups='10', @@ -254,7 +254,7 @@ class QuotaXMLSerializerTest(test.TestCase): '</injected_file_content_bytes>' '<ram>50</ram>' '<floating_ips>60</floating_ips>' - '<fixed_ips>10</fixed_ips>' + '<fixed_ips>-1</fixed_ips>' '<instances>70</instances>' '<injected_files>80</injected_files>' '<security_groups>10</security_groups>' diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 3a1526522..31c55fdf9 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -7976,3 +7976,69 @@ class EvacuateHostTestCase(BaseTestCase): lambda x: True) self.assertRaises(exception.InstanceRecreateNotSupported, lambda: self._rebuild(on_shared_storage=True)) + + +class ComputeInjectedFilesTestCase(BaseTestCase): + # Test that running instances with injected_files decodes files correctly + + def setUp(self): + super(ComputeInjectedFilesTestCase, self).setUp() + self.instance = self._create_fake_instance() + self.stubs.Set(self.compute.driver, 'spawn', self._spawn) + + def _spawn(self, context, instance, image_meta, injected_files, + admin_password, nw_info, block_device_info): + self.assertEqual(self.expected, injected_files) + + def _test(self, injected_files, decoded_files): + self.expected = decoded_files + self.compute.run_instance(self.context, self.instance, + injected_files=injected_files) + + def test_injected_none(self): + # test an input of None for injected_files + self._test(None, []) + + def test_injected_empty(self): + # test an input of [] for injected_files + self._test([], []) + + def test_injected_success(self): + # test with valid b64 encoded content. + injected_files = [ + ('/a/b/c', base64.b64encode('foobarbaz')), + ('/d/e/f', base64.b64encode('seespotrun')), + ] + + decoded_files = [ + ('/a/b/c', 'foobarbaz'), + ('/d/e/f', 'seespotrun'), + ] + self._test(injected_files, decoded_files) + + def test_injected_invalid(self): + # test with invalid b64 encoded content + injected_files = [ + ('/a/b/c', base64.b64encode('foobarbaz')), + ('/d/e/f', 'seespotrun'), + ] + + self.assertRaises(exception.Base64Exception, self.compute.run_instance, + self.context, self.instance, injected_files=injected_files) + + def test_reschedule(self): + # test that rescheduling is done with original encoded files + expected = [ + ('/a/b/c', base64.b64encode('foobarbaz')), + ('/d/e/f', base64.b64encode('seespotrun')), + ] + + def _ror(context, instance, exc_info, requested_networks, + admin_password, injected_files, is_first_time, request_spec, + filter_properties, bdms=None): + self.assertEqual(expected, injected_files) + + self.stubs.Set(self.compute, '_reschedule_or_reraise', _ror) + + self.compute.run_instance(self.context, self.instance, + injected_files=expected) diff --git a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl index c393ab0c7..f9a94e760 100644 --- a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl +++ b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl @@ -2,7 +2,7 @@ "quota_class_set": { "cores": 20, "floating_ips": 10, - "fixed_ips": 10, + "fixed_ips": -1, "id": "%(set_id)s", "injected_file_content_bytes": 10240, "injected_file_path_bytes": 255, diff --git a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml.tpl b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml.tpl index 8ab8436d7..fb8e7992a 100644 --- a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml.tpl +++ b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml.tpl @@ -2,7 +2,7 @@ <quota_class_set id="%(set_id)s"> <cores>20</cores> <floating_ips>10</floating_ips> - <fixed_ips>10</fixed_ips> + <fixed_ips>-1</fixed_ips> <injected_file_content_bytes>10240</injected_file_content_bytes> <injected_file_path_bytes>255</injected_file_path_bytes> <injected_files>5</injected_files> diff --git a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl index 3974f65db..483fda8c5 100644 --- a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl +++ b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl @@ -4,7 +4,7 @@ "cores": 50, "ram": 51200, "floating_ips": 10, - "fixed_ips": 10, + "fixed_ips": -1, "metadata_items": 128, "injected_files": 5, "injected_file_content_bytes": 10240, diff --git a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml.tpl b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml.tpl index f27082ab3..150fb6a42 100644 --- a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml.tpl +++ b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml.tpl @@ -2,7 +2,7 @@ <quota_class_set> <cores>50</cores> <floating_ips>10</floating_ips> - <fixed_ips>10</fixed_ips> + <fixed_ips>-1</fixed_ips> <injected_file_content_bytes>10240</injected_file_content_bytes> <injected_file_path_bytes>255</injected_file_path_bytes> <injected_files>5</injected_files> diff --git a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl index 8d195b924..c36783f2f 100644 --- a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl +++ b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl @@ -2,7 +2,7 @@ "quota_class_set": { "cores": 50, "floating_ips": 10, - "fixed_ips": 10, + "fixed_ips": -1, "injected_file_content_bytes": 10240, "injected_file_path_bytes": 255, "injected_files": 5, @@ -13,4 +13,4 @@ "security_group_rules": 20, "security_groups": 10 } -}
\ No newline at end of file +} diff --git a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml.tpl b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml.tpl index 5c12a81e7..cd674a24d 100644 --- a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml.tpl +++ b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml.tpl @@ -2,7 +2,7 @@ <quota_class_set> <cores>50</cores> <floating_ips>10</floating_ips> - <fixed_ips>10</fixed_ips> + <fixed_ips>-1</fixed_ips> <injected_file_content_bytes>10240</injected_file_content_bytes> <injected_file_path_bytes>255</injected_file_path_bytes> <injected_files>5</injected_files> @@ -12,4 +12,4 @@ <ram>51200</ram> <security_group_rules>20</security_group_rules> <security_groups>10</security_groups> -</quota_class_set>
\ No newline at end of file +</quota_class_set> diff --git a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl index 364a59f7a..2f0fd9857 100644 --- a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl +++ b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl @@ -2,7 +2,7 @@ "quota_set": { "cores": 20, "floating_ips": 10, - "fixed_ips": 10, + "fixed_ips": -1, "id": "fake_tenant", "injected_file_content_bytes": 10240, "injected_file_path_bytes": 255, diff --git a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml.tpl b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml.tpl index 36e6da544..f56987563 100644 --- a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml.tpl +++ b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml.tpl @@ -2,7 +2,7 @@ <quota_set id="fake_tenant"> <cores>20</cores> <floating_ips>10</floating_ips> - <fixed_ips>10</fixed_ips> + <fixed_ips>-1</fixed_ips> <injected_file_content_bytes>10240</injected_file_content_bytes> <injected_file_path_bytes>255</injected_file_path_bytes> <injected_files>5</injected_files> diff --git a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl index 364a59f7a..2f0fd9857 100644 --- a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl +++ b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl @@ -2,7 +2,7 @@ "quota_set": { "cores": 20, "floating_ips": 10, - "fixed_ips": 10, + "fixed_ips": -1, "id": "fake_tenant", "injected_file_content_bytes": 10240, "injected_file_path_bytes": 255, diff --git a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.xml.tpl b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.xml.tpl index 36e6da544..f56987563 100644 --- a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.xml.tpl +++ b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.xml.tpl @@ -2,7 +2,7 @@ <quota_set id="fake_tenant"> <cores>20</cores> <floating_ips>10</floating_ips> - <fixed_ips>10</fixed_ips> + <fixed_ips>-1</fixed_ips> <injected_file_content_bytes>10240</injected_file_content_bytes> <injected_file_path_bytes>255</injected_file_path_bytes> <injected_files>5</injected_files> diff --git a/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl b/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl index 43525cfd5..34df1fe01 100644 --- a/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl +++ b/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl @@ -2,7 +2,7 @@ "quota_set": { "cores": 20, "floating_ips": 10, - "fixed_ips": 10, + "fixed_ips": -1, "injected_file_content_bytes": 10240, "injected_file_path_bytes": 255, "injected_files": 5, diff --git a/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.xml.tpl b/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.xml.tpl index 3c411e8e5..91ac3a0dd 100644 --- a/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.xml.tpl +++ b/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.xml.tpl @@ -2,7 +2,7 @@ <quota_set> <cores>20</cores> <floating_ips>10</floating_ips> - <fixed_ips>10</fixed_ips> + <fixed_ips>-1</fixed_ips> <injected_file_content_bytes>10240</injected_file_content_bytes> <injected_file_path_bytes>255</injected_file_path_bytes> <injected_files>5</injected_files> |