[yocto] [PATCH 11/13] ProvisionGoogleVM.py: Rename to ProvisionGoogleVMs.py
california.l.sullivan at gmail.com
california.l.sullivan at gmail.com
Tue Sep 23 10:05:38 PDT 2014
From: California Sullivan <california.l.sullivan at intel.com>
This can provision multiple VMs at once.
Signed-off-by: California Sullivan <california.l.sullivan at intel.com>
---
.../autobuilder/buildsteps/ProvisionGoogleVM.py | 86 ----------------------
.../autobuilder/buildsteps/ProvisionGoogleVMs.py | 86 ++++++++++++++++++++++
2 files changed, 86 insertions(+), 86 deletions(-)
delete mode 100644 lib/python2.7/site-packages/autobuilder/buildsteps/ProvisionGoogleVM.py
create mode 100644 lib/python2.7/site-packages/autobuilder/buildsteps/ProvisionGoogleVMs.py
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/ProvisionGoogleVM.py b/lib/python2.7/site-packages/autobuilder/buildsteps/ProvisionGoogleVM.py
deleted file mode 100644
index e7f488f..0000000
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/ProvisionGoogleVM.py
+++ /dev/null
@@ -1,86 +0,0 @@
-'''
-Created on Aug 13, 2014
-
-__author__ = "California Sullivan"
-__copyright__ = "Copyright 2014, Intel Corp."
-__credits__ = ["California Sullivan"]
-__license__ = "GPL"
-__version__ = "2.0"
-__maintainer__ = "Elizabeth Flanagan"
-__email__ = "elizabeth.flanagan at intel.com"
-'''
-
-from autobuilder.config import *
-from buildbot.steps.shell import ShellCommand
-
-class ProvisionGoogleVM(ShellCommand):
- haltOnFailure = True
- flunkOnFailure = True
- name = "Provision Google VM"
- def __init__(self, factory, argdict=None, **kwargs):
- self.vmname=None
- self.vmcount=1
- self.startupscript=None
- self.metadata=None
- self.zone="us-central1-a"
- self.image=None
- self.machine=None
- self.network=None
- self.disksize=None
- self.factory = factory
- self.description = "Provision Google VM"
- for k, v in argdict.iteritems():
- if type(v) is bool:
- setattr(self, k, str(v))
- else:
- setattr(self, k, v)
-
- if self.vmname is None or self.vmname == "":
- self.finished(FAILURE)
- else:
- self.command = "gcloud compute instances create"
- self.vmnames = ""
- for x in range(0, self.vmcount):
- self.vmnames += " " + self.vmname + "-" + str(x)
- self.command += self.vmnames
- if self.zone is not None and self.zone in ["us-central1-a", "us-central1-b", "us-central1-f", "europe-west1-a", "europe-west1-b", "asia-east1-a", "asia-east1-b", "asia-east1-b"]:
- self.command += " --zone " + self.zone
- else:
- self.command += " --zone us-central1-a"
- if self.disksize is not None and self.disksize != "":
- self.command += " --boot-disk-size " + self.disksize
- else:
- self.command += " --boot-disk-size 200GB"
- if self.image is None:
- self.command += " --image debian-7"
- else:
- self.command += " --image " + self.image
-
- if self.machine is not None and self.machine in ["g1-small", "f1-micro", "n1-standard-1", "n1-standard-2", "n1-standard-4", "n1-standard-8", "n1-standard-16", "n1-highmem-2", "n1-highmem-4"]:
- self.command += " --machine-type " + self.machine
- else:
- self.command += " --machine-type n1-standard-1"
- if self.network is not None and self.network != "":
- self.command += " --network " + self.network
- if self.startupscript is not None and self.startupscript != "":
- self.command += " --metadata-from-file startup-script="+YOCTO_ABBASE+"/bin/"+self.startupscript
- if self.metadata is not None and self.metadata != "":
- self.command += " --metadata " + self.metadata
- self.command += " 1> /dev/null";
-
- # Timeout needs to be passed to LoggingBuildStep as a kwarg
- self.timeout = 1000
- kwargs['timeout']=self.timeout
- ShellCommand.__init__(self, **kwargs)
-
- def describe(self, done=False):
- description = ShellCommand.describe(self,done)
- return description
-
- def commandComplete(self, cmd):
- if not cmd.didFail():
- self.setProperty("vmnames", self.vmnames)
- self.setProperty("zone", self.zone)
- self.setProperty("vmcount", self.vmcount)
-
-
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/ProvisionGoogleVMs.py b/lib/python2.7/site-packages/autobuilder/buildsteps/ProvisionGoogleVMs.py
new file mode 100644
index 0000000..d0bc6eb
--- /dev/null
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/ProvisionGoogleVMs.py
@@ -0,0 +1,86 @@
+'''
+Created on Aug 13, 2014
+
+__author__ = "California Sullivan"
+__copyright__ = "Copyright 2014, Intel Corp."
+__credits__ = ["California Sullivan"]
+__license__ = "GPL"
+__version__ = "2.0"
+__maintainer__ = "Elizabeth Flanagan"
+__email__ = "elizabeth.flanagan at intel.com"
+'''
+
+from autobuilder.config import *
+from buildbot.steps.shell import ShellCommand
+
+class ProvisionGoogleVMs(ShellCommand):
+ haltOnFailure = True
+ flunkOnFailure = True
+ name = "Provision Google VMs"
+ def __init__(self, factory, argdict=None, **kwargs):
+ self.vmname=None
+ self.vmcount=1
+ self.startupscript=None
+ self.metadata=None
+ self.zone="us-central1-a"
+ self.image=None
+ self.machine=None
+ self.network=None
+ self.disksize=None
+ self.factory = factory
+ self.description = "Provision Google VMs"
+ for k, v in argdict.iteritems():
+ if type(v) is bool:
+ setattr(self, k, str(v))
+ else:
+ setattr(self, k, v)
+
+ if self.vmname is None or self.vmname == "":
+ self.finished(FAILURE)
+ else:
+ self.command = "gcloud compute instances create"
+ self.vmnames = ""
+ for x in range(0, self.vmcount):
+ self.vmnames += " " + self.vmname + "-" + str(x)
+ self.command += self.vmnames
+ if self.zone is not None and self.zone in ["us-central1-a", "us-central1-b", "us-central1-f", "europe-west1-a", "europe-west1-b", "asia-east1-a", "asia-east1-b", "asia-east1-b"]:
+ self.command += " --zone " + self.zone
+ else:
+ self.command += " --zone us-central1-a"
+ if self.disksize is not None and self.disksize != "":
+ self.command += " --boot-disk-size " + self.disksize
+ else:
+ self.command += " --boot-disk-size 200GB"
+ if self.image is None:
+ self.command += " --image debian-7"
+ else:
+ self.command += " --image " + self.image
+
+ if self.machine is not None and self.machine in ["g1-small", "f1-micro", "n1-standard-1", "n1-standard-2", "n1-standard-4", "n1-standard-8", "n1-standard-16", "n1-highmem-2", "n1-highmem-4"]:
+ self.command += " --machine-type " + self.machine
+ else:
+ self.command += " --machine-type n1-standard-1"
+ if self.network is not None and self.network != "":
+ self.command += " --network " + self.network
+ if self.startupscript is not None and self.startupscript != "":
+ self.command += " --metadata-from-file startup-script="+YOCTO_ABBASE+"/bin/"+self.startupscript
+ if self.metadata is not None and self.metadata != "":
+ self.command += " --metadata " + self.metadata
+ self.command += " 1> /dev/null";
+
+ # Timeout needs to be passed to LoggingBuildStep as a kwarg
+ self.timeout = 1000
+ kwargs['timeout']=self.timeout
+ ShellCommand.__init__(self, **kwargs)
+
+ def describe(self, done=False):
+ description = ShellCommand.describe(self,done)
+ return description
+
+ def commandComplete(self, cmd):
+ if not cmd.didFail():
+ self.setProperty("vmnames", self.vmnames)
+ self.setProperty("zone", self.zone)
+ self.setProperty("vmcount", self.vmcount)
+
+
--
1.9.1
More information about the yocto
mailing list