Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1993140

Summary: "Host" and "Plan" CRs do not display warning for VMware host in maintenance mode
Product: Migration Toolkit for Virtualization Reporter: Fabien Dupont <fdupont>
Component: ControllerAssignee: Sam Lucidi <slucidi>
Status: CLOSED ERRATA QA Contact: Tzahi Ashkenazi <tashkena>
Severity: medium Docs Contact: Avital Pinnick <apinnick>
Priority: medium    
Version: 2.0.0   
Target Milestone: ---   
Target Release: 2.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-09 19:20:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Fabien Dupont 2021-08-12 13:11:00 UTC
Description of problem:

When a VMware host is in maintenance mode, it should be reflected with a warning condition in the Host CR. And when a Plan has VM linked to a host in maintenance mode, the Plan CR should also reflect it with a warning condition.

Comment 1 Fabien Dupont 2021-08-12 13:12:46 UTC
Please test with the mtv-operator-bundle-2.1.0-5 build / iib:85044, or later.

Comment 2 Sam Lucidi 2021-08-18 14:45:01 UTC
The condition was being detected but not being set properly on the Plan.

https://github.com/konveyor/forklift-controller/pull/340

Comment 3 Tzahi Ashkenazi 2021-08-18 14:54:33 UTC
just for transparency :  

 I have tested this BZ :
   1. Tested on cloud20 :
   2. MTV -2.1.0-52
   3. CNV - v4.8.0-451
   4. vSphere 6.7 
   when moving a host to maintenance on vsphere 6.7 
   the state appears on the MTV UI under providers > vmware > select network migration  , a warning appears on the UI :
                 The host has been validated.
                 Host is in maintenance mode.
                 Connection test, succeeded

the host CR created when changing the network for migration and the maintenance state  papers on the host CR:
    from the Host CR :
[root@f02-h07-000-r640 ~]# oc describe host/vmware67-host-1593-config
Name:         vmware67-host-1593-config
Namespace:    openshift-mtv
Labels:       <none>
Annotations:  <none>
API Version:  forklift.konveyor.io/v1beta1
Kind:         Host
Metadata:
  Creation Timestamp:  2021-08-17T12:20:35Z
  Generation:          1
  Managed Fields:
    API Version:  forklift.konveyor.io/v1beta1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:ownerReferences:
          .:
          k:{"uid":"c4ea8ff2-caee-4234-a881-10016b585d4d"}:
            .:
            f:apiVersion:
            f:kind:
            f:name:
            f:uid:
      f:spec:
        .:
        f:id:
        f:ipAddress:
        f:provider:
          .:
          f:name:
          f:namespace:
        f:secret:
          .:
          f:name:
          f:namespace:
    Manager:      Mozilla
    Operation:    Update
    Time:         2021-08-17T12:20:35Z
    API Version:  forklift.konveyor.io/v1beta1
    Fields Type:  FieldsV1
    fieldsV1:
      f:status:
        .:
        f:conditions:
        f:observedGeneration:
    Manager:    manager
    Operation:  Update
    Time:       2021-08-17T12:20:35Z
  Owner References:
    API Version:     forklift.konveyor.io/v1beta1
    Kind:            Provider
    Name:            vmware67
    UID:             c4ea8ff2-caee-4234-a881-10016b585d4d
  Resource Version:  60358288
  UID:               4b683281-65e5-4681-bfb8-ca70d071d702
Spec:
  Id:          host-1593
  Ip Address:  172.16.12.11
  Provider:
    Name:       vmware67
    Namespace:  openshift-mtv
  Secret:
    Name:       vmware67-host-1593-wsp75
    Namespace:  openshift-mtv
Status:
  Conditions:
    Category:              Advisory
    Last Transition Time:  2021-08-17T12:20:35Z
    Message:               The host has been validated.
    Reason:                Completed
    Status:                True
    Type:                  Validated
    Category:              Required
    Last Transition Time:  2021-08-17T12:20:35Z
    Message:               Connection test, succeeded.
    Reason:                Tested
    Status:                True
    Type:                  ConnectionTestSucceeded
    Category:              Required
    Last Transition Time:  2021-08-17T12:20:35Z
    Message:               The host is ready.
    Status:                True
    Type:                  Ready
    Category:              Warn
    Last Transition Time:  2021-08-17T12:37:48Z
    Message:               Host is in maintenance mode.
    Reason:                InMaintenanceMode
    Status:                True
    Type:                  Unavailable
  Observed Generation:     1
Events:
  Type     Reason                   Age                From  Message
  ----     ------                   ----               ----  -------
  Normal   Validated                18m                host  The host has been validated.
  Normal   ConnectionTestSucceeded  18m                host  Connection test, succeeded.
  Normal   Ready                    18m                host  The host is ready.
  Warning  Unavailable              75s (x3 over 18m)  host  Host is in maintenance mode.


but the state not appears on the plan from the OCP side.
I have created one plan which contains single VM that is located on the same host which is maintenance :

