Skip to content

Commit 34b74dd

Browse files
thansmannRob Day-Reynolds
authored andcommitted
Revert "Back-fill tests for MigrateDisk"
This reverts commit 0cfecc3 all the way to b1b9d90 Signed-off-by: Rob Day-Reynolds <[email protected]>
1 parent b1b9d90 commit 34b74dd

File tree

14 files changed

+133
-346
lines changed

14 files changed

+133
-346
lines changed

bosh_agent/lib/bosh_agent.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module Bosh::Agent
4242

4343
require 'bosh_agent/platform/linux'
4444
require 'bosh_agent/platform/linux/adapter'
45-
require 'bosh_agent/platform/linux/disk_manager'
45+
require 'bosh_agent/platform/linux/disk'
4646
require 'bosh_agent/platform/linux/logrotate'
4747
require 'bosh_agent/platform/linux/password'
4848
require 'bosh_agent/platform/linux/network'

bosh_agent/lib/bosh_agent/dir_copier.rb

Lines changed: 0 additions & 14 deletions
This file was deleted.

bosh_agent/lib/bosh_agent/disk.rb

Lines changed: 0 additions & 16 deletions
This file was deleted.

bosh_agent/lib/bosh_agent/message/disk.rb

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
# Copyright (c) 2009-2012 VMware, Inc.
2-
require 'bosh_agent/dir_copier'
32

43
module Bosh::Agent
54
module Message
65

7-
# Migrates persistent data from the old persistent disk to the new
8-
# persistent disk.
9-
#
10-
# This message assumes that two mount messages have been received
11-
# and processed: one to mount the old disk at /var/vcap/store and
12-
# a second to mount the new disk at /var/vcap/store_migraton_target
13-
# (sic).
14-
156
class MigrateDisk < Base
167
def self.long_running?; true; end
178

@@ -33,8 +24,7 @@ def migrate(args)
3324

3425
if check_mountpoints
3526
logger.info("Copy data from old to new store disk")
36-
migrator = DirCopier.new(store_path, store_migration_target)
37-
migrator.copy
27+
`(cd #{store_path} && tar cf - .) | (cd #{store_migration_target} && tar xpf -)`
3828
end
3929

4030
DiskUtil.umount_guard(store_path)
@@ -43,16 +33,17 @@ def migrate(args)
4333
mount_store(@new_cid)
4434
end
4535

46-
private
4736
def check_mountpoints
4837
Pathname.new(store_path).mountpoint? && Pathname.new(store_migration_target).mountpoint?
4938
end
5039

5140
def mount_store(cid, options="")
52-
disk = Bosh::Agent::Config.platform.find_disk_by_cid(cid)
53-
logger.info("Mounting: #{disk.partition_path} #{store_path}")
54-
unless disk.mount(store_path, options)
55-
raise Bosh::Agent::MessageHandlerError, "Failed to mount: #{disk.partition_path} #{store_path} (exit code #{$?.exitstatus})"
41+
disk = Bosh::Agent::Config.platform.lookup_disk_by_cid(cid)
42+
partition = "#{disk}1"
43+
logger.info("Mounting: #{partition} #{store_path}")
44+
`mount #{options} #{partition} #{store_path}`
45+
unless $?.exitstatus == 0
46+
raise Bosh::Agent::MessageHandlerError, "Failed to mount: #{partition} #{store_path} (exit code #{$?.exitstatus})"
5647
end
5748
end
5849

bosh_agent/lib/bosh_agent/platform.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def self.platform(platform_name)
77
case platform_name
88
when 'ubuntu'
99
template_dir = File.expand_path(File.join(File.dirname(__FILE__), 'platform/ubuntu/templates'))
10-
Platform::Linux::Adapter.new(Platform::Linux::DiskManager.new,
10+
Platform::Linux::Adapter.new(Platform::Linux::Disk.new,
1111
Platform::Linux::Logrotate.new(template_dir),
1212
Platform::Linux::Password.new,
1313
Platform::Ubuntu::Network.new(template_dir))

bosh_agent/lib/bosh_agent/platform/centos/disk.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Bosh::Agent
2-
class Platform::Centos::Disk < Platform::Linux::DiskManager
2+
class Platform::Centos::Disk < Platform::Linux::Disk
33
def detect_block_device(disk_id)
44
device_path = "/sys/bus/scsi/devices/#{root_disk_scsi_host_id}:0:#{disk_id}:0/block/*"
55
dirs = Dir.glob(device_path)

bosh_agent/lib/bosh_agent/platform/linux/adapter.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ def lookup_disk_by_cid(cid)
2424
@disk.lookup_disk_by_cid(cid)
2525
end
2626

27-
def find_disk_by_cid(cid)
28-
@disk.find_disk_by_cid(cid)
29-
end
30-
3127
def get_data_disk_device_name
3228
@disk.get_data_disk_device_name
3329
end

bosh_agent/lib/bosh_agent/platform/linux/disk_manager.rb renamed to bosh_agent/lib/bosh_agent/platform/linux/disk.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Copyright (c) 2009-2012 VMware, Inc.
2-
require 'bosh_agent/disk'
32

43
module Bosh::Agent
5-
class Platform::Linux::DiskManager
4+
class Platform::Linux::Disk
65
include Bosh::Exec
76

87
VSPHERE_DATA_DISK = "/dev/sdb"
@@ -64,11 +63,6 @@ def lookup_disk_by_cid(cid)
6463
end
6564
end
6665

67-
def find_disk_by_cid(cid)
68-
disk_path = lookup_disk_by_cid(cid)
69-
return Disk.new(disk_path)
70-
end
71-
7266
def detect_block_device(disk_id)
7367
device_path = "/sys/bus/scsi/devices/2:0:#{disk_id}:0/block/*"
7468
dirs = Dir.glob(device_path, 0)

bosh_agent/spec/unit/dir_copier_spec.rb

Lines changed: 0 additions & 32 deletions
This file was deleted.

bosh_agent/spec/unit/disk_spec.rb

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)