314
337
message = u.relation_error('swift-proxy object-store', ret)
315
338
amulet.raise_status(amulet.FAIL, msg=message)
317
def test_z_restart_on_config_change(self):
340
def test_300_swift_config(self):
341
"""Verify the data in the swift-hash section of the swift config
343
u.log.debug('Checking swift config...')
344
unit = self.swift_storage_sentry
345
conf = '/etc/swift/swift.conf'
346
swift_proxy_relation = self.swift_proxy_sentry.relation(
347
'swift-storage', 'swift-storage:swift-storage')
349
'swift_hash_path_suffix': swift_proxy_relation['swift_hash']
352
ret = u.validate_config_data(unit, conf, 'swift-hash', expected)
354
message = "swift config error: {}".format(ret)
355
amulet.raise_status(amulet.FAIL, msg=message)
357
def test_302_proxy_server_config(self):
358
"""Verify the data in the proxy-server config file."""
359
u.log.debug('Checking swift proxy-server config...')
360
unit = self.swift_proxy_sentry
361
conf = '/etc/swift/proxy-server.conf'
362
keystone_relation = self.keystone_sentry.relation(
363
'identity-service', 'swift-proxy:identity-service')
364
swift_proxy_relation = unit.relation(
365
'identity-service', 'keystone:identity-service')
366
swift_proxy_ip = swift_proxy_relation['private-address']
367
auth_host = keystone_relation['auth_host']
368
auth_protocol = keystone_relation['auth_protocol']
375
'log_facility': 'LOG_LOCAL0',
377
'log_headers': 'False',
378
'log_address': '/dev/log'
381
'pipeline': 'gatekeeper healthcheck proxy-logging cache '
382
'swift3 s3token container_sync bulk tempurl '
383
'slo dlo formpost authtoken keystoneauth '
384
'staticweb container-quotas account-quotas '
385
'proxy-logging proxy-server'
387
'app:proxy-server': {
388
'use': 'egg:swift#proxy',
389
'allow_account_management': 'true',
390
'account_autocreate': 'true',
391
'node_timeout': '60',
392
'recoverable_node_timeout': '30'
395
'use': 'egg:swift#tempauth',
396
'user_system_root': 'testpass .admin https://{}:8080/v1/'
397
'AUTH_system'.format(swift_proxy_ip)
399
'filter:healthcheck': {'use': 'egg:swift#healthcheck'},
401
'use': 'egg:swift#memcache',
402
'memcache_servers': '{}:11211'.format(swift_proxy_ip)
404
'filter:account-quotas': {'use': 'egg:swift#account_quotas'},
405
'filter:container-quotas': {'use': 'egg:swift#container_quotas'},
406
'filter:proxy-logging': {'use': 'egg:swift#proxy_logging'},
407
'filter:staticweb': {'use': 'egg:swift#staticweb'},
408
'filter:bulk': {'use': 'egg:swift#bulk'},
409
'filter:slo': {'use': 'egg:swift#slo'},
410
'filter:dlo': {'use': 'egg:swift#dlo'},
411
'filter:formpost': {'use': 'egg:swift#formpost'},
412
'filter:tempurl': {'use': 'egg:swift#tempurl'},
413
'filter:container_sync': {'use': 'egg:swift#container_sync'},
414
'filter:gatekeeper': {'use': 'egg:swift#gatekeeper'},
415
'filter:keystoneauth': {
416
'use': 'egg:swift#keystoneauth',
417
'operator_roles': 'Member,Admin'
419
'filter:authtoken': {
420
'auth_uri': '{}://{}:{}'.format(
423
keystone_relation['service_port']),
424
'admin_tenant_name': keystone_relation['service_tenant'],
425
'admin_user': keystone_relation['service_username'],
426
'admin_password': keystone_relation['service_password'],
427
'delay_auth_decision': 'true',
428
'signing_dir': '/var/cache/swift',
429
'cache': 'swift.cache'
431
'filter:swift3': {'use': 'egg:swift3#swift3'}
434
if self._get_openstack_release() >= self.trusty_kilo:
436
expected['filter:authtoken'].update({
437
'paste.filter_factory': 'keystonemiddleware.auth_token:'
439
'identity_uri': '{}://{}:{}'.format(
442
keystone_relation['auth_port']),
444
expected['filter:s3token'] = {
445
# No section commonality with J and earlier
446
'paste.filter_factory': 'keystonemiddleware.s3_token'
448
'auth_uri': '{}://{}:{}'.format(
451
keystone_relation['service_port']),
452
'identity_uri': '{}://{}:{}'.format(
455
keystone_relation['auth_port']),
459
expected['filter:authtoken'].update({
460
'paste.filter_factory': 'keystoneclient.middleware.'
461
'auth_token:filter_factory',
462
'auth_host': auth_host,
463
'auth_port': keystone_relation['auth_port'],
464
'auth_protocol': auth_protocol,
466
expected['filter:s3token'] = {
467
# No section commonality with K and later
468
'paste.filter_factory': 'keystoneclient.middleware.'
469
's3_token:filter_factory',
470
'auth_port': keystone_relation['auth_port'],
471
'auth_host': keystone_relation['auth_host'],
472
'service_host': keystone_relation['service_host'],
473
'service_port': keystone_relation['service_port'],
474
'auth_protocol': keystone_relation['auth_protocol'],
475
'auth_token': keystone_relation['admin_token'],
476
'admin_token': keystone_relation['admin_token']
479
for section, pairs in expected.iteritems():
480
ret = u.validate_config_data(unit, conf, section, pairs)
482
message = "proxy-server config error: {}".format(ret)
483
amulet.raise_status(amulet.FAIL, msg=message)
485
def test_400_swift_backed_image_create(self):
486
"""Create an instance in glance, which is backed by swift, and validate
487
that some of the metadata for the image match in glance and swift."""
488
u.log.debug('Checking swift objects and containers with a '
489
'swift-backed glance image...')
491
# Create swift-backed glance image
492
img_new = u.create_cirros_image(self.glance, "cirros-image-1")
494
img_md5 = img_new.checksum
495
img_size = img_new.size
497
# Validate that swift object's checksum/size match that from glance
498
headers, containers = self.swift.get_account()
499
if len(containers) != 1:
500
msg = "Expected 1 swift container, found {}".format(
502
amulet.raise_status(amulet.FAIL, msg=msg)
504
container_name = containers[0].get('name')
506
headers, objects = self.swift.get_container(container_name)
507
if len(objects) != 1:
508
msg = "Expected 1 swift object, found {}".format(len(objects))
509
amulet.raise_status(amulet.FAIL, msg=msg)
511
swift_object_size = objects[0].get('bytes')
512
swift_object_md5 = objects[0].get('hash')
514
if img_size != swift_object_size:
515
msg = "Glance image size {} != swift object size {}".format(
516
img_size, swift_object_size)
517
amulet.raise_status(amulet.FAIL, msg=msg)
519
if img_md5 != swift_object_md5:
520
msg = "Glance image hash {} != swift object hash {}".format(
521
img_md5, swift_object_md5)
522
amulet.raise_status(amulet.FAIL, msg=msg)
525
u.delete_resource(self.glance.images, img_id, msg="glance image")
528
def test_900_restart_on_config_change(self):
318
529
"""Verify that the specified services are restarted when the config
321
Note(coreycb): The method name with the _z_ is a little odd
322
but it forces the test to run last. It just makes things
323
easier because restarting services requires re-authorization.
326
self.d.configure('swift-proxy', {'node-timeout': '90'})
328
if not u.service_restarted(self.swift_proxy_sentry, svc,
329
'/etc/swift/proxy-server.conf'):
330
self.d.configure('swift-proxy', {'node-timeout': '60'})
331
msg = "service {} didn't restart after config change".format(svc)
332
amulet.raise_status(amulet.FAIL, msg=msg)
334
self.d.configure('swift-proxy', {'node-timeout': '60'})
336
def test_z_no_restart_on_config_change_when_paused(self):
531
u.log.info('Checking that conf files and system services respond '
532
'to a charm config change...')
534
sentry = self.swift_proxy_sentry
535
juju_service = 'swift-proxy'
537
# Process names, corresponding conf files
538
services = {'swift-proxy-server': '/etc/swift/proxy-server.conf'}
540
# Expected default and alternate values
541
set_default = {'node-timeout': '60'}
542
set_alternate = {'node-timeout': '90'}
544
# Make config change, check for service restarts
545
u.log.debug('Making config change on {}...'.format(juju_service))
546
mtime = u.get_sentry_time(sentry)
547
self.d.configure(juju_service, set_alternate)
550
for s, conf_file in services.iteritems():
551
u.log.debug("Checking that service restarted: {}".format(s))
552
if not u.validate_service_config_changed(sentry, mtime, s,
554
sleep_time=sleep_time):
555
self.d.configure(juju_service, set_default)
556
msg = "service {} didn't restart after config change".format(s)
557
amulet.raise_status(amulet.FAIL, msg=msg)
560
self.d.configure(juju_service, set_default)
562
def test_901_no_restart_on_config_change_when_paused(self):
337
563
"""Verify that the specified services are not restarted when the config
338
564
is changed and the unit is paused."""
339
565
u.log.info('Checking that system services do not get restarted '
414
640
" (got {} instead)".format(message))
415
641
amulet.raise_status(amulet.FAIL, msg=msg)
417
def test_z_pause_resume_actions(self):
643
def test_902_pause_resume_actions(self):
418
644
"""Pause and then resume swift-proxy."""
419
645
u.log.debug('Checking pause/resume actions...')
420
646
self._test_pause()
421
647
self._test_resume()
423
def test_swift_config(self):
424
"""Verify the data in the swift config file."""
425
unit = self.swift_proxy_sentry
426
conf = '/etc/swift/swift.conf'
427
swift_proxy_relation = unit.relation('swift-storage',
428
'swift-storage:swift-storage')
430
'swift_hash_path_suffix': swift_proxy_relation['swift_hash']
433
ret = u.validate_config_data(unit, conf, 'swift-hash', expected)
435
message = "swift config error: {}".format(ret)
436
amulet.raise_status(amulet.FAIL, msg=message)
438
def test_proxy_server_icehouse_config(self):
439
"""Verify the data in the proxy-server config file."""
440
if self._get_openstack_release() < self.precise_icehouse:
443
unit = self.swift_proxy_sentry
444
conf = '/etc/swift/proxy-server.conf'
445
keystone_relation = self.keystone_sentry.relation('identity-service',
446
'swift-proxy:identity-service')
447
swift_proxy_relation = unit.relation('identity-service',
448
'keystone:identity-service')
449
swift_proxy_ip = swift_proxy_relation['private-address']
450
auth_host = keystone_relation['auth_host']
451
auth_protocol = keystone_relation['auth_protocol']
458
'log_facility': 'LOG_LOCAL0',
460
'log_headers': 'False',
461
'log_address': '/dev/log'
464
'pipeline': 'gatekeeper healthcheck proxy-logging cache swift3 '
465
's3token container_sync bulk tempurl slo dlo '
466
'formpost authtoken keystoneauth staticweb '
467
'container-quotas account-quotas proxy-logging '
470
'app:proxy-server': {
471
'use': 'egg:swift#proxy',
472
'allow_account_management': 'true',
473
'account_autocreate': 'true',
474
'node_timeout': '60',
475
'recoverable_node_timeout': '30'
478
'use': 'egg:swift#tempauth',
479
'user_system_root': 'testpass .admin https://{}:8080/v1/'
480
'AUTH_system'.format(swift_proxy_ip)
482
'filter:healthcheck': {'use': 'egg:swift#healthcheck'},
484
'use': 'egg:swift#memcache',
485
'memcache_servers': '{}:11211'.format(swift_proxy_ip)
487
'filter:account-quotas': {'use': 'egg:swift#account_quotas'},
488
'filter:container-quotas': {'use': 'egg:swift#container_quotas'},
489
'filter:proxy-logging': {'use': 'egg:swift#proxy_logging'},
490
'filter:staticweb': {'use': 'egg:swift#staticweb'},
491
'filter:bulk': {'use': 'egg:swift#bulk'},
492
'filter:slo': {'use': 'egg:swift#slo'},
493
'filter:dlo': {'use': 'egg:swift#dlo'},
494
'filter:formpost': {'use': 'egg:swift#formpost'},
495
'filter:tempurl': {'use': 'egg:swift#tempurl'},
496
'filter:container_sync': {'use': 'egg:swift#container_sync'},
497
'filter:gatekeeper': {'use': 'egg:swift#gatekeeper'},
498
'filter:keystoneauth': {
499
'use': 'egg:swift#keystoneauth',
500
'operator_roles': 'Member,Admin'
502
'filter:authtoken': {
503
'paste.filter_factory': 'keystoneclient.middleware.'
504
'auth_token:filter_factory',
505
'auth_host': auth_host,
506
'auth_port': keystone_relation['auth_port'],
507
'auth_protocol': auth_protocol,
508
'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host,
509
keystone_relation['service_port']),
510
'admin_tenant_name': keystone_relation['service_tenant'],
511
'admin_user': keystone_relation['service_username'],
512
'admin_password': keystone_relation['service_password'],
513
'delay_auth_decision': 'true',
514
'signing_dir': '/var/cache/swift',
515
'cache': 'swift.cache'
518
'paste.filter_factory': 'keystoneclient.middleware.'
519
's3_token:filter_factory',
520
'service_host': keystone_relation['service_host'],
521
'service_port': keystone_relation['service_port'],
522
'auth_port': keystone_relation['auth_port'],
523
'auth_host': keystone_relation['auth_host'],
524
'auth_protocol': keystone_relation['auth_protocol'],
525
'auth_token': keystone_relation['admin_token'],
526
'admin_token': keystone_relation['admin_token']
528
'filter:swift3': {'use': 'egg:swift3#swift3'}
531
for section, pairs in expected.iteritems():
532
ret = u.validate_config_data(unit, conf, section, pairs)
534
message = "proxy-server config error: {}".format(ret)
535
amulet.raise_status(amulet.FAIL, msg=message)
537
def test_proxy_server_havana_config(self):
538
"""Verify the data in the proxy-server config file."""
539
if self._get_openstack_release() != self.precise_havana:
542
unit = self.swift_proxy_sentry
543
conf = '/etc/swift/proxy-server.conf'
544
keystone_relation = self.keystone_sentry.relation('identity-service',
545
'swift-proxy:identity-service')
546
swift_proxy_relation = unit.relation('identity-service',
547
'keystone:identity-service')
548
swift_proxy_ip = swift_proxy_relation['private-address']
549
auth_host = keystone_relation['auth_host']
550
auth_protocol = keystone_relation['auth_protocol']
558
'pipeline': 'healthcheck cache swift3 authtoken '
559
'keystoneauth container-quotas account-quotas '
562
'app:proxy-server': {
563
'use': 'egg:swift#proxy',
564
'allow_account_management': 'true',
565
'account_autocreate': 'true',
566
'node_timeout': '60',
567
'recoverable_node_timeout': '30'
570
'use': 'egg:swift#tempauth',
571
'user_system_root': 'testpass .admin https://{}:8080/v1/'
572
'AUTH_system'.format(swift_proxy_ip)
574
'filter:healthcheck': {'use': 'egg:swift#healthcheck'},
576
'use': 'egg:swift#memcache',
577
'memcache_servers': '{}:11211'.format(swift_proxy_ip)
579
'filter:account-quotas': {'use': 'egg:swift#account_quotas'},
580
'filter:container-quotas': {'use': 'egg:swift#container_quotas'},
581
'filter:keystoneauth': {
582
'use': 'egg:swift#keystoneauth',
583
'operator_roles': 'Member,Admin'
585
'filter:authtoken': {
586
'paste.filter_factory': 'keystoneclient.middleware.'
587
'auth_token:filter_factory',
588
'auth_host': auth_host,
589
'auth_port': keystone_relation['auth_port'],
590
'auth_protocol': auth_protocol,
591
'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host,
592
keystone_relation['service_port']),
593
'admin_tenant_name': keystone_relation['service_tenant'],
594
'admin_user': keystone_relation['service_username'],
595
'admin_password': keystone_relation['service_password'],
596
'delay_auth_decision': 'true',
597
'signing_dir': '/var/cache/swift',
598
'cache': 'swift.cache'
601
'paste.filter_factory': 'keystone.middleware.s3_token:'
603
'service_host': keystone_relation['service_host'],
604
'service_port': keystone_relation['service_port'],
605
'auth_port': keystone_relation['auth_port'],
606
'auth_host': keystone_relation['auth_host'],
607
'auth_protocol': keystone_relation['auth_protocol'],
608
'auth_token': keystone_relation['admin_token'],
609
'admin_token': keystone_relation['admin_token'],
610
'service_protocol': keystone_relation['service_protocol']
612
'filter:swift3': {'use': 'egg:swift3#swift3'}
615
for section, pairs in expected.iteritems():
616
ret = u.validate_config_data(unit, conf, section, pairs)
618
message = "proxy-server config error: {}".format(ret)
619
amulet.raise_status(amulet.FAIL, msg=message)
621
def test_proxy_server_grizzly_config(self):
622
"""Verify the data in the proxy-server config file."""
623
if self._get_openstack_release() != self.precise_grizzly:
626
unit = self.swift_proxy_sentry
627
conf = '/etc/swift/proxy-server.conf'
628
keystone_relation = self.keystone_sentry.relation('identity-service',
629
'swift-proxy:identity-service')
630
swift_proxy_relation = unit.relation('identity-service',
631
'keystone:identity-service')
632
swift_proxy_ip = swift_proxy_relation['private-address']
633
auth_host = keystone_relation['auth_host']
634
auth_protocol = keystone_relation['auth_protocol']
642
'pipeline': 'healthcheck cache swift3 s3token authtoken '
643
'keystone container-quotas account-quotas '
646
'app:proxy-server': {
647
'use': 'egg:swift#proxy',
648
'allow_account_management': 'true',
649
'account_autocreate': 'true',
650
'node_timeout': '60',
651
'recoverable_node_timeout': '30'
654
'use': 'egg:swift#tempauth',
655
'user_system_root': 'testpass .admin https://{}:8080/v1/'
656
'AUTH_system'.format(swift_proxy_ip)
658
'filter:healthcheck': {'use': 'egg:swift#healthcheck'},
660
'use': 'egg:swift#memcache',
661
'memcache_servers': '{}:11211'.format(swift_proxy_ip)
663
'filter:account-quotas': {'use': 'egg:swift#account_quotas'},
664
'filter:container-quotas': {'use': 'egg:swift#container_quotas'},
666
'paste.filter_factory': 'swift.common.middleware.'
667
'keystoneauth:filter_factory',
668
'operator_roles': 'Member,Admin'
670
'filter:authtoken': {
671
'paste.filter_factory': 'keystone.middleware.auth_token:'
673
'auth_host': auth_host,
674
'auth_port': keystone_relation['auth_port'],
675
'auth_protocol': auth_protocol,
676
'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host,
677
keystone_relation['service_port']),
678
'admin_tenant_name': keystone_relation['service_tenant'],
679
'admin_user': keystone_relation['service_username'],
680
'admin_password': keystone_relation['service_password'],
681
'delay_auth_decision': 'true',
682
'signing_dir': '/var/cache/swift'
685
'paste.filter_factory': 'keystone.middleware.s3_token:'
687
'service_host': keystone_relation['service_host'],
688
'service_port': keystone_relation['service_port'],
689
'auth_port': keystone_relation['auth_port'],
690
'auth_host': keystone_relation['auth_host'],
691
'auth_protocol': keystone_relation['auth_protocol'],
692
'auth_token': keystone_relation['admin_token'],
693
'admin_token': keystone_relation['admin_token'],
694
'service_protocol': keystone_relation['service_protocol']
696
'filter:swift3': {'use': 'egg:swift3#swift3'}
699
for section, pairs in expected.iteritems():
700
ret = u.validate_config_data(unit, conf, section, pairs)
702
message = "proxy-server config error: {}".format(ret)
703
amulet.raise_status(amulet.FAIL, msg=message)
705
def test_proxy_server_folsom_config(self):
706
"""Verify the data in the proxy-server config file."""
707
if self._get_openstack_release() != self.precise_folsom:
710
unit = self.swift_proxy_sentry
711
conf = '/etc/swift/proxy-server.conf'
712
keystone_relation = self.keystone_sentry.relation('identity-service',
713
'swift-proxy:identity-service')
714
swift_proxy_relation = unit.relation('identity-service',
715
'keystone:identity-service')
716
swift_proxy_ip = swift_proxy_relation['private-address']
717
auth_host = keystone_relation['auth_host']
718
auth_protocol = keystone_relation['auth_protocol']
726
'pipeline': 'healthcheck cache swift3 s3token authtoken '
727
'keystone proxy-server'
729
'app:proxy-server': {
730
'use': 'egg:swift#proxy',
731
'allow_account_management': 'true',
732
'account_autocreate': 'true',
733
'node_timeout': '60',
734
'recoverable_node_timeout': '30'
737
'use': 'egg:swift#tempauth',
738
'user_system_root': 'testpass .admin https://{}:8080/v1/'
739
'AUTH_system'.format(swift_proxy_ip)
741
'filter:healthcheck': {'use': 'egg:swift#healthcheck'},
743
'use': 'egg:swift#memcache',
744
'memcache_servers': '{}:11211'.format(swift_proxy_ip)
747
'paste.filter_factory': 'keystone.middleware.swift_auth:'
749
'operator_roles': 'Member,Admin'
751
'filter:authtoken': {
752
'paste.filter_factory': 'keystone.middleware.auth_token:'
754
'auth_host': auth_host,
755
'auth_port': keystone_relation['auth_port'],
756
'auth_protocol': auth_protocol,
757
'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host,
758
keystone_relation['service_port']),
759
'admin_tenant_name': keystone_relation['service_tenant'],
760
'admin_user': keystone_relation['service_username'],
761
'admin_password': keystone_relation['service_password'],
762
'delay_auth_decision': '1'
765
'paste.filter_factory': 'keystone.middleware.s3_token:'
767
'service_host': keystone_relation['service_host'],
768
'service_port': keystone_relation['service_port'],
769
'auth_port': keystone_relation['auth_port'],
770
'auth_host': keystone_relation['auth_host'],
771
'auth_protocol': keystone_relation['auth_protocol'],
772
'auth_token': keystone_relation['admin_token'],
773
'admin_token': keystone_relation['admin_token'],
774
'service_protocol': keystone_relation['service_protocol']
776
'filter:swift3': {'use': 'egg:swift#swift3'}
779
for section, pairs in expected.iteritems():
780
ret = u.validate_config_data(unit, conf, section, pairs)
782
message = "proxy-server config error: {}".format(ret)
783
amulet.raise_status(amulet.FAIL, msg=message)
785
def test_proxy_server_essex_config(self):
786
"""Verify the data in the proxy-server config file."""
787
if self._get_openstack_release() != self.precise_essex:
790
unit = self.swift_proxy_sentry
791
conf = '/etc/swift/proxy-server.conf'
792
keystone_relation = self.keystone_sentry.relation('identity-service',
793
'swift-proxy:identity-service')
794
swift_proxy_relation = unit.relation('identity-service',
795
'keystone:identity-service')
796
swift_proxy_ip = swift_proxy_relation['private-address']
797
auth_host = keystone_relation['auth_host']
798
auth_protocol = keystone_relation['auth_protocol']
806
'pipeline': 'healthcheck cache swift3 s3token authtoken '
807
'keystone proxy-server'
809
'app:proxy-server': {
810
'use': 'egg:swift#proxy',
811
'allow_account_management': 'true',
812
'account_autocreate': 'true',
813
'node_timeout': '60',
814
'recoverable_node_timeout': '30'
817
'use': 'egg:swift#tempauth',
818
'user_system_root': 'testpass .admin https://{}:8080/v1/'
819
'AUTH_system'.format(swift_proxy_ip)
821
'filter:healthcheck': {'use': 'egg:swift#healthcheck'},
823
'use': 'egg:swift#memcache',
824
'memcache_servers': '{}:11211'.format(swift_proxy_ip)
827
'paste.filter_factory': 'keystone.middleware.swift_auth:'
829
'operator_roles': 'Member,Admin'
831
'filter:authtoken': {
832
'paste.filter_factory': 'keystone.middleware.auth_token:'
834
'auth_host': auth_host,
835
'auth_port': keystone_relation['auth_port'],
836
'auth_protocol': auth_protocol,
837
'auth_uri': '{}://{}:{}'.format(auth_protocol, auth_host,
838
keystone_relation['service_port']),
839
'admin_tenant_name': keystone_relation['service_tenant'],
840
'admin_user': keystone_relation['service_username'],
841
'admin_password': keystone_relation['service_password'],
842
'delay_auth_decision': '1'
845
'paste.filter_factory': 'keystone.middleware.s3_token:'
847
'service_host': keystone_relation['service_host'],
848
'service_port': keystone_relation['service_port'],
849
'auth_port': keystone_relation['auth_port'],
850
'auth_host': keystone_relation['auth_host'],
851
'auth_protocol': keystone_relation['auth_protocol'],
852
'auth_token': keystone_relation['admin_token'],
853
'admin_token': keystone_relation['admin_token'],
854
'service_protocol': keystone_relation['service_protocol']
856
'filter:swift3': {'use': 'egg:swift#swift3'}
859
for section, pairs in expected.iteritems():
860
ret = u.validate_config_data(unit, conf, section, pairs)
862
message = "proxy-server config error: {}".format(ret)
863
amulet.raise_status(amulet.FAIL, msg=message)
865
def test_image_create(self):
866
"""Create an instance in glance, which is backed by swift, and validate
867
that some of the metadata for the image match in glance and swift."""
868
# NOTE(coreycb): Skipping failing test on folsom until resolved. On
869
# folsom only, uploading an image to glance gets 400 Bad
870
# Request - Error uploading image: (error): [Errno 111]
871
# ECONNREFUSED (HTTP 400)
872
if self._get_openstack_release() == self.precise_folsom:
873
u.log.error("Skipping failing test until resolved")
876
# Create glance image
877
image = u.create_cirros_image(self.glance, "cirros-image")
879
amulet.raise_status(amulet.FAIL, msg="Image create failed")
881
# Validate that cirros image exists in glance and get its checksum/size
882
images = list(self.glance.images.list())
884
msg = "Expected 1 glance image, found {}".format(len(images))
885
amulet.raise_status(amulet.FAIL, msg=msg)
887
if images[0].name != 'cirros-image':
888
message = "cirros image does not exist"
889
amulet.raise_status(amulet.FAIL, msg=message)
891
glance_image_md5 = image.checksum
892
glance_image_size = image.size
894
# Validate that swift object's checksum/size match that from glance
895
headers, containers = self.swift.get_account()
896
if len(containers) != 1:
897
msg = "Expected 1 swift container, found {}".format(len(containers))
898
amulet.raise_status(amulet.FAIL, msg=msg)
900
container_name = containers[0].get('name')
902
headers, objects = self.swift.get_container(container_name)
903
if len(objects) != 1:
904
msg = "Expected 1 swift object, found {}".format(len(objects))
905
amulet.raise_status(amulet.FAIL, msg=msg)
907
swift_object_size = objects[0].get('bytes')
908
swift_object_md5 = objects[0].get('hash')
910
if glance_image_size != swift_object_size:
911
msg = "Glance image size {} != swift object size {}".format( \
912
glance_image_size, swift_object_size)
913
amulet.raise_status(amulet.FAIL, msg=msg)
915
if glance_image_md5 != swift_object_md5:
916
msg = "Glance image hash {} != swift object hash {}".format( \
917
glance_image_md5, swift_object_md5)
918
amulet.raise_status(amulet.FAIL, msg=msg)
921
u.delete_image(self.glance, image)