예제 #1
0
    def test_storage(self):
        """Test using Machine's storage.
        """
        src_machine = Machine(uuid=self.uuid_1,
                              provider_id=self.provider.provider_id,
                              av_zone=self.av_zone)
        Machine.add(src_machine)
        dst_machine = Machine.fetch(self.uuid_1)
        self.assertEqual(src_machine, dst_machine)
        self.assertNotEqual(id(src_machine), id(dst_machine))

        Machine.remove(src_machine)
        dst_machine = Machine.fetch(self.uuid_1)
        self.assertEqual(None, dst_machine)
예제 #2
0
def _destroy_machine(provider_id, machine_uuid, force, skip_store):
    """Destroy a machine.
    """
    machine = _retrieve_machine(provider_id, machine_uuid, skip_store)
    if machine:
        Machine.remove(machine)
    manager = _retrieve_machine_manager(provider_id)
    try:
        manager.destroy(machine_uuid)
    except MachineError:
        if not force:
            raise

    _LOGGER.debug("Destroyed machine (%s).", machine)
예제 #3
0
def _destroy_machine(provider_id, machine_uuid, force, skip_store):
    """Destroy a machine.
    """
    machine = _retrieve_machine(provider_id, machine_uuid, skip_store)
    if machine:
        Machine.remove(machine)
    manager = _retrieve_machine_manager(provider_id)
    try:
        manager.destroy(machine_uuid)
    except MachineError:
        if not force:
            raise

    _LOGGER.debug("Destroyed machine (%s).", machine)