specify instance host using availability_zone arg instead of scheduler_hints
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Tue, 16 Apr 2013 01:47:45 +0000 (21:47 -0400)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Tue, 16 Apr 2013 01:47:45 +0000 (21:47 -0400)
plstackapi/openstack/driver.py

index 67b5280..c56dcde 100644 (file)
@@ -194,10 +194,9 @@ class OpenStackDriver:
         files = {'/root/.ssh/authorized_keys': authorized_keys}
        
         hints = {}
+        availability_zone = None
         if hostname:
-            #hints['force_hosts']= hostname
-            #hints['availability-zone'] = 'nova:%s' % hostname
-            pass
+            availability_zone = 'nova:%s' % hostname
         server = self.shell.nova.servers.create(
                                             name=name,
                                             key_name = key_name,
@@ -205,7 +204,8 @@ class OpenStackDriver:
                                             image=image_id,
                                             security_group = security_group,
                                             files=files,
-                                            scheduler_hints=hints)
+                                            scheduler_hints=hints,
+                                            availability_zone=availability_zone)
         return server
           
     def destroy_instance(self, id):