Exemplo n.º 1
0
 def testUnlockVolumeOk(self):
     mock_uuid = str(uuid.uuid4())
     mock_passphrase = str(uuid.uuid4())
     self.mox.StubOutWithMock(corestorage.util, 'Exec')
     corestorage.util.Exec(mox.In(DISKUTIL),
                           stdin=mock_passphrase).AndReturn((0, '', ''))
     self.mox.ReplayAll()
     corestorage.UnlockVolume(mock_uuid, mock_passphrase)
     self.mox.VerifyAll()
Exemplo n.º 2
0
 def testUnlockVolumeAlreadyUnlocked(self):
     mock_uuid = str(uuid.uuid4())
     mock_passphrase = str(uuid.uuid4())
     self.mox.StubOutWithMock(corestorage.util, 'Exec')
     corestorage.util.Exec(
         mox.In(DISKUTIL), stdin=mock_passphrase).AndReturn(
             (1, '', 'Error beginning CoreStorage Logical Volume unlock: '
              'The target Core Storage volume is not locked (-69748)'))
     self.mox.ReplayAll()
     corestorage.UnlockVolume(mock_uuid, mock_passphrase)
     self.mox.VerifyAll()
Exemplo n.º 3
0
 def testRevertVolumeCantRevert(self):
     mock_uuid = str(uuid.uuid4())
     mock_passphrase = str(uuid.uuid4())
     self.mox.StubOutWithMock(corestorage, 'UnlockVolume')
     self.mox.StubOutWithMock(corestorage.util, 'Exec')
     corestorage.UnlockVolume(mock_uuid, mock_passphrase).AndReturn(None)
     corestorage.util.Exec(mox.In(DISKUTIL),
                           stdin=mock_passphrase).AndReturn((1, '', ''))
     self.mox.ReplayAll()
     self.assertRaises(corestorage.CouldNotRevertError,
                       corestorage.RevertVolume, mock_uuid, mock_passphrase)
     self.mox.VerifyAll()
Exemplo n.º 4
0
        try:
            if self.action.get() == self.ACTIONS[0][0]:
                if self.fvclient.VerifyEscrow(volume_uuid):
                    message = 'A recovery passphrase is properly escrowed.'
                else:
                    message = 'WARNING: A recovery passphrase is NOT escrowed.'
            else:
                passphrase = self.fvclient.RetrievePassphrase(volume_uuid)
        except client.Error, e:
            return self.ShowFatalError(e)

        if self.action.get() == self.ACTIONS[1][0]:
            corestorage.RevertVolume(volume_uuid, passphrase)
            message = 'Volume reverted successfully: %s' % volume_uuid
        elif self.action.get() == self.ACTIONS[2][0]:
            corestorage.UnlockVolume(volume_uuid, passphrase)
            message = 'Volume unlocked successfully: %s' % volume_uuid
        elif self.action.get() == self.ACTIONS[3][0]:
            self._PrepTop()
            Tkinter.Label(self.top_frame, text='').pack(fill=Tkinter.Y,
                                                        expand=True)
            Tkinter.Label(
                self.top_frame,
                text='Here is the recovery token.  Be careful with it.').pack(
                )
            e = Tkinter.Entry(self.top_frame, width=self.WRAPLENGTH)
            e.pack(fill=Tkinter.Y, expand=False)
            e.insert(Tkinter.END, passphrase)
            e.configure(state='readonly')
            Tkinter.Label(self.top_frame, text='').pack(fill=Tkinter.Y,
                                                        expand=True)