Skip to content

Instance status and state().status out of sync #547

@Hook25

Description

@Hook25

It seems that sometimes the instance.status and instance.state().status attributes are out of sync. I have debugged a little bit and the state().status seems to be correct. This causes a crash (trying to wait on a start operation on an already started machine) in my application.

One thing I found weird is the _set_state function that does something like this:

if wait:
    self.client.operations.wait_for_operation(response.json()["operation"])
    if "status" in self.__dirty__:
        self.__dirty__.remove("status")
    if self.ephemeral and state == "stop":
        self.client = None
    else:
        self.sync()

Could the clearing of the __dirty__ set in a previous stop transition be causing this problem?

I am using python 3.11.3 and pylxd 2.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions