def setUp(self):
     self.mox = mox.Mox()
     self.mox.StubOutWithMock(models, 'ImageUsage', use_mock_anything=True)
     models.ImageUsage.objects = self.mox.CreateMockAnything()
     self.pool = self.mox.CreateMockAnything()
     config = make_verifier_config(False)
     self.glance_verifier = glance_verifier.GlanceVerifier(config,
                                                           pool=self.pool)
     self.mox.StubOutWithMock(models,
                              'ImageDeletes',
                              use_mock_anything=True)
     models.ImageDeletes.objects = self.mox.CreateMockAnything()
     self.mox.StubOutWithMock(models, 'ImageExists', use_mock_anything=True)
     models.ImageExists.objects = self.mox.CreateMockAnything()
Exemple #2
0
    def make_and_start_verifier(exchange):
        # Gotta create it and run it this way so things don't get
        # lost when the process is forked.
        verifier = None
        if exchange == "nova":
            reconcile = verifier_config.reconcile()
            reconciler = None
            if reconcile:
                reconciler = _load_nova_reconciler()
            verifier = nova_verifier.NovaVerifier(verifier_config,
                                                  reconciler=reconciler)
        elif exchange == "glance":
            verifier = glance_verifier.GlanceVerifier(verifier_config)

        verifier.run()
Exemple #3
0
def make_and_start_verifier(exchange, stats=None):
    # Gotta create it and run it this way so things don't get
    # lost when the process is forked.
    verifier = None
    if exchange == "nova":
        reconcile = verifier_config.reconcile()
        reconciler = None
        if reconcile:
            reconciler = _load_nova_reconciler()
        verifier = nova_verifier.NovaVerifier(verifier_config,
                                              reconciler=reconciler,
                                              stats=stats)
    elif exchange == "glance":
        verifier = glance_verifier.GlanceVerifier(verifier_config, stats=stats)

    def sig_handler(signal_number, frame):
        verifier.handle_signal(signal_number)

    signal.signal(signal.SIGINT, sig_handler)
    signal.signal(signal.SIGTERM, sig_handler)
    signal.signal(signal.SIGUSR1, sig_handler)

    verifier.run()