Code Monkey home page Code Monkey logo

Comments (4)

diwic avatar diwic commented on August 18, 2024

Sorry, not sure I follow:

As the properties are being listed a method belonging to the Pool interface is invoked.

Exactly how is that method invoked? Calling GetManagedObjects should just list properties, not invoke (other) methods.

from dbus-rs.

mulkieran avatar mulkieran commented on August 18, 2024

The property is implemented by means of a method:

    let uuid_property = f.property::<&str, _>("Uuid", ())
        .access(Access::Read)
        .emits_changed(EmitsChangedSignal::Const)
        .on_get(get_pool_uuid);

and

let object_path = f.object_path(object_name, dbus_context.clone())
        .introspectable()
        .add(f.interface(interface_name, ())
            .add_m(create_filesystems_method)
            .add_m(destroy_filesystems_method)
            .add_m(add_cache_devs_method)
            .add_m(remove_cache_devs_method)
            .add_m(add_devs_method)
            .add_m(remove_devs_method)
            .add_m(rename_method)
            .add_p(name_property)
            .add_p(uuid_property));

and

fn get_pool_uuid(i: &mut IterAppend, p: &PropInfo<MTFn<TData>, TData>) -> Result<(), MethodErr> {
    let dbus_context = p.path.get_data();
    let object_path = p.path.get_name();
    let pools = dbus_context.pools.borrow();
    let name = try!(pools.get_by_first(object_path as &str)
        .ok_or(MethodErr::failed(&format!("no name for pool with object path {}", object_path))));
...

Currently the MethodError above is emitted when GetManagedObjects() is called, but not when the property is obtained directly from the pool.

The sequence below is:

  1. Call GetManagedObjects() with success.
  2. Create a Pool object.
  3. Call GetManagedObjects() with failure.
  4. Get the property directly from the pool with success.
[mulhern@dhcp-25-209 stratisd]$ busctl --user call org.storage.stratis1 /org/storage/stratis1 org.freedesktop.DBus.ObjectManager GetManagedObjects
a{oa{sa{sv}}} 1 "/org/storage/stratis1" 4 "org.freedesktop.DBus.Introspectable" 0 "org.freedesktop.DBus.ObjectManager" 0 "org.freedesktop.DBus.Properties" 0 "org.storage.stratis1.Manager" 3 "ErrorValues" a(sq) 17 "OK" 0 "ERROR" 1 "ALREADY_EXISTS" 2 "BAD_PARAM" 3 "BUSY" 4 "CACHE_NOTFOUND" 5 "DEV_NOTFOUND" 6 "FILESYSTEM_NOTFOUND" 7 "IO_ERROR" 8 "LIST_FAILURE" 9 "INTERNAL_ERROR" 10 "NIX_ERROR" 11 "NO_POOLS" 12 "NOTFOUND" 13 "NULL" 14 "NULL_NAME" 15 "POOL_NOTFOUND" 16 "RedundancyValues" a(sq) 1 "NONE" 0 "Version" s "0.1.0"
[mulhern@dhcp-25-209 stratisd]$ busctl --user call org.storage.stratis1 /org/storage/stratis1 org.storage.stratis1.Manager CreatePool "s(bq)bas" "deadpool" false 0 false 1 /dev/sdl
(oas)qs "/org/storage/stratis1/1" 1 "/dev/sdl"0 "Ok"
[mulhern@dhcp-25-209 stratisd]$ busctl --user call org.storage.stratis1 /org/storage/stratis1 org.freedesktop.DBus.ObjectManager GetManagedObjects
no name for pool with object path /org/storage/stratis1
[mulhern@dhcp-25-209 stratisd]$ busctl --user get-property org.storage.stratis1 /org/storage/stratis1/1 org.storage.stratis1.pool Uuid
s "2c19bce95dbf4b40b10212e408629af0

from dbus-rs.

diwic avatar diwic commented on August 18, 2024

Thanks, now I get it. I just pushed a commit to master, could you see if it fixes the issue?

from dbus-rs.

mulkieran avatar mulkieran commented on August 18, 2024

Confirmed, thanks!

from dbus-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.