Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added experimental support for no-clone blobstore

Fixes EUCA-3592
  • Loading branch information...
commit 360758a13c30d794ff17708e57ac4c97d2a4dec9 2 parents af3e9ee + 58053a5
@dmitrii dmitrii authored
View
1  node/handlers.c
@@ -1331,6 +1331,7 @@ static int init (void)
GET_VAR_INT(nc_state.save_instance_files, CONFIG_SAVE_INSTANCES, 0);
GET_VAR_INT(nc_state.concurrent_disk_ops, CONFIG_CONCURRENT_DISK_OPS, 4);
GET_VAR_INT(nc_state.concurrent_cleanup_ops, CONFIG_CONCURRENT_CLEANUP_OPS, 30);
+ GET_VAR_INT(nc_state.disable_snapshots, CONFIG_DISABLE_SNAPSHOTS, 0);
int disable_injection; GET_VAR_INT(disable_injection, CONFIG_DISABLE_KEY_INJECTION, 0);
nc_state.do_inject_key = !disable_injection;
strcpy(nc_state.admin_user_id, EUCALYPTUS_ADMIN);
View
1  node/handlers.h
@@ -96,6 +96,7 @@ struct nc_state_t {
boolean convert_to_disk;
boolean do_inject_key;
int concurrent_disk_ops, concurrent_cleanup_ops;
+ int disable_snapshots;
int staging_cleanup_threshold;
int booting_cleanup_threshold;
int bundling_cleanup_threshold;
View
11 storage/backing.c
@@ -195,15 +195,22 @@ int init_backing_store (const char * conf_instances_path, unsigned int conf_work
work_limit_blocks = ULLONG_MAX;
}
+ // by default we let blobstore pick the snapshot policy, which
+ // will use device mapper if available, which is faster than copying
+ blobstore_snapshot_t snapshot_policy = BLOBSTORE_SNAPSHOT_ANY;
+ if (nc_state.disable_snapshots) {
+ logprintfl (EUCAINFO, "if allocating storage, will avoid using snapshots\n");
+ snapshot_policy = BLOBSTORE_SNAPSHOT_NONE;
+ }
blobstore_set_error_function ( &bs_errors );
if (cache_limit_blocks) {
- cache_bs = blobstore_open (cache_path, cache_limit_blocks, BLOBSTORE_FLAG_CREAT, BLOBSTORE_FORMAT_DIRECTORY, BLOBSTORE_REVOCATION_LRU, BLOBSTORE_SNAPSHOT_ANY);
+ cache_bs = blobstore_open (cache_path, cache_limit_blocks, BLOBSTORE_FLAG_CREAT, BLOBSTORE_FORMAT_DIRECTORY, BLOBSTORE_REVOCATION_LRU, snapshot_policy);
if (cache_bs==NULL) {
logprintfl (EUCAERROR, "ERROR: failed to open/create cache blobstore: %s\n", blobstore_get_error_str(blobstore_get_error()));
return ERROR;
}
}
- work_bs = blobstore_open (work_path, work_limit_blocks, BLOBSTORE_FLAG_CREAT, BLOBSTORE_FORMAT_FILES, BLOBSTORE_REVOCATION_NONE, BLOBSTORE_SNAPSHOT_ANY);
+ work_bs = blobstore_open (work_path, work_limit_blocks, BLOBSTORE_FLAG_CREAT, BLOBSTORE_FORMAT_FILES, BLOBSTORE_REVOCATION_NONE, snapshot_policy);
if (work_bs==NULL) {
logprintfl (EUCAERROR, "ERROR: failed to open/create work blobstore: %s\n", blobstore_get_error_str(blobstore_get_error()));
logprintfl (EUCAERROR, "ERROR: %s\n", blobstore_get_last_trace());
View
16 storage/blobstore.h
@@ -184,9 +184,21 @@ typedef struct _blockblob {
struct _blockblob * prev;
} blockblob;
+typedef enum {
+ BLOBSTORE_COPY,
+ BLOBSTORE_MAP,
+ BLOBSTORE_SNAPSHOT
+} blockmap_relation_t;
+
+typedef enum {
+ BLOBSTORE_DEVICE,
+ BLOBSTORE_BLOCKBLOB,
+ BLOBSTORE_ZERO
+} blockmap_source_t;
+
typedef struct _blockmap {
- enum { BLOBSTORE_COPY, BLOBSTORE_MAP, BLOBSTORE_SNAPSHOT } relation_type;
- enum { BLOBSTORE_DEVICE, BLOBSTORE_BLOCKBLOB, BLOBSTORE_ZERO } source_type;
+ blockmap_relation_t relation_type;
+ blockmap_source_t source_type;
union {
char device_path [BLOBSTORE_MAX_PATH];
blockblob * blob;
View
28 storage/vbr.c
@@ -547,7 +547,9 @@ static void update_vbr_with_backing_info (artifact * a)
virtualBootRecord * vbr = a->vbr;
assert (a->bb);
- if (! a->must_be_file && strlen (blockblob_get_dev (a->bb))) {
+ if (! a->must_be_file &&
+ strlen (blockblob_get_dev (a->bb)) &&
+ (blobstore_snapshot_t)a->bb->store->snapshot_policy != BLOBSTORE_SNAPSHOT_NONE) { // without snapshots we can use files
safe_strncpy (vbr->backingPath, blockblob_get_dev (a->bb), sizeof (vbr->backingPath));
vbr->backingType = SOURCE_TYPE_BLOCK;
} else {
@@ -681,7 +683,14 @@ static int disk_creator (artifact * a) // creates a 'raw' disk based on partitio
assert (dest_dev);
logprintfl (EUCAINFO, "[%s] constructing disk of size %lld bytes in %s (%s)\n", a->instanceId, a->size_bytes, a->id, blockblob_get_dev (a->bb));
- blockmap map [EUCA_MAX_PARTITIONS] = { {BLOBSTORE_SNAPSHOT, BLOBSTORE_ZERO, {blob:NULL}, 0, 0, MBR_BLOCKS} }; // initially only MBR is in the map
+ blockmap_relation_t mbr_op = BLOBSTORE_SNAPSHOT;
+ blockmap_relation_t part_op = BLOBSTORE_MAP; // use map by default as it is faster
+ if ((blobstore_snapshot_t)a->bb->store->snapshot_policy == BLOBSTORE_SNAPSHOT_NONE) {
+ // but fall back to copy when snapshots are not possible or desired
+ mbr_op = BLOBSTORE_COPY;
+ part_op = BLOBSTORE_COPY;
+ }
+ blockmap map [EUCA_MAX_PARTITIONS] = { {mbr_op, BLOBSTORE_ZERO, {blob:NULL}, 0, 0, MBR_BLOCKS} }; // initially only MBR is in the map
// run through partitions, add their sizes, populate the map
virtualBootRecord * p1 = NULL;
@@ -709,7 +718,7 @@ static int disk_creator (artifact * a) // creates a 'raw' disk based on partitio
assert (dep->bb);
assert (dep->size_bytes>0);
- map [map_entries].relation_type = BLOBSTORE_MAP;
+ map [map_entries].relation_type = part_op;
map [map_entries].source_type = BLOBSTORE_BLOCKBLOB;
map [map_entries].source.blob = dep->bb;
map [map_entries].first_block_src = 0;
@@ -914,11 +923,15 @@ static int copy_creator (artifact * a)
return blobstore_get_error();
}
} else {
+ blockmap_relation_t op = BLOBSTORE_SNAPSHOT; // use snapshot by default as it is faster
+ if ((blobstore_snapshot_t)a->bb->store->snapshot_policy == BLOBSTORE_SNAPSHOT_NONE) {
+ op = BLOBSTORE_COPY; // but fall back to copy when snapshots are not possible or desired
+ }
blockmap map [] = {
- {BLOBSTORE_SNAPSHOT, BLOBSTORE_BLOCKBLOB, {blob:dep->bb}, 0, 0, round_up_sec (dep->size_bytes) / 512}
+ {op, BLOBSTORE_BLOCKBLOB, {blob:dep->bb}, 0, 0, round_up_sec (dep->size_bytes) / 512}
};
if (blockblob_clone (a->bb, map, 1)==-1) {
- logprintfl (EUCAERROR, "[%s] error: failed to clone blob %s to blob %s: %d %s\n", a->instanceId, dep->bb->id, a->bb->id, blobstore_get_error(), blobstore_get_last_msg());
+ logprintfl (EUCAERROR, "[%s] error: failed to clone/copy blob %s to blob %s: %d %s\n", a->instanceId, dep->bb->id, a->bb->id, blobstore_get_error(), blobstore_get_last_msg());
return blobstore_get_error();
}
}
@@ -2144,8 +2157,6 @@ int main (int argc, char ** argv)
goto out;
}
- goto skip_cache_only; // TODO: figure out why only one or the other works
-
printf ("running test that only uses cache blobstore\n");
if (errors += provision_vm (GEN_ID, KEY1, EKI1, ERI1, EMI1, cache_bs, work_bs, FALSE))
goto out;
@@ -2171,9 +2182,6 @@ int main (int argc, char ** argv)
check_blob (cache_bs, "blocks", 0);
printf ("done with vbr.c cache-only test errors=%d warnings=%d\n", errors, warnings);
- exit (errors);
-
- skip_cache_only:
printf ("\n\n\n\n\nrunning test with use of work blobstore\n");
View
1  util/eucalyptus.h
@@ -168,6 +168,7 @@
#define CONFIG_DISABLE_KEY_INJECTION "DISABLE_KEY_INJECTION"
#define CONFIG_CONCURRENT_DISK_OPS "CONCURRENT_DISK_OPS"
#define CONFIG_CONCURRENT_CLEANUP_OPS "CONCURRENT_CLEANUP_OPS"
+#define CONFIG_DISABLE_SNAPSHOTS "DISABLE_CACHE_SNAPSHOTS"
#define CONFIG_USE_VIRTIO_NET "USE_VIRTIO_NET"
#define CONFIG_USE_VIRTIO_DISK "USE_VIRTIO_DISK"
#define CONFIG_USE_VIRTIO_ROOT "USE_VIRTIO_ROOT"
Please sign in to comment.
Something went wrong with that request. Please try again.