~verterok/ubuntuone-client/volumemanager_udfs-2

« back to all changes in this revision

Viewing changes to ubuntuone/syncdaemon/volume_manager.py

  • Committer: guillermo.gonzalez at canonical
  • Date: 2010-01-12 15:32:43 UTC
  • Revision ID: guillermo.gonzalez@canonical.com-20100112153243-0ctdreysbig54bbd
rename VolumeManager.delete_udf to delete_volume
fix VolumeManager.handle_AQ_DELETE_VOLUME_ERROR to handle shares and send VM_SHARE_DELETE_ERROR event

Show diffs side-by-side

added added

removed removed

Lines of Context:
435
435
            self.m.action_q.inquire_free_space(share.id)
436
436
            self.m.event_q.push('VM_SHARE_CREATED', share)
437
437
 
438
 
 
439
438
    def update_free_space(self, share_id, free_bytes):
440
439
        """ Update free space for a given share."""
441
440
        if share_id in self.shares:
640
639
            head = os.path.join('~', head)
641
640
        return head, tail
642
641
 
643
 
    def delete_udf(self, id):
 
642
    def delete_volume(self, id):
644
643
        """
645
 
        Request the deletion of a UDF to AQ.
 
644
        Request the deletion of a volume to AQ.
646
645
 
647
 
        if id isn't in the UDFs shelf a KeyError is raised
 
646
        if id isn't in the shares or dufs shelf a KeyError is raised
648
647
        """
649
 
        if id in self.udfs:
650
 
            self.m.action_q.delete_volume(id)
 
648
        volume = self.get_volume(id)
 
649
        if volume:
 
650
            self.m.action_q.delete_volume(volume.id)
651
651
        else:
652
652
            raise KeyError("%s isn't a valid ID." % str(id))
653
653
 
688
688
    def handle_AQ_DELETE_VOLUME_ERROR(self, volume_id, error):
689
689
        """Handle AQ_DELETE_VOLUME_ERROR."""
690
690
        volume = self.get_volume(str(volume_id))
691
 
        if volume:
 
691
        if isinstance(volume, Share):
 
692
            self.m.event_q.push('VM_SHARE_DELETE_ERROR', volume, str(error))
 
693
        elif isinstance(volume, UDF):
692
694
            self.m.event_q.push('VM_UDF_DELETE_ERROR', volume, str(error))
693
695
        else:
694
696
            self.log.warning("Received a AQ_DELETE_VOLUME_ERROR of a missing"