GithubHelp home page GithubHelp logo

Comments (6)

robhoes avatar robhoes commented on September 18, 2024 1

Make the existing function actually use the expression/filter.

from xen-api.

robhoes avatar robhoes commented on September 18, 2024

For most classes, these functions are auto-generated. However, messages are implemented differently, as they are not stored in the usual xapi DB, but directly in the file system as XML files (due to the volume). So this one may be missing, but it should be possible to implement it. See ocaml/xapi/xapi_message.ml.

from xen-api.

olivierlambert avatar olivierlambert commented on September 18, 2024

Oh okay, so maybe I got it wrong: I thought the where clause was used to filter a property in the XAPI object (eg like the name which can be "ALARM".

But it seems you are telling me it's used to filter on the XML content of the message ie the body entry. Example:

# xe message-param-list uuid=5c128a5e-06c6-787f-4ab1-7f7f86ec74fa
uuid ( RO)         : 5c128a5e-06c6-787f-4ab1-7f7f86ec74fa
         name ( RO): ALARM
     priority ( RO): 3
        class ( RO): SR
     obj-uuid ( RO): 6e6ee285-0efe-63d8-c354-d5f760e4d96c
    timestamp ( RO): 20230328T14:46:01Z
         body ( RO): value: 1.0
config:
<variable>
<name value="physical_utilisation"/>
<alarm_trigger_level value="0.8"/>
<alarm_trigger_period value ="60"/>
</variable>

My concern is not filtering the body but the name directly, to only get the filtered results (I don't want to fetch 10,000 messages). So it might be another new method added in the message class then?

from xen-api.

robhoes avatar robhoes commented on September 18, 2024

No, the body may or may not contain XML, it depends on the message. But the messages themselves, including the name etc, are stored as XML files. Look in /var/xapi/blobs/messages. Here's an example:

# xmllint --format /var/xapi/blobs/messages/VM/614f7739-e975-7447-e76f-b7099cffe2f0/1692885300.00000
<?xml version="1.0" encoding="UTF-8"?>
<message>
  <generation>45076</generation>
  <ref>OpaqueRef:5f4969f7-6417-1a14-b658-c531282cc5aa</ref>
  <name>VM_SHUTDOWN</name>
  <priority>5</priority>
  <cls>VM</cls>
  <obj_uuid>614f7739-e975-7447-e76f-b7099cffe2f0</obj_uuid>
  <timestamp>20230824T13:55:00Z</timestamp>
  <uuid>9b4f5e63-4b59-2365-fe4f-c3cd89fec9db</uuid>
  <body>VM 'win10-x64' (uuid: 614f7739-e975-7447-e76f-b7099cffe2f0) shutdown</body>
</message>

So you could implement a filter on name, priority etc.

from xen-api.

olivierlambert avatar olivierlambert commented on September 18, 2024

Okay so what would the next recommended step:

  1. using the existing get_all_records_where to build that filter
  2. create a new method in the message class
  3. something else?

from xen-api.

olivierlambert avatar olivierlambert commented on September 18, 2024

Okay we might get back to you with some questions on the "right way" to implement that. Thank you!

from xen-api.

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.