Name:         bug-1993140
Namespace:    openshift-mtv
Labels:       <none>
Annotations:  <none>
API Version:  forklift.konveyor.io/v1beta1
Kind:         Plan
Metadata:
  Creation Timestamp:  2021-08-17T12:40:09Z
  Generation:          1
  Managed Fields:
    API Version:  forklift.konveyor.io/v1beta1
    Fields Type:  FieldsV1
    fieldsV1:
      f:spec:
        .:
        f:description:
        f:map:
          .:
          f:network:
            .:
            f:name:
            f:namespace:
          f:storage:
            .:
            f:name:
            f:namespace:
        f:provider:
          .:
          f:destination:
            .:
            f:name:
            f:namespace:
          f:source:
            .:
            f:name:
            f:namespace:
        f:targetNamespace:
        f:vms:
        f:warm:
    Manager:      Mozilla
    Operation:    Update
    Time:         2021-08-17T12:40:09Z
    API Version:  forklift.konveyor.io/v1beta1
    Fields Type:  FieldsV1
    fieldsV1:
      f:status:
        .:
        f:conditions:
        f:migration:
        f:observedGeneration:
    Manager:         manager
    Operation:       Update
    Time:            2021-08-17T12:40:09Z
  Resource Version:  60360628
  UID:               f06cc777-f0cf-4838-bf1e-9f1c1bdb798a
Spec:
  Description:
  Map:
    Network:
      Name:       bug-1993140-p5rgb
      Namespace:  openshift-mtv
    Storage:
      Name:       bug-1993140-xmzfd
      Namespace:  openshift-mtv
  Provider:
    Destination:
      Name:       host
      Namespace:  openshift-mtv
    Source:
      Name:          vmware67
      Namespace:     openshift-mtv
  Target Namespace:  openshift-mtv
  Vms:
    Hooks:
    Id:  vm-2069
  Warm:  false
Status:
  Conditions:
    Category:              Required
    Last Transition Time:  2021-08-17T12:40:09Z
    Message:               The migration plan is ready.
    Status:                True
    Type:                  Ready
  Migration:
  Observed Generation:  1
Events:
  Type    Reason  Age   From  Message
  ----    ------  ----  ----  -------
  Normal  Ready   76m   plan  The migration plan is ready.

Comment 4 Tzahi Ashkenazi 2021-08-18 14:55:29 UTC
cloud38  & not cloud20

Comment 5 Fabien Dupont 2021-08-19 09:59:52 UTC
It is too late to make a change in MTV 2.1.0. I'm moving it to 2.2.0.

Comment 7 Fabien Dupont 2021-10-11 09:03:06 UTC
Please verify with mtv-operator-bundle-2.2.0-39 / iib:121326, or later.

Comment 8 Tzahi Ashkenazi 2021-10-12 13:25:45 UTC
Tested on cloud38 
with MTV 2.2.0-39 

an event has been created successfully when the host on VMware was moved to maintenance 

the event : 
          "Warning  InMaintenance            12s                  host  Host is in maintenance mode."



from the host CR : 

Name:         vmware67-host-1593-config
Namespace:    openshift-mtv
Labels:       <none>
Annotations:  <none>
API Version:  forklift.konveyor.io/v1beta1
Kind:         Host
Metadata:
  Creation Timestamp:  2021-10-12T13:19:40Z
  Generation:          1
  Managed Fields:
    API Version:  forklift.konveyor.io/v1beta1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:ownerReferences:
          .:
          k:{"uid":"0312ddd0-0f51-4650-89af-1fd4c2a94ee9"}:
      f:spec:
        .:
        f:id:
        f:ipAddress:
        f:provider:
          .:
          f:name:
          f:namespace:
        f:secret:
          .:
          f:name:
          f:namespace:
    Manager:      Mozilla
    Operation:    Update
    Time:         2021-10-12T13:19:40Z
    API Version:  forklift.konveyor.io/v1beta1
    Fields Type:  FieldsV1
    fieldsV1:
      f:status:
        .:
        f:conditions:
        f:observedGeneration:
    Manager:      manager
    Operation:    Update
    Subresource:  status
    Time:         2021-10-12T13:19:40Z
  Owner References:
    API Version:     forklift.konveyor.io/v1beta1
    Kind:            Provider
    Name:            vmware67
    UID:             0312ddd0-0f51-4650-89af-1fd4c2a94ee9
  Resource Version:  8137197
  UID:               dd1fdf4a-2600-4b9a-94aa-9e975cf0b07f
Spec:
  Id:          host-1593
  Ip Address:  172.16.12.11
  Provider:
    Name:       vmware67
    Namespace:  openshift-mtv
  Secret:
    Name:       vmware67-host-1593-glftg
    Namespace:  openshift-mtv
Status:
  Conditions:
    Category:              Advisory
    Last Transition Time:  2021-10-12T13:19:40Z
    Message:               The host has been validated.
    Reason:                Completed
    Status:                True
    Type:                  Validated
    Category:              Required
    Last Transition Time:  2021-10-12T13:19:40Z
    Message:               Connection test, succeeded.
    Reason:                Tested
    Status:                True
    Type:                  ConnectionTestSucceeded
    Category:              Critical
    Last Transition Time:  2021-10-12T13:22:01Z
    Message:               Host is in maintenance mode.
    Reason:                StateEvaluated
    Status:                True
    Type:                  InMaintenance
  Observed Generation:     1
Events:
  Type     Reason                   Age                  From  Message
  ----     ------                   ----                 ----  -------
  Normal   ConnectionTestSucceeded  2m33s                host  Connection test, succeeded.
  Normal   Validated                2m33s                host  The host has been validated.
  Normal   Ready                    12s (x2 over 2m33s)  host  The host is ready.
  Warning  InMaintenance            12s                  host  Host is in maintenance mode.

Comment 11 errata-xmlrpc 2021-12-09 19:20:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (MTV 2.2.0 Images), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2021:5066