6 Replies Latest reply on Dec 4, 2017 7:40 AM by Amrendra Singh

    How to convert filesystem size from KB to GB in sync mapping file.

    Amrendra Singh

      Hi Experts,


      I am using a custom sync mapping pattern to sync fs data into CMDB. I need FS size to be in GB, so I am simply dividing the FS size with "1048576" which think is not a best way to do!!!!


      By doing this I am able to convert the value, but I case when size value is not present it is throwing me error and entry for that FS instance is not created into CMDB.


      cmdb_sync.interpreter: ERROR: User error in extension 'CMDB_filesystem_mapping.Host_FileSystem': CMDB_filesystem_mapping.Host_FileSystem:70: Type error: unsupported operand type(s) for /: 'NoneType' and 'int'


      Is there a better way to convert the size value to GB?



      mapping from Host_ComputerSystem.host as host

      traverse Mounter:FileSystemMount:MountedFileSystem:FileSystem as fsmount

      fsystem -> BMC_LocalFileSystem;

      end traverse;

      end mapping;



      computersystem := Host_ComputerSystem.computersystem;

      log.info("Map FileSystem to host %host.name%");

      for each fsmount do

      log.info("Map FileSystem %fsmount% to host %host.name%");

      if fsmount.fs_kind = "LOCAL" then


      fsystem := sync.BMC_FileSystem(

      key := fsmount.key,

      Name := "%fsmount.mount%",

      NameFormat := "Mount Point",

      ShortDescription := "%fsmount.mount%",

      Description := "%host.name%, FS-Kind:%host.fs_kind%, FS-Name:%fsmount.fs_name%, Mount:%fsmount.mount%",

      FileSystemSize := (fsmount.size)/1048576,

      AvailableSpace         := (fsmount.free)/1048576,

      FileSystemType := fsmount.fs_type,

      Category := "Miscellaneous",

      Type := "File System",

      TokenId             := "Daimler_LFS|%host.local_fqdn%|%fsmount.fs_name%%fsmount.mount%",

      Company          := computersystem.Company,

      Item := "Local File System"