Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
themeEclipse
// RollbackCmd - snapshot rollback command
message RollbackCmd {
	string snpshot_uuid = 1;
	string volume_uuid = 2;
	DeviceOpsCmd rollback = 3;
}

// SnapshotConfig describes a snapshot for a specific logical
// volume that must exist on the device. It has a required field
// volume_uuid for which it was created and UUID for snapshot name in ZFS.
message SnapshotConfig {
	// The real name of the snapshot in ZFS. It is the link between
	// the command and the response to the command. It is assumed
	// that the field will always be filled with a unique value
	// that the controller will generate.
	string uuid = 1;
	// Display name (User-friendly name). This name does not affect
	// the snapshot properties in ZFS in any way.
	// Can be filled on the controller side.
	// If a snapshot has already been created and this field has changed,
	// it can be assumed that the friendly name for this snapshot has
	// been renamed on the controller side.
	string display_name = 2;
	// Volume ID of the volume this snapshot belongs to. The field is
	// required for all messages. Must always be filled in on the
	// controller side before sending to create snapshot command.
	string volume_uuid = 3;
	// The command for the snapshot rollback operation.
	// It should also be taken that the rollback cmd
	// to snapshot k will implicitly automatically delete
	// all snapshots from k+1 to N, If the deletion of snapshots
	// from k+1 to N was not initiated by the controller before
	// the rollback cmd
	RollbackCmd rollback = 4;
}

Information about snapshots to send to the controller

In addition to commands, it is also planned to send information about snapshots to the controller, which will be divided
into two parts: Information and metrics. The need to send metrics comes from the fact that over time when data on the
disk changes or when earlier snapshots are deleted, snapshots tend to increase in size, so it is necessary to inform the
controller about up-to-date information about the space occupied by snapshots in ZFS.

//
// If the counter in the DeviceOpsCmd is different, it will cause a
// rollback operation.
//
// The fields from RollbackCmd (snapshot_uuid, volume_uuid) will
// always match the fields from the SnapshotConfig (snapshot_uuid, volume_uuid)
// to which RollbackCmd belongs.
//
// For example: take the situation where the controller requests one or more
// snapshots (uuid=1 for volume_uuid=X, then add a second SnapshotCmd
// with uuid=2 for volume_uuid=X), and then later it send a RollbackCmd with
// snapshot_uuid=1
//
// In this case, the following will happen:
// It is assumed that the RollbackCmd message cannot come separately from
// the configuration, and will always be part of the SnapshotConfig for
// every snapshot. And we will always receive from the controller a complete
// list of SnapshotConfig for all snapshots that the controller knows about.
// Then after the snapshot with uuid=2 has been created, we can also get
// a SnapshotConfig for uuid=1, where the counter in RollbackCmd will be +1.
// Thus, we will roll back to the state of the logical volume at the time
// of the snapshot with uuid=1, and the snapshot with uuid=2 will be marked
// in the info message how IMPLICITLY_DELETED (If the controller did not take
// care of deleting the snapshot with uuid=2 before the rollback command).
message RollbackCmd {
  	// UUID of the snapshot to rollback to. Is the snapshot_uuid
   	// from the SnapshotConfig and the real and unique name of the
  	// snapshot in ZFS. This is the rollback target for volume_uuid.
   	string snapshot_uuid = 1;
   	string volume_uuid = 2;    // UUID of the volume to rollback
	DeviceOpsCmd rollback = 3; // Counter for rollback
}

// SnapshotConfig describes a snapshot for a specific logical
// volume that must exist on the device. It has a required field
// volume_uuid for which it was created and UUID for snapshot name in ZFS.
message SnapshotConfig {
   // The real name of the snapshot in ZFS. It is the link between
   // the command and the response to the command. It is assumed
   // that the field will always be filled with a unique value
   // that the controller will generate.
   string snapshot_uuid = 1;
   // Display name (User-friendly name). This name does not affect
   // the snapshot properties in ZFS in any way.
   // Can be filled on the controller side.
   // If a snapshot has already been created and this field has changed,
   // it can be assumed that the friendly name for this snapshot has
   // been renamed on the controller side.
   string display_name = 2;
   // Volume ID of the volume this snapshot belongs to. The field is
   // required for all messages. Must always be filled in on the
   // controller side before sending to create snapshot command.
   string volume_uuid = 3;
   // An "optional" snapshot rollback operation command, because
   // not all SnapshotConfig require a rollback command
   // If the RollbackCmd message is not enabled, it means that
   // a rollback is not requested. If RollbackCmd is enabled in this
   // config, then a rollback has been requested, and also the counter
   // in RollbackCmd will be checked.
   // It should also be taken that the rollback cmd
   // to snapshot k will implicitly automatically delete
   // all snapshots from k+1 to N, If the deletion of snapshots
   // from k+1 to N was not initiated by the controller before
   // the rollback cmd.
   RollbackCmd rollback = 4;
}

