summaryrefslogtreecommitdiff
path: root/src/state/initial_state.hpp
AgeCommit message (Collapse)AuthorFilesLines
2022-03-15Make mount/unmount dbus calls asynchronousPrzemyslaw Czarnowski1-117/+29
Change the default behavior of mount/umount dbus calls from blocking to unblocking ones. Once mount/unmount is triggered, appropriate action is running in the background moving handling of operation result to async event. At the end of processing dbus completion signal is sent to client with uint value of operation status (identical with errno code). Tested: Manual scheduling of mount and unmount operations with monitoring dbus communication of virtual-media service - matching api calls with completion signal. Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
2022-02-14Switch the build system to mesonPrzemyslaw Czarnowski1-2/+3
Due to requirements from community, new projects have to be built with meson. To unify with other projects some additional warnings has been enabled, so appropriate code updates has been implemented. This commit makes both meson and CMake available to simplyfy transition in openbmc. CMake support will be removed after switching to meson in openbmc will be accepted. Tested: Compiled and smoke tested. Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
2022-02-07Force udev change event on init (#6)Michal Orzel1-0/+3
* Force udev change event on init This change provides temporary workaround for HSD HSD18020136609 ("Can not mount image using Virtual media and CIFS protocol"). When in initial state, additional udev change event is triggered for all NBD devices, which prevents from disconnection on first mount attempt after reboot. The actual issue is a regression, introduced after kernel update from 5.10.67 to 5.14.11. The exact source in kernel is yet to be located; after that an actual fix shall be provided and this change will be reverted. Abstracts echoToFile to a separate class, that may be used by other classes through inheritance. This way, writing to udev files can be handled by different object than UsbGadget. Tested: Successful mounts after reboot for all supported methods (Proxy, Legacy HTTPS, Legacy CIFS). Change-Id: I2ceb826c73b6e46938397060877d35a9fa1c0e03 Signed-off-by: MichalX Orzel <michalx.orzel@intel.com>
2022-01-26Add -Wextra, remove warnings (#1)Przemyslaw Czarnowski1-14/+23
Removed all -Wextra warnings in VM sources. -Wno-unused-parameter has to be disabled due to lots of such warnings in sdbusplus. Tested: Compilation generates no warnings Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
2021-10-28Cleanup mounted resources after application crash.Krzysztof Richert1-0/+45
On initial state application cleans mounted resources which were allocated by user befor application crashed. Without that busy slot is not avaialble anymore for user. Tested: 1. Mount CIFS share. 2. Send terminate signal to virtual-media (kill -9). 3. Mount CIFS share on the same slot as during step 1. Change-Id: I7088e94832fb7bec171a56f73bd66cd29e9b246f Signed-off-by: Krzysztof Richert <krzysztof.richert@intel.com>
2021-05-06Change log level to InfoCzarnowski, Przemyslaw1-3/+2
Due to security reasons "user/username" has to be removed from the information that is logged by application. Sensitive data has been moved to "Debug"" level (lowest one) and default one has moved one level up to "Info". Also some important information allowing to catch basic errors has been upgraded to "Info". Tested: Manually, mounting both Legacy mode remote types (HTTPs and CIFS) and checking if journal for VirtualMedia service does not contain sensitive information. Change-Id: Ie6c3a79c94637e3632af76daf957e986b2dd3b6d Signed-off-by: Czarnowski, Przemyslaw <przemyslaw.hawrylewicz.czarnowski@intel.com>
2021-01-11WriteProtected value uses reversed logicAnna Platash1-1/+1
When mounting image with WriteProtected set to true, it is shown to be false and vice versa. Change-Id: Id5ff0f0deb5d5822279dd02af0deeb7586dcd065 Signed-off-by: Anna Platash <anna.platash@intel.com>
2020-11-06Virtual Media does not propagate informationAnna Platash1-0/+10
between Redfish and Web UI WriteProtected field was not updated in bmcweb. Added new property WriteProtected to MountPoint interface to allow bmcweb updating the WriteProtected field value properly. Tested on manually on ArcherCity by mounting images via RedFish interface with and without write protection. Change-Id: I9f642ace2462c52bf964d2e54b0f59fac1b06738 Signed-off-by: Anna Platash <anna.platash@intel.com>
2020-07-28Add missing "ImageURL" property to MountPoint interfaceWludzik, Jozef1-6/+20
It fixes problem with missing information on VirtualMedia Redfish resource after user mounts media using legacy method. Part of VirtualMedia Redfish resource after fix: { ... "ConnectedVia": "URI", "Id": "Slot_2", "Image": null, "ImageName": "smb://127.0.0.1/public/openSUSE-15.1-x86_64.iso", "Inserted": true, ... } Tested: - Mounted and ejected media using legacy method with success. - Received proper details about mounted image from Redfish. Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> Change-Id: I445b37aac27dd290ce07f589834c0a6a10d2ceef
2020-07-24VirtualMedia throw EBUSY exception when receive invalid event inKarol Wachowski1-21/+2
actiavting/deactivating states Previously mount/unmount waited until timeout occurs, when operation was already process it could finish before the timeout causing mount/unmount to get false positive/negative results. Tested: - Mount/Unmount dbus calls cause EBUSY exception in actiavting/deactivating states Change-Id: Idaacde212531c963aec304ac87e536d014d9d8d2 Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
2020-07-21VirtualMedia add Mount/Unmount timeout handlingKarol Wachowski1-1/+8
Added Timeout dbus property for block devices in VirtualMedia. Added throwing EBUSY exception when Mount/Unmount operation times out. Added transition from ActivatingState to DeactivatingState. Tested: Verified that after mounting non-existing HTTPS resource in proxy mode, VirtualMedia recovers restoring ready state and throws EBUSY during that transition. Verfied that resources can be mounter/unmounted in both legacy and proxy mode. Change-Id: I3768af13663046cc55976ad59062f8bc1d6396ba Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
2020-07-17Fixing multiple problems with state machine in virtual mediaKrzysztof Grobelny1-0/+313
- Previously machine did not handle AnyEvent correctly, implementation in BaseState was always run - Changing from ActiveState to ReadyState was bugged, previously only one of event SubprocessStopped or UdevNotification caused state change when it is required to wait for both - Introduced longer timer when waiting for ReadyState during Eject and ActiveState during Inject, because ndbkit can timeout during Eject and it is required to complete before next inject can success. - Added event notification when process is terminated - Added resourcess classes to handle deletion and notifications Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Signed-off-by: Karol Wachowski <karol.wachowski@intel.com> Change-Id: Ie914e650c2f15bd73cdc87582ea77a94997a3472 Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>