fix files I checked into the wrong directory
diff --git a/planetstack/observer/steps/sync_image_deployments.py b/planetstack/observer/steps/sync_image_deployments.py
index 31556c3..3522eca 100644
--- a/planetstack/observer/steps/sync_image_deployments.py
+++ b/planetstack/observer/steps/sync_image_deployments.py
@@ -41,10 +41,20 @@
if glance_image:
image_deployment.glance_image_id = glance_image['id']
elif image_deployment.image.path:
+ image = {
+ 'name': image_deployment.image.name,
+ 'is_public': True,
+ 'disk_format': 'raw',
+ 'container_format': 'bare',
+ 'file': image_deployment.image.path,
+ }
glance_image = driver.shell.glanceclient.images.create(name=image_deployment.image.name,
is_public=True,
disk_format='raw',
container_format='bare')
glance_image.update(data=open(image_deployment.image.path, 'rb'))
- image_deployment.glance_image_id = glance_image.id
+
+ if not glance_image or not glance_image.get('id'):
+ raise Exception, "Add image failed at deployment %s" % image_deployment.deployment.name
+ image_deployment.glance_image_id = glance_image['id']
image_deployment.save()
diff --git a/planetstack/observer/steps/sync_roles.py b/planetstack/observer/steps/sync_roles.py
index 5dc30d9..ca85d57 100644
--- a/planetstack/observer/steps/sync_roles.py
+++ b/planetstack/observer/steps/sync_roles.py
@@ -6,7 +6,7 @@
from core.models.role import Role
from core.models.site import SiteRole
from core.models.slice import SliceRole
-from core.models.deployment import DeploymentRole
+from core.models.deployment import Deployment, DeploymentRole
class SyncRoles(OpenStackSyncStep):
provides=[Role]
@@ -31,7 +31,8 @@
def sync_record(self, role):
if not role.enacted:
deployments = Deployment.objects.all()
- for deployment in deployments:
+ for deployment in deployments:
driver = self.driver.admin_driver(deployment=deployment.name)
driver.create_role(role.role)
- role.save()
+ role.save()
+
diff --git a/planetstack/observer/steps/sync_slice_deployments.py b/planetstack/observer/steps/sync_slice_deployments.py
index 580edd1..b40eb6b 100644
--- a/planetstack/observer/steps/sync_slice_deployments.py
+++ b/planetstack/observer/steps/sync_slice_deployments.py
@@ -100,8 +100,7 @@
if slice_deployment.tenant_id:
# update slice/tenant quota
- driver = self.driver.client_driver(deployment=slice_deployment.deployment.name,
- tenant=slice_deployment.slice.name)
+ driver = self.driver.client_driver(deployment=slice_deployment.deployment.name, tenant=slice_deployment.slice.name)
driver.shell.nova.quotas.update(tenant_id=slice_deployment.tenant_id, instances=int(slice_deployment.slice.max_slivers))
slice_deployment.save()
diff --git a/planetstack/observer/steps/sync_slice_memberships.py b/planetstack/observer/steps/sync_slice_memberships.py
index b6b1638..38bd26c 100644
--- a/planetstack/observer/steps/sync_slice_memberships.py
+++ b/planetstack/observer/steps/sync_slice_memberships.py
@@ -5,6 +5,9 @@
from observer.openstacksyncstep import OpenStackSyncStep
from core.models.slice import *
from core.models.user import UserDeployments
+from util.logger import Logger, logging
+
+logger = Logger(level=logging.INFO)
class SyncSliceMemberships(OpenStackSyncStep):
requested_interval=0
@@ -15,6 +18,7 @@
def sync_record(self, slice_memb):
# sync slice memberships at all slice deployments
+ logger.info("syncing slice privilege: %s %s" % (slice_memb.slice.name, slice_memb.user.email))
slice_deployments = SliceDeployments.objects.filter(slice=slice_memb.slice)
for slice_deployment in slice_deployments:
if not slice_deployment.tenant_id:
diff --git a/planetstack/observer/steps/sync_slivers.py b/planetstack/observer/steps/sync_slivers.py
index b576bbc..a794ccf 100644
--- a/planetstack/observer/steps/sync_slivers.py
+++ b/planetstack/observer/steps/sync_slivers.py
@@ -4,7 +4,7 @@
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models.sliver import Sliver
-from core.models.slice import SlicePrivilege, SliceDeployments
+from core.models.slice import Slice, SlicePrivilege, SliceDeployments
from core.models.network import Network, NetworkSlice, NetworkDeployments
from util.logger import Logger, logging
@@ -52,6 +52,7 @@
# now include network template
network_templates = [network.template.sharedNetworkName for network in networks \
if network.template.sharedNetworkName]
+ #logger.info("%s %s %s %s" % (driver.shell.quantum.username, driver.shell.quantum.password, driver.shell.quantum.tenant, driver.shell.quantum.url))
for net in driver.shell.quantum.list_networks()['networks']:
if net['name'] in network_templates:
nics.append({'net-id': net['id']})