Information about snapshots to send to the controller

In addition to commands, it is also planned to send information about snapshots to the controller, which will be divided
into two parts: Information and metrics. The need to send metrics comes from the fact that over time when data on the
disk changes or when earlier snapshots are deleted, snapshots tend to increase in size, so it is necessary to inform the
controller about up-to-date information about the space occupied by snapshots in ZFS.

The structure of the informational message ZInfoSnapshot will consist of the following fields:

Code Block
themeEclipse
// Snapshot states
enum ZSnapshotState {
   	Z_SNAPSHOT_STATE_UNSPECIFIED = 0;
   	// This state is used when a snapshot is in the process of being
   	// created or an error occurred during the first attempt to create it.
   	// (For example, the operation was delayed)
   	Z_SNAPSHOT_STATE_CREATING = 1;
   	// This state is used when the snapshot has been successfully created.
   	Z_SNAPSHOT_STATE_CREATED = 2;
   	// This state is used when the snapshot is pending deletion or
   	// the first deletion attempt was not successful. Once a snapshot is deleted,
   	// EVE will no longer create a ZInfoSnapshot for it.
   	Z_SNAPSHOT_STATE_DELETING = 3;
   	// This state is used to send information to the controller about a
   	// snapshot that was implicitly deleted after a rollback snapshot
   	// or volume delete command. After sending a message with this status once,
   	// EVE no longer expects to receive the configuration (SnapshotConfig)
   	// for this snapshot. If the controller continues to send configuration
   	// for a snapshot that was implicitly deleted, then EVE will ignore
   	// the configuration for that snapshot and resend the ZInfoSnapshot
   	// message to the controller with the status IMPLICITLY_DELETED.
   	Z_SNAPSHOT_STATE_IMPLICITLY_DELETED = 4;
}

// ZInfoSnapshot - Information about snapshot in zfs for zvol
message ZInfoSnapshot {
   	google.protobuf.Timestamp creation_time = 1;
   	string snapshot_uuid = 2;           // Link a command and a response. Is the real name of the snapshot in ZFS
   	string volume_uuid = 3;             // Volume ID of the volume this snapshot belongs to.
   	string display_name = 4;            // Ex: "Tuesday" or creation time (User-friendly name)
   	bool encryption = 5;                // This is just an indication. Inherited from zvol.
   	ZSnapshotState current_state = 6;   // Displays the current state of the snapshot
   	ErrorInfo error_msg = 7;            // Ops error
   	uint32 rollback_cmd_counter = 8;    // Counter for rollback cmd from the DevOpsCmd in RollbackCmd
   	google.protobuf.Timestamp rollback_time_last_op = 9;  // The time when the last rollback operation was performed for this snapshot
}

The structure of the message ZMetricSnapshot with metrics will The structure of the informational message ZInfoSnapshot will consist of the following fields:

Code Block
themeEclipse
// Snapshot states
enum ZSnapshotState {
	Z_SNAPSHOT_STATE_UNSPECIFIED = 0;
	// This state is used when a snapshot is in the process of being
	// created or an error occurred during the first attempt to create it.
	// (For example, the operation was delayed)
	Z_SNAPSHOT_STATE_CREATING = 1;
	// This state is used when the snapshot has been successfully created.
	Z_SNAPSHOT_STATE_CREATED = 2;
	// This state is used when the snapshot is pending deletion or
	// the first deletion attempt was not successful.
	Z_SNAPSHOT_STATE_DELETING = 3;
	// This state is used to send information to the controller about a
	// snapshot that was implicitly deleted after a rollback snapshot
	// or volume delete command.
	Z_SNAPSHOT_STATE_IMPLICITLY_DELETED = 4;
}

