コード例 #1
0
    def testCreate(self):
        """
        Type of result should always be correct.

        If rc is OK, then pool must exist.
        """
        (result, rc, _) = checked_call(
           Manager.CreatePool(
              self._proxy,
              name=self._POOLNAME,
              redundancy=0,
              force=False,
              devices=[d.device_node for d in _device_list(_DEVICES, 1)]
           ),
           ManagerSpec.OUTPUT_SIGS[_MN.CreatePool]
        )

        (pool, rc1, _) = checked_call(
           Manager.GetPoolObjectPath(self._proxy, name=self._POOLNAME),
           ManagerSpec.OUTPUT_SIGS[_MN.GetPoolObjectPath]
        )

        (pools, _, _) = checked_call(
           Manager.ListPools(self._proxy),
           ManagerSpec.OUTPUT_SIGS[_MN.ListPools]
        )

        if rc == self._errors.OK:
            self.assertEqual(pool, result)
            self.assertEqual(rc1, self._errors.OK)
            self.assertEqual(len(pools), 1)
        else:
            self.assertEqual(rc1, self._errors.POOL_NOTFOUND)
            self.assertEqual(len(pools), 0)
コード例 #2
0
    def testCreate(self):
        """
        Create should fail trying to create new pool with same name as previous.
        """
        (pools1, _, _) = checked_call(
           Manager.ListPools(self._proxy),
           ManagerSpec.OUTPUT_SIGS[_MN.ListPools]
        )

        (_, rc, _) = checked_call(
           Manager.CreatePool(
              self._proxy,
              name=self._POOLNAME,
              redundancy=0,
              force=False,
              devices=[d.device_node for d in _device_list(_DEVICES, 1)]
           ),
           ManagerSpec.OUTPUT_SIGS[_MN.CreatePool]
        )
        expected_rc = self._errors.ALREADY_EXISTS
        self.assertEqual(rc, expected_rc)

        (_, rc1, _) = checked_call(
           Manager.GetPoolObjectPath(self._proxy, name=self._POOLNAME),
           ManagerSpec.OUTPUT_SIGS[_MN.GetPoolObjectPath]
        )

        (pools2, _, _) = checked_call(
           Manager.ListPools(self._proxy),
           ManagerSpec.OUTPUT_SIGS[_MN.ListPools]
        )

        self.assertEqual(rc1, self._errors.OK)
        self.assertEqual(pools1, pools2)
コード例 #3
0
    def setUp(self):
        """
        Obtain the Introspect() xml.
        """
        self._introspection_data = dict()

        self._service = Service()
        self._service.setUp()
        time.sleep(1)
        proxy = get_object(TOP_OBJECT)

        self._introspection_data[ManagerSpec.INTERFACE_NAME] = \
           proxy.Introspect(dbus_interface=dbus.INTROSPECTABLE_IFACE)

        ((poolpath, _), _, _) = Manager.CreatePool(proxy,
                                                   name="name",
                                                   redundancy=0,
                                                   force=False,
                                                   devices=[])
        pool = get_object(poolpath)
        self._introspection_data[PoolSpec.INTERFACE_NAME] = \
           pool.Introspect(dbus_interface=dbus.INTROSPECTABLE_IFACE)

        ([(fspath, _)], _, _) = \
           Pool.CreateFilesystems(pool, specs=[("filesystem", '', None)])
        fs = get_object(fspath)
        self._introspection_data[FilesystemSpec.INTERFACE_NAME] = \
           fs.Introspect(dbus_interface=dbus.INTROSPECTABLE_IFACE)
コード例 #4
0
 def setUp(self):
     """
     Start the stratisd daemon with the simulator.
     """
     self._service = Service()
     self._service.setUp()
     time.sleep(1)
     self._proxy = get_object(TOP_OBJECT)
     self._errors = StratisdErrorsGen.get_object()
     Manager.CreatePool(self._proxy,
                        name=self._POOLNAME,
                        redundancy=0,
                        force=False,
                        devices=_DEVICE_STRATEGY.example())
     Manager.ConfigureSimulator(self._proxy, denominator=8)
コード例 #5
0
 def setUp(self):
     """
     Start the stratisd daemon with the simulator.
     """
     self._service = Service()
     self._service.setUp()
     time.sleep(1)
     self._proxy = get_object(TOP_OBJECT)
     self._errors = StratisdErrorsGen.get_object()
     Manager.CreatePool(
        self._proxy,
        name=self._POOLNAME,
        redundancy=0,
        force=False,
        devices=[d.device_node for d in _device_list(_DEVICES, 1)]
     )
コード例 #6
0
 def setUp(self):
     """
     Start the stratisd daemon with the simulator.
     """
     self._service = Service()
     self._service.setUp()
     time.sleep(1)
     self._proxy = get_object(TOP_OBJECT)
     self._errors = StratisdErrorsGen.get_object()
     self._devs = _DEVICE_STRATEGY.example()
     ((poolpath, _), _, _) = Manager.CreatePool(self._proxy,
                                                name=self._POOLNAME,
                                                redundancy=0,
                                                force=False,
                                                devices=self._devs)
     self._pool_object = get_object(poolpath)
     Pool.CreateFilesystems(self._pool_object, specs=[self._VOLNAME])
     Manager.ConfigureSimulator(self._proxy, denominator=8)
コード例 #7
0
 def setUp(self):
     """
     Start the stratisd daemon with the simulator.
     """
     self._service = Service()
     self._service.setUp()
     time.sleep(1)
     self._proxy = get_object(TOP_OBJECT)
     self._errors = StratisdErrorsGen.get_object()
     ((poolpath, _), _, _) = Manager.CreatePool(
        self._proxy,
        name=self._POOLNAME,
        redundancy=0,
        force=False,
        devices=[]
     )
     self._pool_object = get_object(poolpath)
     Manager.ConfigureSimulator(self._proxy, denominator=8)
コード例 #8
0
 def setUp(self):
     """
     Start the stratisd daemon with the simulator.
     """
     self._service = Service()
     self._service.setUp()
     time.sleep(2)
     self._proxy = get_object(TOP_OBJECT)
     self._errors = StratisdErrorsGen.get_object()
     self._devs = [d.device_node for d in _device_list(_DEVICES, 1)]
     (result, _, _) = Manager.CreatePool(self._proxy,
                                         name=self._POOLNAME,
                                         redundancy=0,
                                         force=False,
                                         devices=self._devs)
     self._pool_object = get_object(result)
     Pool.CreateFilesystems(self._pool_object,
                            specs=[(self._VOLNAME, '', 0)])
     Manager.ConfigureSimulator(self._proxy, denominator=8)
コード例 #9
0
ファイル: _top.py プロジェクト: agrover/stratis-cli
    def create_pool(namespace):
        """
        Create a stratis pool.

        :raises StratisCliRuntimeError:
        """
        stratisd_errors = StratisdErrorsGen.get_object()

        proxy = get_object(TOP_OBJECT)

        (_, rc, message) = Manager.CreatePool(proxy,
                                              name=namespace.name,
                                              redundancy=0,
                                              force=namespace.force,
                                              devices=namespace.device)

        if rc != stratisd_errors.OK:
            raise StratisCliRuntimeError(rc, message)

        return