• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. jgurka
    J
    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 13
    • Best 5
    • Controversial 0
    • Groups 0

    jgurka

    @jgurka

    7
    Reputation
    531
    Profile views
    13
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    jgurka Unfollow Follow

    Best posts made by jgurka

    • RE: Multcasting - Hosts Do Not Contain the Same Image Assignments

      @Tom-Elliott

      Just had a chance to try out your latest revision – working like a charm. 👍

      After writing all that up and re-reading your post, I get what you’re saying now. Really, all you’re doing is retrieving two sets of items:

      1. ID of the manager
      2. IDs of all images in the specified group

      Since ‘Host’ isn’t included in the following array call (where array_count_values is now located), it is only counting the values that it pulled from imageID that are members of the group. It then counts up how many of each imageID there is (should only be one) and sets the variable equal to that.

      I also see what you’re saying about $array[0] not being an actual array but the output number now that I can see that you’re really only interested in counting imageIDs – not multiple items like I thought.

      Thanks for the explanation & fix!

      posted in Bug Reports
      J
      jgurka
    • RE: Could Not Mount Image

      I ran into this before too. Check that nfs-server is running by running:

      systemctl status nfs-server
      

      If it’s not, you can manually start it with:

      systemctl start nfs-server
      

      This enables the service to start automatically on next boot, but it should already be enabled…

      systemctl enable nfs-server
      

      Which brings me to telling you to follow this guide on delaying the FOG services to fix the problem:
      https://wiki.fogproject.org/wiki/index.php/Fedora_21_Server#Set_the_FOG_services_to_start_30_seconds_after_boot

      I needed to also add “systemctl start FOGPingHosts” to the rc.local on my CentOS 7 installation.

      Two commands you can use to easily see what is/isn’t running on your CentOS 7 installation are:

      pstree
      

      &

      systemctl list-units --type=service
      
      posted in FOG Problems
      J
      jgurka
    • RE: Multcasting - Hosts Do Not Contain the Same Image Assignments

      @Tom-Elliott

      I’m not well-versed at all in OOP, but from what I understand, the way you had it setup was that it was taking the highest key in the output array and then adding one onto the value. Apparently that’s how PHP interprets it.

      Your latest code, as noted by Hanz, is still broken. I was able to alter your previous version of group.class.php (6128) to get both pieces of the validation working properly (at least it appears):

          public function doMembersHaveUniformImages() {
              $images = array_count_values($this->getSubObjectIDs('Host',array('id'=>$this->get('hosts')),'imageID'));
              return (count($images) == 1 && count($images['Host'] == $this->getHostCount()));
      

      -JG

      posted in Bug Reports
      J
      jgurka
    • RE: Could Not Mount Image

      @Vasahond

      Also ensure that all of the FOG services are running by entering:

      systemctl list-units --type=service
      

      You should see see all five Fog services in my screenshot as loaded, active, and running:

      alt text

      Another issue I’ve seen is the nfs-server service will show that it is running, but will be inactive and exited. Also double check that isn’t the case, because it will at a glance look as though it is loaded when you check status.

      To verify the Images directory exists, try the following:

      cd
      cd /images
      ls
      

      You should be within the directory and able to see at least a directory called dev and postdownloadscripts.

      posted in FOG Problems
      J
      jgurka
    • RE: Could Not Mount Image

      @Vasahond

      It looks like you’re on CentOS 6 – I was assuming you were on 7 earlier. Is this the latest trunk build of FOG, btw?

      I don’t think the stopped FOG services are crucial for what your problem is, but I’d start them back up anyway:

      service FOGPingHosts start
      service FOGSnapinReplicator start
      

      It looks like you have the IPv6 firewall still enabled…this might potentially be causing the problem? I’d go ahead and disable it:

      service ip6tables stop
      chkconfig ip6tables off
      

      Try it again and see if it made any difference.

      posted in FOG Problems
      J
      jgurka

    Latest posts made by jgurka

    • RE: Could Not Mount Image

      @plegrand

      The images directory needs to have full r/w/x permissions in order for FOG to use it – did you make sure to change the permissions when you created the new directory and copied the contents of the old /images?

      To check the directory permissions, run the following:

      cd /home
      ls -la
      #You want permissions on the new images directory to be drwxrwxrwx and also on sub-directories
      

      To enable full r/w/x permissions on the folder, run the following:

      chmod -R 777 /home/images
      #-R will run it recursively to apply the permission changes to sub-directories as well as the top directory
      
      posted in FOG Problems
      J
      jgurka
    • RE: Could Not Mount Image

      @Wayne-Workman

      I definitely get where you’re coming from. 🙂

      @Vasahond

      You can try running this to see whether or not /images actually exists:

      [ -d /images ] && echo 'Directory Found' || echo 'Directory /images not found'
      

      You should see "Directory Found’ if it does in fact exist.

      posted in FOG Problems
      J
      jgurka
    • RE: Could Not Mount Image

      @Wayne-Workman

      Vasahond’s running services output seems to show it as existing and being mounted via NFS:

      Configured NFS mountpoints:
      /images
      /images/dev
      Active NFS mountpoints:
      /images
      /images/dev
      
      posted in FOG Problems
      J
      jgurka
    • RE: Could Not Mount Image

      @Vasahond

      It looks like you’re on CentOS 6 – I was assuming you were on 7 earlier. Is this the latest trunk build of FOG, btw?

      I don’t think the stopped FOG services are crucial for what your problem is, but I’d start them back up anyway:

      service FOGPingHosts start
      service FOGSnapinReplicator start
      

      It looks like you have the IPv6 firewall still enabled…this might potentially be causing the problem? I’d go ahead and disable it:

      service ip6tables stop
      chkconfig ip6tables off
      

      Try it again and see if it made any difference.

      posted in FOG Problems
      J
      jgurka
    • RE: Could Not Mount Image

      @Vasahond

      Also ensure that all of the FOG services are running by entering:

      systemctl list-units --type=service
      

      You should see see all five Fog services in my screenshot as loaded, active, and running:

      alt text

      Another issue I’ve seen is the nfs-server service will show that it is running, but will be inactive and exited. Also double check that isn’t the case, because it will at a glance look as though it is loaded when you check status.

      To verify the Images directory exists, try the following:

      cd
      cd /images
      ls
      

      You should be within the directory and able to see at least a directory called dev and postdownloadscripts.

      posted in FOG Problems
      J
      jgurka
    • RE: Could Not Mount Image

      I ran into this before too. Check that nfs-server is running by running:

      systemctl status nfs-server
      

      If it’s not, you can manually start it with:

      systemctl start nfs-server
      

      This enables the service to start automatically on next boot, but it should already be enabled…

      systemctl enable nfs-server
      

      Which brings me to telling you to follow this guide on delaying the FOG services to fix the problem:
      https://wiki.fogproject.org/wiki/index.php/Fedora_21_Server#Set_the_FOG_services_to_start_30_seconds_after_boot

      I needed to also add “systemctl start FOGPingHosts” to the rc.local on my CentOS 7 installation.

      Two commands you can use to easily see what is/isn’t running on your CentOS 7 installation are:

      pstree
      

      &

      systemctl list-units --type=service
      
      posted in FOG Problems
      J
      jgurka
    • RE: Multcasting - Hosts Do Not Contain the Same Image Assignments

      @Tom-Elliott

      Just had a chance to try out your latest revision – working like a charm. 👍

      After writing all that up and re-reading your post, I get what you’re saying now. Really, all you’re doing is retrieving two sets of items:

      1. ID of the manager
      2. IDs of all images in the specified group

      Since ‘Host’ isn’t included in the following array call (where array_count_values is now located), it is only counting the values that it pulled from imageID that are members of the group. It then counts up how many of each imageID there is (should only be one) and sets the variable equal to that.

      I also see what you’re saying about $array[0] not being an actual array but the output number now that I can see that you’re really only interested in counting imageIDs – not multiple items like I thought.

      Thanks for the explanation & fix!

      posted in Bug Reports
      J
      jgurka
    • RE: Multcasting - Hosts Do Not Contain the Same Image Assignments

      @Tom-Elliott

      I’m doing my best to follow your explanation. Please note I’ve been referring to the older version that I edited and not your latest (I’ll spin up a VM in a little to see if it’s working).

      Let me see if I’m following correctly. I’m referencing the older version of the code:

          public function doMembersHaveUniformImages() {
              $images = array_count_values($this->getSubObjectIDs('Host',array('id'=>$this->get('hosts')),'imageID'));
              return (count($images) == 1 && $images[0] == $this->getHostCount());
      

      $images defines the new array & equals sets that variable to the output of what follows.

      array_count_values will count all of the values that are output from what follows.

      $this is used to reference the calling object (in this case getSubObjectIDs) and -> points it to the object.

      ‘Host’ is referring to the class Host that is set by host.class.php

      array(‘id’=>$this->get(‘hosts’) tells it to create an array, referencing ‘id’ that’s defined in group.class.php (database field ‘groupID’). $this references the call object of get(‘hosts’), which is defined within tasklog.class.php as returning the hosts listed in the ‘taskID.’

      array_count_values($this->getSubObjectIDs(‘Host’,array(‘id’=>$this->get(‘hosts’)),‘imageID’) as a whole is telling it to get the subobject IDs from ‘Host’ following the condition that they have the same GroupIDs assigned and also the subobject ID(s) of imageID based on qualifying as same groupID. It is then counting the number of each subobject IDs that resulted for ‘hosts’ and ‘imageID.’

      Note: I’m under the impression this would be outputting in a format like ([hosts] => 2 [imageID] =>1).

      return specifies what follows as evaluating to either true or false.

      count($images) is using the count function on array that was outputted from above.

      Note: it appears that using count on an array like it is here will count the entire array as a whole, which is always going to result in an output of 1.

      count($images) == 1 is a validation that the number of images being used is equal to one.

      && ties on an additional validation qualifier check

      $images[0] is referencing the array output and setting the key to 0.

      Note: from what I’ve been able to find, non-associative arrays automatically use the next integer value in the key sequence, starting at 0, for key if you do not provide one. Non-associative arrays also increment by 1 starting with the value 0, thus key 0 is adding a value 1 on. I’m understanding it as taking the value “2”, since it’s the largest of the two values in the output array and then incrementing it by one.

      $images[0] == $this->getHostCount() is validating that the number of hosts found by $images array is equal to that found by the getHostCount() function specified in group.class.php

      return (count($images) == 1 && $images[0] == $this->getHostCount()); as a whole this is validating that both the number of images is equal to one and that the number of hosts match and will return true if both are true or false if either fail.

      Let me know your thoughts on my logic – I’m just interested in PHP after looking at this and want to better understand exactly what is occurring.

      Thanks,
      JG

      posted in Bug Reports
      J
      jgurka
    • RE: Multcasting - Hosts Do Not Contain the Same Image Assignments

      @Tom-Elliott

      ‘Host’ is defined in the output array for $images?

      PHP.net reference on array_count_values

      • array_count_values() returns an array using the values of array as keys and their frequency in array as values.

      This shows an example output at bottom of page for array_count_values

      Btw, I’m not trying to attack you at all. 🙂

      posted in Bug Reports
      J
      jgurka
    • RE: Multcasting - Hosts Do Not Contain the Same Image Assignments

      @Tom-Elliott

      This is how I understand it:

      $images = array_count_values…

      • Outputs an array of the counts for each item listed.
        • E.g., Host = 2, imageID = 1

      $images[0]

      • References the output array and will take the maximum of existing integer indices as the value.
        • If Host = 2 and imageID = 1, PHP would be taking a value of 2.
      • [0] specifies the key value. Since PHP starts counting at 0 for integers, the value 0 is actually equal to “maximum of existing integer + 1.”
      • So, if $images pulled value of 2 and we add [0], it’s actually doing “2+1=3.”
      posted in Bug Reports
      J
      jgurka