def merge_to(self, target):
        """Starts merging the contents of this medium and all intermediate
        differencing media in the chain to the given target medium.
        
        The target medium must be either a descendant of this medium or
        its ancestor (otherwise this method will immediately return a failure).
        It follows that there are two logical directions of the merge operation:
        from ancestor to descendant (*forward merge*) and from descendant to
        ancestor (*backward merge*). Let us consider the following medium
        chain:
        
        Base <- Diff_1 <- Diff_2
        
        Here, calling this method on the Base medium object with
        Diff_2 as an argument will be a forward merge; calling it on
        Diff_2 with Base as an argument will be a backward
        merge. Note that in both cases the contents of the resulting medium
        will be the same, the only difference is the medium object that takes
        the result of the merge operation. In case of the forward merge in the
        above example, the result will be written to Diff_2; in case of
        the backward merge, the result will be written to Base. In
        other words, the result of the operation is always stored in the target
        medium.
        
        Upon successful operation completion, the storage units of all media in
        the chain between this (source) medium and the target medium, including
        the source medium itself, will be automatically deleted and the
        relevant medium objects (including this medium) will become
        uninitialized. This means that any attempt to call any of
        their methods or attributes will fail with the
        "Object not ready" (E_ACCESSDENIED) error. Applied to the above
        example, the forward merge of Base to Diff_2 will
        delete and uninitialize both Base and Diff_1 media.
        Note that Diff_2 in this case will become a base medium
        itself since it will no longer be based on any other medium.
        
        Considering the above, all of the following conditions must be met in
        order for the merge operation to succeed:
        
        
        Neither this (source) medium nor any intermediate
        differencing medium in the chain between it and the target
        medium is attached to any virtual machine.
        
        
        Neither the source medium nor the target medium is an
        :py:attr:`MediumType.immutable`  medium.
        
        
        The part of the medium tree from the source medium to the
        target medium is a linear chain, i.e. all medium in this
        chain have exactly one child which is the next medium in this
        chain. The only exception from this rule is the target medium in
        the forward merge operation; it is allowed to have any number of
        child media because the merge operation will not change its
        logical contents (as it is seen by the guest OS or by children).
        
        
        None of the involved media are in
        :py:attr:`MediumState.locked_read`  or
        :py:attr:`MediumState.locked_write`  state.
        
        
        
        
        This (source) medium and all intermediates will be placed to :py:attr:`MediumState.deleting`  state and the target medium will be
        placed to :py:attr:`MediumState.locked_write`  state and for the
        duration of this operation.

        in target of type :class:`IMedium`
            Target medium.

        return progress of type :class:`IProgress`
            Progress object to track the operation completion.

        """
        if not isinstance(target, IMedium):
            raise TypeError("target can only be an instance of type IMedium")
        progress = self._call("mergeTo",
                     in_p=[target])
        progress = IProgress(progress)
        return progress
Starts merging the contents of this medium and all intermediate
        differencing media in the chain to the given target medium.
        
        The target medium must be either a descendant of this medium or
        its ancestor (otherwise this method will immediately return a failure).
        It follows that there are two logical directions of the merge operation:
        from ancestor to descendant (*forward merge*) and from descendant to
        ancestor (*backward merge*). Let us consider the following medium
        chain:
        
        Base <- Diff_1 <- Diff_2
        
        Here, calling this method on the Base medium object with
        Diff_2 as an argument will be a forward merge; calling it on
        Diff_2 with Base as an argument will be a backward
        merge. Note that in both cases the contents of the resulting medium
        will be the same, the only difference is the medium object that takes
        the result of the merge operation. In case of the forward merge in the
        above example, the result will be written to Diff_2; in case of
        the backward merge, the result will be written to Base. In
        other words, the result of the operation is always stored in the target
        medium.
        
        Upon successful operation completion, the storage units of all media in
        the chain between this (source) medium and the target medium, including
        the source medium itself, will be automatically deleted and the
        relevant medium objects (including this medium) will become
        uninitialized. This means that any attempt to call any of
        their methods or attributes will fail with the
        "Object not ready" (E_ACCESSDENIED) error. Applied to the above
        example, the forward merge of Base to Diff_2 will
        delete and uninitialize both Base and Diff_1 media.
        Note that Diff_2 in this case will become a base medium
        itself since it will no longer be based on any other medium.
        
        Considering the above, all of the following conditions must be met in
        order for the merge operation to succeed:
        
        
        Neither this (source) medium nor any intermediate
        differencing medium in the chain between it and the target
        medium is attached to any virtual machine.
        
        
        Neither the source medium nor the target medium is an
        :py:attr:`MediumType.immutable`  medium.
        
        
        The part of the medium tree from the source medium to the
        target medium is a linear chain, i.e. all medium in this
        chain have exactly one child which is the next medium in this
        chain. The only exception from this rule is the target medium in
        the forward merge operation; it is allowed to have any number of
        child media because the merge operation will not change its
        logical contents (as it is seen by the guest OS or by children).
        
        
        None of the involved media are in
        :py:attr:`MediumState.locked_read`  or
        :py:attr:`MediumState.locked_write`  state.
        
        
        
        
        This (source) medium and all intermediates will be placed to :py:attr:`MediumState.deleting`  state and the target medium will be
        placed to :py:attr:`MediumState.locked_write`  state and for the
        duration of this operation.

        in target of type :class:`IMedium`
            Target medium.

        return progress of type :class:`IProgress`
            Progress object to track the operation completion.