// ZInfoSnapshot - Information about snapshot in zfs for zvol
message ZInfoSnapshot {
	uint64 creation_time = 1; // In seconds
	string uuid = 2; // link a command and a response. Is the real name of the snapshot in ZFS
	string volume_uuid = 3; // Volume ID of the volume this snapshot belongs to.
	string display_name = 4; // Ex: "Tuesday" or creation time (User-friendly name)
	bool encryption = 5;
	ZSnapshotState current_state = 6; // Displays the current state of the snapshot
	string error_msg = 7; // Ops error
	uint32 rollback_cmd_counter = 8; // Counter for rollback cmd
	uint64 rollback_time_last_op = 9; // The time when the last rollback operation was performed for this snapshot
}

The structure of the message ZMetricSnapshot with metrics will consist of the following fields:

Code Block
themeEclipse
// Metrics for a snapshot
// When a snapshot is created, its disk space is initially shared between
// the snapshot and the file system, and possibly with previous snapshots.
// As the file system changes, disk space that was previously shared becomes
// unique to the snapshot, and thus is counted in the snapshot's used property.
// Additionally, deleting snapshots can increase the amount of disk space
// unique to (and thus used by) other snapshots.
message ZMetricSnapshot {
	// Snapshot UUID
	string uuid = 1;
	// User-friendly name on controller
	string display_name = 2;
	// Identifies the amount of space consumed by the dataset and all its
	// descendants. (in byte)
	uint64 used_space = 3;
	// Identifies the amount of data accessible by this snapshot, which might
	// or might not be shared with other datasets in the pool. When a snapshot or
	// clone is created, It initially references the same amount of space as the
	// file system or snapshot it was created from because
	// its contents are identical. (in byte)
	uint64 referenced = 4;
	// Identifies the compression ratio achieved for this snapshot,
	// expressed as a multiplier.
	double compressratio = 5;
	// Specifies the logical size of the volume. (in byte)
	uint64 vol_size = 6;
Metrics for a snapshot
// When a snapshot is created, its disk space is initially shared between
// the snapshot and the file system, and possibly with previous snapshots.
// As the file system changes, disk space that was previously shared becomes
// unique to the snapshot, and thus is counted in the snapshot's used property.
// Additionally, deleting snapshots can increase the amount of disk space
// unique to (and thus used by) other snapshots, however, this does not increase
// the amount of disk space specified for the volume itself.
message ZMetricSnapshot {
  	// Snapshot UUID
   	string snapshot_uuid = 1;
   	// User-friendly name on controller
   	string display_name = 2;
   	// The used space of a snapshot is space that is referenced exclusively
   	// by this snapshot. If this snapshot is destroyed, the amount of used
   	// space will be freed. Space that is shared by multiple snapshots isn't
   	// accounted for in this metric. When a snapshot is destroyed, space that
   	// was previously shared with this snapshot can become unique to snapshots
   	// adjacent to it, thus changing the used space of those snapshots.
   	// The used space of the latest snapshot can also be affected by changes
   	// in the file system. Note that the used space of a snapshot is a subset
   	// of the written space of the snapshot. (in bytes)
   	uint64 used_space = 3;
   	// Identifies the amount of data accessible by this snapshot, which might
   	// or might not be shared with other datasets in the pool. When a snapshot or
   	// clone is created, It initially references the same amount of space as the
   	// file system or snapshot it was created from because
   	// its contents are identical. (in bytes)
   	uint64 referenced = 4;
   	// Identifies the compression ratio achieved for this snapshot,
   	// expressed as a multiplier.
   	double compressratio = 5;
   	// Specifies the logical size of the volume this snapshot belongs to (in bytes)
   	uint64 vol_size = 6;
   	// The amount of space that is "logically" accessible by this dataset.
   	// See the referenced property. The logical space ignores the effect of
   	// the compression and copies properties, giving a quantity closer to
   	// the amount of data that applications see.
   	// However, it does include space consumed by metadata. (in bytes)
   	uint64 logicalreferenced = 7;
   	// The amount of referenced space that is "logically" accessible bywritten to this dataset.
	// Seesince the referencedspecified
 property. The logical space ignores the effect of
	// thesnapshot. compressionThis andis copiesthe properties,space givingthat ais quantityreferenced closer to
	// the amount of data that applications see.
by this dataset but was
   	// However,not itreferenced doesby includethe space consumed by metadata.
	//specified snapshot. (in bytebytes)
   	uint64 logicalreferencedwritten = 78;
}

Comments on API messages from these blocks can be left directly in PR #2633 at this link.

...