Added new storage node - images getting stuck in dev directory
-
<?php /** \class FOGFTP Globally accessible class. It does the FTP Taskings for us. Now that we're using iPXE, it's really only used for Image Replication and upload tasks. */ class FOGFTP extends FOGGetSet { // Data public $data = array( 'host' => '', 'username' => '', 'password' => '', 'port' => 21, 'timeout' => 10 ); // Links private $link; private $loginLink; private $lastConnectionHash; public $passiveMode = true; public function connect() { // Return if - already connected && last connection is the same || details unset $connectionHash = md5(serialize($this->data)); 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')); if (!$this->link) { $error = error_get_last(); throw new Exception(sprintf('%s: Failed to connect. Host: %s, Error: %s', get_class($this), $this->get('host'), $error['message'])); } // Login if (!$this->loginLink = @ftp_login($this->link, $this->get('username'), $this->get('password'))) { $error = error_get_last(); throw new Exception(sprintf('%s: Login failed. Host: %s, Username: %s, Password: %s, Error: %s', get_class($this), $this->get('host'), $this->get('username'), $this->get('password'), $error['message'])); } if ($this->passiveMode) ftp_pasv($this->link, true); // Store connection hash $this->lastConnectionHash = $connectionHash; // Return return $this; } public function close($if = true) { // Only if connected if ($this->link && $if) { // Disconnect @ftp_close($this->link); // unset connection variable unset($this->link); } // Return return $this; } public function put($remotePath, $localPath, $mode = FTP_ASCII) { // Put file if (!@ftp_put($this->link, $remotePath, $localPath, $mode)) { $error = error_get_last(); throw new Exception(sprintf('%s: Failed to %s file. Remote Path: %s, Local Path: %s, Error: %s', get_class($this), __FUNCTION__, $remotePath, $localPath, $error['message'])); } // Return return $this; } public function rename($remotePath, $localPath) { if(@ftp_nlist($this->link,$localPath)) { if(!@ftp_rename($this->link, $localPath, $remotePath)) { $error = error_get_last(); throw new Exception(sprintf('%s: Failed to %s file. Remote Path: %s, Local Path: %s, Error: %s', get_class($this), __FUNCTION__, $remotePath, $localPath, $error['message'])); } } return $this; } public function chdir($path) { if (@ftp_chdir($this->link, $path)) return $this; return false; } public function size($pathfile) { $size = 0; if (@ftp_size($this->link,$pathfile) == -1) { $filelist = @ftp_nlist($this->link,$pathfile); if ($filelist) { foreach($filelist AS $file) $size += @ftp_size($this->link,$file); } } else $size = @ftp_size($this->link, $pathfile); return ($size > 0 ? $size : 0); } public function mkdir($remotePath) { return @ftp_mkdir($this->link,$remotePath); } public function delete($path) { if (!(@ftp_delete($this->link, $path)||@ftp_rmdir($this->link,$path))) { $filelist = @ftp_nlist($this->link,$path); if ($filelist) { foreach($filelist AS $file) $this->delete($file); $this->delete($path); } } // Return return $this; } }
-
@glienhard Oh well that couldn’t be easier. Change the timeout from 10 to something like 20 or 30.
-
@Wayne-Workman Yep saw that myself. Since the iscsi is going across a 1Gbit link I’m changing it to 30 and will try again. I’ll keep you posted. Thanks!
-
@Wayne-Workman Still no luck…still stuck in the dev directory.
-
@glienhard said:
@Wayne-Workman Still no luck…still stuck in the dev directory.
Can you verify what the root directory is on this SAN disk? Using ftp, change directory to the “root” directory with
cd /
and take a look around and figure out where you are.also, to me, it’s just really confusing to have this new storage inside the old one. You can easily mount it to a new directory, something like /SANimages and then just copy/paste the existing entries in /etc/exports so you have a new NFS export called /SANimages, just increment the ID and change the paths.
Just some ideas.
@Tom-Elliott thoughts on why it isn’t working?
-
@Wayne-Workman Here is what I have… I have an internal RAID array mounted to /images. Then I have the SAN mounted to /images/archive. (I did this because I thought it would be more friendly to FOG that way.) I can certainly remount the SAN to a different folder and give that a try. (I had had that thought as well.)
Here is what I have in my /etc/exports file:
/images *(ro,sync,no_wdelay,no_subtree_check,insecure_locks,no_root_squash,insecure,fsid=0)
/images/dev *(rw,async,no_wdelay,no_subtree_check,no_root_squash,insecure,fsid=1)
/images/archive *(ro,sync,no_wdelay,no_subtree_check,insecure_locks,no_root_squash,insecure,fsid=2)
/images/archive/dev *(rw,async,no_wdelay,no_subtree_check,no_root_squash,insecure,fsid=3) -
@glienhard How about…
/images *(ro,sync,no_wdelay,no_subtree_check,insecure_locks,no_root_squash,insecure,fsid=0) /images/dev *(rw,async,no_wdelay,no_subtree_check,no_root_squash,insecure,fsid=1) /archive *(ro,sync,no_wdelay,no_subtree_check,insecure_locks,no_root_squash,insecure,fsid=2) /archive/dev *(rw,async,no_wdelay,no_subtree_check,no_root_squash,insecure,fsid=3)
-
@Wayne-Workman I did have the dev directories set to async. I have moved the mount to /img_archive, updated the export file, and trying again.
-
@glienhard Update the new storage node too, in the web ui.
-
@Wayne-Workman I did update the GUI as well. Unfortunately I’m still getting the same result.
-
@glienhard If you’re available, possibly, to do a teamviewer session to try to figure out why it’s not ftping, it’d be really amazing. Just hit me up in chat please (so as not to give out information on people being able to connect.)
-
@Tom-Elliott Thank Tom. Just sent you a chat
-
@glienhard Timing could definitely be a troublemaker here. I remember having an issue with images not being properly moved because (you wouldn’t believe it) the /image partition - on a local drive - was formated with ext3!!! This filesystem does some kind of magic defragmentation foo when files are being deleted. Causes delete syscalls to wait for a long time. Is your SAN device ext3??
-
Update for this topic.
After remounting the SAN to a different folder the image was still getting stuck in the dev directory. With @Tom-Elliott’s help we did an in-place upgrade to the latest Trunk. After doing this the image moved properly and there were no more issues. Thanks @Tom-Elliott!