1. exceptions when adding a node to an existing slice

exceptions when adding a node to an existing slice

Home Forums FABRIC General Questions and Discussion exceptions when adding a node to an existing slice

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #4197
    Fengping Hu
    Participant

      I tried to use the following code to add a node to a newly created slice. Getting the following output. Any ideas what might have cause the problem?

      The fabric notebook pod is installed with these requirements:
      fabrictestbed-extensions==1.4.3
      python-dotenv
      ipython==8.12.0

      code:

      try:
          
          for node_name in ["node3"]:
              print(f"{node_name}")
              
              # Add node
              node = slice.add_node(name=node_name,
                                    site=site,
                                    image=image,
                                    cores=6,
                                    ram=36,
                                    disk=100
                                   )
              iface1 = node.add_component(model='NIC_Basic', name=nic1_name).get_interfaces()[0]
              iface2 = node.add_component(model='NIC_Basic', name=nic2_name).get_interfaces()[0]
              iface3 = node.add_component(model='NIC_Basic', name=nic3_name).get_interfaces()[0]
              net1.add_interface(iface1)
              net2.add_interface(iface2)
              net3.add_interface(iface3)
      
          
          #Submit Slice Request
          slice_id = slice.submit()
          
      except Exception as e:
          print(f"{e}")

      output:
      node3
      Exception: list index out of range
      Exception: list index out of range
      Exception: list index out of range
      Exception: list index out of range
      Exception: list index out of range
      Exception: list index out of range
      Exception: node.execute: Management IP Invalid: None
      Exception: node.execute: Management IP Invalid: None
      Exception: node.execute: Management IP Invalid: None
      [Unable to find node] in querying node 4bd97c9d-4d19-4502-a4e8-c31298f2b180 in d2d8867e-7bdc-448c-b252-42b0f86f560c

      Thanks,
      Fengping

      #4206
      Paul Ruth
      Keymaster

        Try doing the following at the begining of that cell.  I think you just need to pull a full/new copy of the slice before you modify it.

        slice=fablib.get_slice(<your_slice_name>)

         

        #4214
        Fengping Hu
        Participant

          That worked nicely. Thanks!

          Another challenge I have is to implement same NIC to Network mapping across all VMs in the slice. For example NET1 is on ens7, NET2 is on ens8 etc. With the previous api, I was able to do this with the following code block. With the new api,
          the node.get_interface call fails with “Interface not found” exception after the interface name is changed in OS. It seems with the new api, the interface name is kept in the data structure and not updated after it is updated in OS.

          The goal is to have a way to implement same NIC to Network mapping. We don’t have to use the following code . Thanks!

          try:
          for node in slice.get_nodes():
          stdout, stderr = node.execute(f’sudo ip link set ens7 name temp1′)
          stdout, stderr = node.execute(f’sudo ip link set ens8 name temp2′)
          stdout, stderr = node.execute(f’sudo ip link set ens9 name temp3′)
          for if_name,net_name in zip([“ens7″,”ens8″,”ens9”],[“NET1″,”NET2″,”NET3″]):
          iface = node.get_interface(network_name=net_name)
          if_name_tmp = iface.get_device_name()
          node.execute(f’sudo ip link set {if_name_tmp} name {if_name}’)
          except Exception as e:
          print(f”Fail: {e}”)
          traceback.print_exc()

          #4216
          Paul Ruth
          Keymaster

            Ah, yes. The problem with the old version was that it used ssh to get the actual device name.  This took a lot of time to print the tables and things like that.  We added “fablib_data” in each fablib object to store some info like that.  In general, you shouldn’t need to touch the fablib_data but if you are manually updating the names, the fablib_data will need to be updated.

            Try the following:

            for iface in slice.get_interfaces():

            fablib_dict = iface.get_fablib_data()

            // set fablib_dict fields

            iface.set_fablib_data(fablib_dict):

            mylisce.submit() //to update the persistent fablib data

             

            • This reply was modified 1 year, 6 months ago by Paul Ruth.
            • This reply was modified 1 year, 6 months ago by Paul Ruth.
            • This reply was modified 1 year, 6 months ago by Paul Ruth.
            #4228
            Fengping Hu
            Participant

              Nice. Tried with set_fablib_data function after running os commands and this worked well. So I can now implement NIC to NET mapping again.  Thank you so much!

              Fengping

              #4236
              Paul Ruth
              Keymaster

                Be careful about relying on this too much.  Users should not be editing this data and we reserve the right to change the fablib data format if needed.  I’ve noted the issue you are having an intend to create a function that will update this for you without you needing to edit the data directly.

              Viewing 6 posts - 1 through 6 (of 6 total)
              • You must be logged in to reply to this topic.