Esempio n. 1
0
    def test_disable_host_services_current_host(self):
        """Test disabling the services on a nova host."""
        # Mock out the fabric env dict.
        self.mox.StubOutWithMock(hivemind.decorators, "env")
        mockEnv = hivemind.decorators.env
        mockEnv.roledefs = {"nova-node": ["test.home"]}
        mockEnv.host_string = "test.home"
        self.mox.StubOutWithMock(hivemind.util, "env")
        hivemind.util.env.host_string = "test.home"

        # Expected commands to be run to disable the host
        self.mox.StubOutWithMock(nova, "run")
        nova.run('nova-manage service list 2>/dev/null').AndReturn(
            NOVA_MANAGE_OUTPUT)
        nova.run(
            'nova-manage service disable --host test --service nova-compute'
        ).AndReturn("")
        nova.run(
            'nova-manage service disable --host test --service nova-network'
        ).AndReturn("")

        self.mox.ReplayAll()

        nova.disable_host_services()

        self.mox.VerifyAll()
Esempio n. 2
0
    def test_disable_host_services(self):
        """Test disabling the services on a nova host."""
        # Mock out the fabric env dict.
        self.mox.StubOutWithMock(hivemind.decorators, "env")
        mockEnv = hivemind.decorators.env
        mockEnv.roledefs = {"nova-node": ["test.home"]}
        mockEnv.host_string = "test.home"

        # Expected commands to be run to disable the host
        self.mox.StubOutWithMock(nova, "run")
        nova.run("nova-manage service list 2>/dev/null").AndReturn(NOVA_MANAGE_OUTPUT)
        nova.run("nova-manage service disable --host test --service nova-compute").AndReturn("")
        nova.run("nova-manage service disable --host test --service nova-network").AndReturn("")

        self.mox.ReplayAll()

        nova.disable_host_services("test")

        self.mox.VerifyAll()
Esempio n. 3
0
    def test_disable_host_services_no_service(self):
        """Test disabling the services on a host that isn't listed in the the
        nova manage command.

        """
        # Mock out the fabric env dict
        self.mox.StubOutWithMock(hivemind.decorators, "env")
        mockEnv = hivemind.decorators.env
        mockEnv.roledefs = {"nova-node": ["test.home", "banana.home"]}
        mockEnv.host_string = "banana.home"

        # Expected commands to be run
        self.mox.StubOutWithMock(nova, "run")
        nova.run("nova-manage service list 2>/dev/null").AndReturn(NOVA_MANAGE_OUTPUT)

        self.mox.ReplayAll()

        nova.disable_host_services("banana")

        self.mox.VerifyAll()
Esempio n. 4
0
    def test_disable_host_services_no_service(self):
        """Test disabling the services on a host that isn't listed in the the
        nova manage command.

        """
        # Mock out the fabric env dict
        self.mox.StubOutWithMock(hivemind.decorators, "env")
        mockEnv = hivemind.decorators.env
        mockEnv.roledefs = {"nova-node": ["test.home", "banana.home"]}
        mockEnv.host_string = "banana.home"

        # Expected commands to be run
        self.mox.StubOutWithMock(nova, "run")
        nova.run('nova-manage service list 2>/dev/null').AndReturn(
            NOVA_MANAGE_OUTPUT)

        self.mox.ReplayAll()

        nova.disable_host_services("banana")

        self.mox.VerifyAll()