• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. rayhaque
    R
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 9
    • Best 0
    • Controversial 0
    • Groups 0

    rayhaque

    @rayhaque

    4
    Reputation
    205
    Profile views
    9
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    rayhaque Unfollow Follow

    Latest posts made by rayhaque

    • RE: Allow configuration for separate Imaging server and NFS server

      I am upgrading from 1.1.1 to 1.2.0 and I can see that I will have this same problem again. Again, you would need to do this in the case that your NFS server (the FOG server) is not the same as where your files are (on a NAS or SAN). I wrote up this patch file. You would want to change 10.205.205.20 to the IP address of your SAN/NAS and you would want to change [FONT=Consolas]10.10.5.10 to the IP address of your FOG server.[/FONT]

      [CODE]— packages/web/service/Post_Stage2.php.orig 2015-02-20 08:59:27.731899437 -0500
      +++ packages/web/service/Post_Stage2.php 2015-02-20 08:59:51.191898383 -0500
      @@ -52,7 +52,7 @@
      // Where is it going?
      $dest = $StorageNode->get(‘path’).‘/’.$_REQUEST[‘to’];
      //Attempt transfer of image file to Storage Node

      •                  $ftp->set('host',$StorageNode->get('ip'))
        
      •                  $ftp->set('host','10.10.5.10')
                                  ->set('username',$StorageNode->get('user'))
                                  ->set('password',$StorageNode->get('pass'));
                          if (!$ftp->connect())
        

      — packages/web/lib/fog/ImageReplicator.class.php.orig 2015-02-20 09:02:09.363892178 -0500
      +++ packages/web/lib/fog/ImageReplicator.class.php 2015-02-20 09:03:14.135889269 -0500
      @@ -16,7 +16,7 @@
      }
      private function commonOutput()
      {

      •          $StorageNode = current($this->FOGCore->getClass('StorageNodeManager')->find(array('isMaster' => 1,'isEnabled' => 1, 'ip' => $this->FOGCore->getIPAddress())));
        
      •          $StorageNode = current($this->FOGCore->getClass('StorageNodeManager')->find(array('isMaster' => 1,'isEnabled' => 1, 'ip' => '10.205.205.20')));
                  try
                  {
                  if ($StorageNode)
        

      — packages/web/lib/fog/MulticastManager.class.php.orig 2015-02-20 09:04:44.975885190 -0500
      +++ packages/web/lib/fog/MulticastManager.class.php 2015-02-20 09:05:23.587883456 -0500
      @@ -78,7 +78,7 @@
      {
      try
      {

      •                          $StorageNode = current($this->FOGCore->getClass('StorageNodeManager')->find(array('isMaster' => 1,'isEnabled' => 1,'ip' => $this->FOGCore->getIPAddress())));
        
      •                          $StorageNode = current($this->FOGCore->getClass('StorageNodeManager')->find(array('isMaster' => 1,'isEnabled' => 1, 'ip' => '10.205.205.20')));
                                  if (!$StorageNode || !$StorageNode->isValid())
                                          throw new Exception(sprintf(" | StorageNode Not found on this system."));
                                  $myroot = $StorageNode->get('path');
        

      — packages/web/lib/fog/Image.class.php.orig 2015-02-20 09:06:19.163880960 -0500
      +++ packages/web/lib/fog/Image.class.php 2015-02-20 09:07:02.043879034 -0500
      @@ -159,7 +159,7 @@
      $SNME = ($SN && $SN->get(‘isEnabled’) == ‘1’ ? true : false);
      if ($SNME)
      {

      •                  $ftphost = $SN->get('ip');
        
      •                  $ftphost = '10.10.5.10';
                          $ftpuser = $SN->get('user');
                          $ftppass = $SN->get('pass');
                          $ftproot = rtrim($SN->get('path'),'/').'/'.$this->get('path');
        

      — packages/web/lib/fog/FOGFTP.class.php.orig 2015-02-20 09:07:59.171876468 -0500
      +++ packages/web/lib/fog/FOGFTP.class.php 2015-02-20 09:08:28.223875164 -0500
      @@ -28,7 +28,7 @@
      if (($this->link && $this->lastConnectionHash == $connectionHash) || !$this->get(‘host’) || !$this->get(‘username’) || !$this->get(‘password’) || !$this->get(‘port’))
      return $this;
      // Connect

      •          $this->link = @ftp_connect($this->get('host'), $this->get('port'), $this->get('timeout'));
        
      •          $this->link = @ftp_connect(('10.10.5.10'), $this->get('port'), $this->get('timeout'));
                  if (!$this->link)
                  {
                          $error = error_get_last();
        

      [/CODE]

      Apply it like this …
      Save the above file to fog_1.2.0.patch, and then:
      [CODE]
      tar xzf fog_1.2.0.tar.gz
      cp ~/fog_1.2.0.patch fog_1.2.0
      cd fog_1.2.0
      patch -p0 < fog_1.2.0.patch
      [/CODE]

      posted in Feature Request
      R
      rayhaque
    • RE: Allow configuration for separate Imaging server and NFS server

      Thanks Tom,

      I know that I didn’t try that syntax. I will try to make some time tomorrow and test this code snippet.

      posted in Feature Request
      R
      rayhaque
    • RE: Allow configuration for separate Imaging server and NFS server

      Incidentally, if I just bang the IP address in there, it works fine! 🙂

      Like so …
      [CODE]$ftp->set(‘host’,‘10.10.5.10’)[/CODE]

      posted in Feature Request
      R
      rayhaque
    • RE: Allow configuration for separate Imaging server and NFS server

      [quote=“Tom Elliott, post: 30566, member: 7271”]Your situation is quite different, but this should fix it for you.[/quote]

      I think I am close! But I get this error …
      [CODE][Tue Jun 17 14:56:49 2014] [error] [client 10.10.5.16] PHP Fatal error: Using $this when not in object context in /var/www/fog/service/Post_Stage2.php on line 54[/CODE]

      I am not sure how I can refer to FOGCore in that context? I am not a very good programmer. Any ideas?

      posted in Feature Request
      R
      rayhaque
    • RE: Allow configuration for separate Imaging server and NFS server

      I think I may be doing a lousy job of explaining the problem at hand. Or I was confused about what the problem was. Either way, here is a shorter explanation of what is happening.

      1. An upload task is started, using the DefaultMember StorageNode, which is my SAN, 10.205.205.20 and a path of /imaging_filesystem.
      2. Client connects directly to the SAN, using the magic of NFS and copies the data at high speeds.
      3. The image upload works fine, and finishes.
      4. Client attempts to make an FTP connection[B] to the SAN[/B] to rename the file. My SAN is not running FTP, nor does it need to!

      Prior to the upgrade, I had made this possible by altering the code to make FOG look to itself instead of the SAN when it got to the FTP elements. On my FOG server, I have an NFS mount to 10.205.205.20 named /imaging_filesystem - which I have symbolically linked to /images. So if it can manage to FTP back to itself, we are in good shape. Because it can reach out to /imaging_filesystem/dev/* or /images/dev/* (doesn’t matter, they are one in the same).

      I think I may have found the code that I need to alter, and I am testing it now. Likely, my upload will not complete until I have left for the day, but I will report my progress later for anyone who cares. 😉

      My code change is to /var/www/fog/service/Post_Stage2.php, lines 53 and 54:
      [CODE] //Attempt transfer of image file to Storage Node
      $ftp->set(‘host’,$StorageNode->get(‘ip’))[/CODE]
      Becomes …
      [CODE] //Attempt transfer of image file to Storage Node
      $ftp->set(‘host’,$this->FOGCore->getIPAddress())[/CODE]

      posted in Feature Request
      R
      rayhaque
    • RE: Allow configuration for separate Imaging server and NFS server

      Hello Tom, thank you for the feedback! Perhaps this will be easier to fix than I thought.

      [quote=“Tom Elliott, post: 30434, member: 7271”]We are using a class based ftp function to do ftp now, but essentially the difference you need is about the root share of the folder. This is only affecting the NAS boxes you have.

      Basically the NFS works properly as it’s understanding of the
      /volume1/images share.
      [/quote]

      In my case, I have an /images directory on my FOG server which is actually an NFS mount.

      [CODE]root@KCHIMAGE2:/# mount | grep nfs
      10.205.205.20:/imaging_filesystem on /images type nfs (rw,rsize=8192,wsize=8192,timeo=14,intr,addr=10.205.205.20)
      nfsd on /proc/fs/nfsd type nfsd (rw)
      [/CODE]

      For my DefaultMember storage node, the path is /imaging_filesystem. And the IP address is 10.205.205.20.

      [quote=“Tom Elliott, post: 30434, member: 7271”]
      FTP is failing on these boxes because it removes the /volume1/images part. When you connect it makes the “root” as /images.

      So your FTP aren’t working properly. This isn’t something I can fix. While adding a “checkbox” for Synalogy/NAS setup would help you out, I imagine there’s actually a simpler configuration setting that can be performed on the NAS Boxes.[/quote]

      Are you saying that the client is writing the file out to /imaging_filesystem/dev/filename okay - but then trying to rename it (using FTP) as if it exists in /imaging_filesystem/images/dev/filename? In other words, are you suggesting that this is a mount point issue?

      posted in Feature Request
      R
      rayhaque
    • RE: Allow configuration for separate Imaging server and NFS server

      I just upgraded from 0.32 to 0.1.0 and then today to 1.1.1. I am [B]deeply saddened[/B] that this problem has not yet been resolved. Further, the code has been rewritten in such a way that I am now back to square one in getting things to work.

      Just to reiterate the issue:

      1. When you upload an image to FOG, it writes out the file to /imagestoredir/dev with a filename of the hosts MAC address.
      2. Once the task completes, it should rename the directory containing the new image files, and then move that directory up one level to the parent directory (/imagestoredir).
      3. This [B]FAILS[/B] when you are not storing your images in the same place that the FOG server is running.

      The reason that it failed before is that FOG was ‘hanging up’ with the place that it had just stored the file to (in my case, the SAN) and then connects to the host server and tries to rename the file from there using FTP. I assume it’s doing that same thing again, but in a new way that involves changing a few more PHP files.

      Can someone please consider rewriting this to make it a feature? It takes a lot for a guy like me to figure this out and attempt to write patches. It would probably be an easy fix for the developer group. All you would need to do is throw out a Boolean that asks if your image store is “somewhere else”, and then add a field to specify the IP/hostname of that location. And when you get to that point where you would drop the connection, and connect back to the host - simply do not disconnect! Continue with your host connected and rename the dang file!

      Please? 🙂

      posted in Feature Request
      R
      rayhaque
    • Allow configuration for separate Imaging server and NFS server

      As of now, if you store your images on an NFS (network attached storage, SAN, etc) source other than your primary imaging server, you get errors when creating images and deleting them.

      I have hacked together some changes in the PHP scripts which have resolved this for my particular installation. But this could be included in the interface as a choice (Separate NAS? Y/N) which could then be used as an if/then in the affected PHP scripts.

      Here is my changed code, which works nicely. So hey - half the work is done already! 🙂

      [B]/var/www/fog/service/Post_Stage2.php[/B]
      [CODE]
      — /var/www/fog/service/Post_Stage2.php 2014-03-31 12:06:08.858336572 -0400
      +++ /var/www/fog/service/Post_Stage2.php.bak 2014-03-31 11:38:44.394410423 -0400
      @@ -86,21 +86,20 @@
      $ftp_loginres = ftp_login($ftp, getSetting($conn, “FOG_TFTP_FTP_USERNAME”), getSetting($conn, “FOG_TFTP_FTP_PASSWORD”) );
      if ((!$ftp) || (!$ftp_loginres ))
      {

      •                                           echo _("FTP connection to TFTP Server has failed! - in stage 1");
        
      •                                           echo _("FTP connection to TFTP Server has failed!");
                                                  exit;
                                          }
                                          $mac = str_replace( ":", "-", $mac );
                                          @ftp_delete ( $ftp, getSetting($conn, "FOG_TFTP_PXE_CONFIG_DIR") . "01-". $mac );
        
      •                                   // @ftp_close($ftp);
        
      •                                   @ftp_close($ftp);
        
      •                                   //$ftp = ftp_connect( $nodeip );
        
      •                                   //$ftp_loginres = ftp_login($ftp, $nodeuser, $nodepass);
        

      -/* if ((!$ftp) || (!$ftp_loginres ))

      •                                   $ftp = ftp_connect( $nodeip );
        
      •                                   $ftp_loginres = ftp_login($ftp, $nodeuser, $nodepass);
        
      •                                   if ((!$ftp) || (!$ftp_loginres ))
                                          {
        
      •                                           echo _("FTP connection to Storage Server has failed! in stage 2");
        
      •                                           echo _("FTP connection to Storage Server has failed!");
                                                  exit;
                                          }
        

      -*/
      $mac = str_replace( “-”, “:”, $mac );
      [/CODE]

      [B]/var/www/fog/commons/functions.include.php[/B]
      [CODE]
      — /var/www/fog/commons/functions.include.php 2014-04-07 10:01:51.839510566 -0400
      +++ /var/www/fog/commons/functions.include.orig.php 2014-04-07 10:07:18.135495912 -0400
      @@ -1160,8 +1160,7 @@
      $path = $ar[“ngmRootPath”] . $ar[“imagePath”];
      $user = $ar[“ngmUser”];
      $pass = $ar[“ngmPass”];
      -// $server = $ar[“ngmHostname”];

      •                           $server = getSetting($conn, "FOG_TFTP_HOST");
        
      •                           $server = $ar["ngmHostname"];
        
                                  if ( $path != null && $user != null && $pass != null && $server != null )
                                  {
        

      @@ -1202,8 +1201,7 @@
      $path = $ar[“ngmRootPath”] . $ar[“imagePath”];
      $user = $ar[“ngmUser”];
      $pass = $ar[“ngmPass”];

      •                           // $server = $ar["ngmHostname"];
        
      •                           $server = getSetting($conn, "FOG_TFTP_HOST");
        
      •                           $server = $ar["ngmHostname"];
        
                                  if ( $path != null && $user != null && $pass != null && $server != null )
                                  {
        

      [/CODE]

      I am reluctant to attach these files as patches, because I don’t know what I am doing. Best you folks that know what you are doing put this code to good use … or copy and paste the above into files and apply them to a clean build of 0.32.

      posted in Feature Request
      R
      rayhaque
    • RE: Latest FOG 0.33b

      Some others have mentioned problems having their FTP and storage node in separate places. I too experienced this problem. I was able to hack together a fix for myself. But asking people to enable FTP on their NAS (not possible most of the time) or to go in and rename the files yourself (my help desk can’t do this) is just not helpful.

      Here is my “diff” of /var/www/fog/service/Post_Stage2.php:
      [PHP]89c89
      < echo _(“FTP connection to TFTP Server has failed!”);

                                               echo _("FTP connection to TFTP Server has failed! - in stage 1");
      

      94c94
      < @ftp_close($ftp);

                                       // @ftp_close($ftp);
      

      96,98c96,98
      < $ftp = ftp_connect( $nodeip );
      < $ftp_loginres = ftp_login($ftp, $nodeuser, $nodepass);
      < if ((!$ftp) || (!$ftp_loginres ))

                                       //$ftp = ftp_connect( $nodeip );
                                       //$ftp_loginres = ftp_login($ftp, $nodeuser, $nodepass);
      

      /* if ((!$ftp) || (!$ftp_loginres ))
      100c100
      < echo _(“FTP connection to Storage Server has failed!”);


                                               echo _("FTP connection to Storage Server has failed! in stage 2");
      

      102a103

      */
      [/PHP]

      Basically I am just removing the part that hangs up and re-establishes a new FTP connection, as the current FTP connection is the correct FTP in my case.

      Why not re-write this to check for a boolean value, and then include that in the web configuration pages as “Separate NAS in use”, or something like that?

      EDIT: To clarify, I am referring to the WiKi (Separate NFS Server): KNOWN ISSUE You will get an error “Ftp connection to storage server has failed” at the end of uploading images though. You will have to manually rename and move the file from the dev directory to the directory below.
      [url]http://www.fogproject.org/wiki/index.php?title=FOGUserGuide[/url]

      posted in General
      R
      rayhaque