// Server status values.
const (
- StatusActive = "ACTIVE" // The server is active.
- StatusBuild = "BUILD" // The server has not finished the
original build process.
- StatusDeleted = "DELETED" // The server is deleted.
- StatusError = "ERROR" // The server is in error.
- StatusHardReboot = "HARD_REBOOT" // The server is hard rebooting.
- StatusPassword = "PASSWORD" // The password is being reset on
the server.
- StatusReboot = "REBOOT" // The server is in a soft reboot
state.
- StatusRebuild = "REBUILD" // The server is currently being
rebuilt from an image.
- StatusRescue = "RESCUE" // The server is in rescue mode.
- StatusResize = "RESIZE" // Server is performing the
differential copy of data that changed during its initial copy.
- StatusShutoff = "SHUTOFF" // The virtual machine (VM) was
powered down by the user, but not through the OpenStack Compute API.
- StatusSuspended = "SUSPENDED" // The server is suspended, either
by request or necessity.
- StatusUnknown = "UNKNOWN" // The state of the server is
unknown. Contact your cloud provider.
- StatusVerifyResize = "VERIFY_RESIZE" // System is awaiting confirmation
that the server is operational after a move or resize.
+ StatusActive = "ACTIVE" // The server is active.
+ StatusBuild = "BUILD" // The server has not finished
the original build process.
+ StatusBuildSpawning = "BUILD(spawning)" // The HP server has not finished
the original build process but does have networking.
+ StatusDeleted = "DELETED" // The server is deleted.
+ StatusError = "ERROR" // The server is in error.
+ StatusHardReboot = "HARD_REBOOT" // The server is hard rebooting.
+ StatusPassword = "PASSWORD" // The password is being reset on
the server.
+ StatusReboot = "REBOOT" // The server is in a soft reboot
state.
+ StatusRebuild = "REBUILD" // The server is currently being
rebuilt from an image.
+ StatusRescue = "RESCUE" // The server is in rescue mode.
+ StatusResize = "RESIZE" // Server is performing the
differential copy of data that changed during its initial copy.
+ StatusShutoff = "SHUTOFF" // The virtual machine (VM) was
powered down by the user, but not through the OpenStack Compute API.
+ StatusSuspended = "SUSPENDED" // The server is suspended,
either by request or necessity.
+ StatusUnknown = "UNKNOWN" // The state of the server is
unknown. Contact your cloud provider.
+ StatusVerifyResize = "VERIFY_RESIZE" // System is awaiting
confirmation that the server is operational after a move or resize.
)
Reviewers: mp+180788_ code.launchpad. net,
Message:
Please take a look.
Description:
Enable server status to be set via control point.
I'm not sure if goose is used outside of juju-core. Within juju-core the
addServer function isn't accessed via a control point in any tests.
This (or something similar) is needed to allow creating test servers
within juju-core tests with a specified status [1]
[1] /code.launchpad .net/~michael. nelson/ juju-core/ 1208504- post-bootstrap- hp-no-instances -found- try2/+merge/ 179899
https:/
https:/ /code.launchpad .net/~michael. nelson/ goose/test- instance- state/+ merge/180788
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/12897044/
Affected files: novaservice/ service. go novaservice/ service_ test.go
A [revision details]
M nova/nova.go
M testservices/
M testservices/
Index: [revision details] 20130701072216- t1v2cjfevu6zt0l t
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: nova/nova.go
=== modified file 'nova/nova.go'
--- nova/nova.go 2013-06-22 11:39:35 +0000
+++ nova/nova.go 2013-08-19 06:31:40 +0000
@@ -26,20 +26,21 @@
// Server status values.
const (
- StatusActive = "ACTIVE" // The server is active.
- StatusBuild = "BUILD" // The server has not finished the
original build process.
- StatusDeleted = "DELETED" // The server is deleted.
- StatusError = "ERROR" // The server is in error.
- StatusHardReboot = "HARD_REBOOT" // The server is hard rebooting.
- StatusPassword = "PASSWORD" // The password is being reset on
the server.
- StatusReboot = "REBOOT" // The server is in a soft reboot
state.
- StatusRebuild = "REBUILD" // The server is currently being
rebuilt from an image.
- StatusRescue = "RESCUE" // The server is in rescue mode.
- StatusResize = "RESIZE" // Server is performing the
differential copy of data that changed during its initial copy.
- StatusShutoff = "SHUTOFF" // The virtual machine (VM) was
powered down by the user, but not through the OpenStack Compute API.
- StatusSuspended = "SUSPENDED" // The server is suspended, either
by request or necessity.
- StatusUnknown = "UNKNOWN" // The state of the server is
unknown. Contact your cloud provider.
- StatusVerifyResize = "VERIFY_RESIZE" // System is awaiting confirmation
that the server is operational after a move or resize.
+ StatusActive = "ACTIVE" // The server is active.
+ StatusBuild = "BUILD" // The server has not finished
the original build process.
+ StatusBuildSpawning = "BUILD(spawning)" // The HP server has not finished
the original build process but does have networking.
+ StatusDeleted = "DELETED" // The server is deleted.
+ StatusError = "ERROR" // The server is in error.
+ StatusHardReboot = "HARD_REBOOT" // The server is hard rebooting.
+ StatusPassword = "PASSWORD" // The password is being reset on
the server.
+ StatusReboot = "REBOOT" // The server is in a soft reboot
state.
+ StatusRebuild = "REBUILD" // The server is currently being
rebuilt from an image.
+ StatusRescue = "RESCUE" // The server is in rescue mode.
+ StatusResize = "RESIZE" // Server is performing the
differential copy of data that changed during its initial copy.
+ StatusShutoff = "SHUTOFF" // The virtual machine (VM) was
powered down by the user, but not through the OpenStack Compute API.
+ StatusSuspended = "SUSPENDED" // The server is suspended,
either by request or necessity.
+ StatusUnknown = "UNKNOWN" // The state of the server is
unknown. Contact your cloud provider.
+ StatusVerifyResize = "VERIFY_RESIZE" // System is awaiting
confirmation that the server is operational after a move or resize.
)
// Filter keys.
Index: testservices/ novaservice/ service. go novaservice/ service. go' novaservice/ service. go 2013-06-22 11:39:35 +0000 novaservice/ service. go 2013-08-19 06:32:54 +0000
=== modified file 'testservices/
--- testservices/
+++ testservices/
@@ -210,7 +210,7 @@
// addServer creates a new server. onHook( n, server); err != nil { onHook( n, &server); err != nil { server. Id); err == nil {
func (n *Nova) addServer(server nova.ServerDetail) error {
- if err := n.ProcessFuncti
+ if err := n.ProcessFuncti
return err
}
if _, err := n.server(
Index: testservices/ novaservice/ service_ test.go novaservice/ service_ test.go' novaservice/ service_ test.go 2013-06-22 11:39:35 +0000 novaservice/ service_ test.go 2013-08-19 06:32:54 +0000 net/gocheck" net/goose/ nova" net/goose/ testservices/ hook"
=== modified file 'testservices/
--- testservices/
+++ testservices/
@@ -6,6 +6,7 @@
"fmt"
. "launchpad.
"launchpad.
+ "launchpad.
)
type NovaSuite struct {
@@ -240,6 +241,29 @@
c.Assert(err, ErrorMatches, `a server with id "test" already exists`)
}
+// A control point can be used to change the status of the added server. ntrolPoint( c *C) { RegisterControl Point( trol, args ...interface{}) error { .(*nova. ServerDetail) dSpawning server( server. Id) dSpawning) rTwiceFails( c *C) { il{Id: "test"} er(c, server)
+func (s *NovaSuite) TestAddServerCo
+ cleanup := s.service.
+ "addServer",
+ func(sc hook.ServiceCon
+ details := args[0]
+ details.Status = nova.StatusBuil
+ return nil
+ },
+ )
+ defer cleanup()
+
+ server := nova.ServerDetail{
+ Id: "test",
+ Status: nova.StatusActive,
+ }
+ s.createServer(c, server)
+ defer s.deleteServer(c, server)
+
+ sr, _ := s.service.
+ c.Assert(sr.Status, Equals, nova.StatusBuil
+}
+
func (s *NovaSuite) TestRemoveServe
server := nova.ServerDeta
s.createServ