Skip to content

Instantly share code, notes, and snippets.

View j-griffith's full-sized avatar

John Griffith j-griffith

  • Bozeman, Montana
View GitHub Profile
@j-griffith
j-griffith / setup-lvm.sh
Last active July 18, 2017 04:27
setup loopback device for LVM testing
sudo truncate --size=10G cinder-volumes.img
# Get next available loop device
LD=$(sudo losetup -f)
sudo losetup $LD cinder-volumes.img
sudo sfdisk $LD << EOF
,,8e,,
EOF
sudo pvcreate $LD
sudo vgcreate cinder-volumes $LD
@j-griffith
j-griffith / CreateAttachSFVol.bash
Created June 16, 2017 22:10
basic wget to create sf vol, map access group and iscsi connect
#!/bin/bash
########################################################################
# Script: CreateAttachSFVol.bash
# Author: John Griffith ([email protected])
#
# Simple script to:
# 1. Create a volume on a SolidFire Cluster
# 2. Add volume to an existing Access Group (by ID)
# 3. Issue iscsi discovery on the newly created volume
@j-griffith
j-griffith / gist:6dff1638ec7dfd7d233adde81ce7b3d5
Last active June 22, 2017 22:18
Example usage of new error type in golang-sfapi (test by modifying element:ListAccounts and providing a bogus method-name)
package main
import (
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/solidfire/solidfire-sdk-golang/sfapi"
"github.com/solidfire/solidfire-sdk-golang/sftypes"
"strings"
)
@j-griffith
j-griffith / cinder.diff
Last active August 11, 2017 17:34
V3 Attach patches
diff --git a/cinder/api/v3/attachments.py b/cinder/api/v3/attachments.py
index 120f6f9..2e31dbd 100644
--- a/cinder/api/v3/attachments.py
+++ b/cinder/api/v3/attachments.py
@@ -18,6 +18,7 @@ import webob
from cinder.api import common
from cinder.api.openstack import wsgi
from cinder.api.v3.views import attachments as attachment_views
+from cinder import db
from cinder import exception
diff --git a/storage_drivers/solidfire_san.go b/storage_drivers/solidfire_san.go
index b8807fd..47a5d20 100644
--- a/storage_drivers/solidfire_san.go
+++ b/storage_drivers/solidfire_san.go
@@ -557,3 +557,34 @@ func (d *SolidfireSANStorageDriver) GetVolume(name string) (sfapi.Volume, error)
}
return vols[0], nil
}
+
+// UpdateAttachmentCounter is used for ref counting attachments to a volume. Valid options for action
{
'driver_volume_type': 'iscsi',
'connector':
{
'platform': 'x86_64',
'host': 'os-1',
'do_local_attach': False,
'ip': '192.168.33.29',
'os_type': 'linux2',
'multipath': False,
def upgrade(migrate_engine):
meta = MetaData(bind=migrate_engine)
services = Table('services', meta, autoload=True)
if not hasattr(services.c, 'uuid'):
services.create_column(Column('uuid', String(36), nullable=True))
uuid_index_name = 'services_uuid_idx'
indexes = Inspector(migrate_engine).get_indexes('services')
if uuid_index_name not in (i['name'] for i in indexes):
services = Table('services', meta, autoload=True)
diff --git a/cinder/objects/service.py b/cinder/objects/service.py
index a1706184f..bbb648581 100644
--- a/cinder/objects/service.py
+++ b/cinder/objects/service.py
@@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from oslo_log import log as logging
+from oslo_utils import uuidutils
@j-griffith
j-griffith / attach.json
Created November 20, 2017 22:08
attach responses
##################################################
# Cinder V3.27 attach API response
##################################################
# attachment_create (returns a dict)
{
'status': 'reserved',
'detached_at': '',
'connection_info': {},
'attached_at': '',
'attach_mode': None,
@j-griffith
j-griffith / gist:d53b95071bd9d7969cf92ea10b08d248
Created November 22, 2017 18:01
Handle deleting volumes that were migrated *too* SolidFire
diff --git a/cinder/volume/drivers/solidfire.py b/cinder/volume/drivers/solidfire.py
index 34da2e8..c44975a 100644
--- a/cinder/volume/drivers/solidfire.py
+++ b/cinder/volume/drivers/solidfire.py
@@ -1436,8 +1436,19 @@ class SolidFireDriver(san.SanISCSIDriver):
return
for acc in accounts:
+ # NOTE(jdg): migration is a special case, when migrating
+ # *from* a device the volume needs to be accessed by the