|
@@ -507,7 +507,7 @@ func (o ovirt) addvm(c echo.Context) error {
|
|
|
})
|
|
|
uuid, _ := uuidgen("APIGW-Ovirt-addVMTask")
|
|
|
invoiceUUID, _ := uuidgen("APIGW-FakeInvoice")
|
|
|
- responseInvoiece:=AddVMPayment{
|
|
|
+ responseInvoiece := AddVMPayment{
|
|
|
Data: struct {
|
|
|
Price struct {
|
|
|
CPU string `json:"cpu"`
|
|
@@ -668,7 +668,6 @@ func (o ovirt) listVM(c echo.Context) error {
|
|
|
return c.JSON(http.StatusOK, resp)
|
|
|
//return c.String(http.StatusOK, string(b))
|
|
|
}
|
|
|
-
|
|
|
func (o ovirt) StartVM(c echo.Context) error {
|
|
|
vmuuid := c.FormValue("VmUUID")
|
|
|
user := c.Get("user").(*jwt.Token)
|
|
@@ -718,7 +717,6 @@ func (o ovirt) StartVM(c echo.Context) error {
|
|
|
return c.JSON(http.StatusOK, resp)
|
|
|
//return c.String(http.StatusOK, string(b))
|
|
|
}
|
|
|
-
|
|
|
func (o ovirt) StopVM(c echo.Context) error {
|
|
|
vmuuid := c.FormValue("VmUUID")
|
|
|
user := c.Get("user").(*jwt.Token)
|
|
@@ -768,7 +766,6 @@ func (o ovirt) StopVM(c echo.Context) error {
|
|
|
return c.JSON(http.StatusOK, resp)
|
|
|
//return c.String(http.StatusOK, string(b))
|
|
|
}
|
|
|
-
|
|
|
func (o ovirt) RebootVM(c echo.Context) error {
|
|
|
vmuuid := c.FormValue("VmUUID")
|
|
|
user := c.Get("user").(*jwt.Token)
|
|
@@ -867,7 +864,6 @@ func (o ovirt) PowerOffVM(c echo.Context) error {
|
|
|
//return c.String(http.StatusOK, string(b))
|
|
|
return c.JSON(http.StatusOK, resp)
|
|
|
}
|
|
|
-
|
|
|
func (o ovirt) ResetVM(c echo.Context) error {
|
|
|
resp := _response{
|
|
|
Origin: "ovirt-ResetVM",
|
|
@@ -879,7 +875,6 @@ func (o ovirt) ResetVM(c echo.Context) error {
|
|
|
//return c.String(http.StatusOK, string(b))
|
|
|
|
|
|
}
|
|
|
-
|
|
|
func (o ovirt) AddNIC(c echo.Context) error {
|
|
|
resp := _response{
|
|
|
Origin: "ovirt-AddNIC",
|
|
@@ -890,7 +885,6 @@ func (o ovirt) AddNIC(c echo.Context) error {
|
|
|
//return c.String(http.StatusOK, string(b))
|
|
|
return c.JSON(http.StatusOK, resp)
|
|
|
}
|
|
|
-
|
|
|
func (o ovirt) AddDisk(c echo.Context) error {
|
|
|
resp := _response{
|
|
|
Origin: "ovirt-AddDisk",
|
|
@@ -901,7 +895,6 @@ func (o ovirt) AddDisk(c echo.Context) error {
|
|
|
//return c.String(http.StatusOK, string(b))
|
|
|
return c.JSON(http.StatusOK, resp)
|
|
|
}
|
|
|
-
|
|
|
func (o ovirt) EditVM(c echo.Context) error {
|
|
|
resp := _response{
|
|
|
Origin: "ovirt-EditVM",
|
|
@@ -912,7 +905,6 @@ func (o ovirt) EditVM(c echo.Context) error {
|
|
|
//return c.String(http.StatusOK, string(b))
|
|
|
return c.JSON(http.StatusOK, resp)
|
|
|
}
|
|
|
-
|
|
|
func (o ovirt) ResetPassword(c echo.Context) error {
|
|
|
resp := _response{
|
|
|
Origin: "ovirt-ResetPassword",
|
|
@@ -923,7 +915,6 @@ func (o ovirt) ResetPassword(c echo.Context) error {
|
|
|
//return c.String(http.StatusOK, string(b))
|
|
|
return c.JSON(http.StatusOK, resp)
|
|
|
}
|
|
|
-
|
|
|
func createVM(invoice_uuid string, apiJson string, uuid string) {
|
|
|
type AddVMResponse struct {
|
|
|
NextRunConfigurationExists string `json:"next_run_configuration_exists"`
|
|
@@ -1136,7 +1127,6 @@ func createVM(invoice_uuid string, apiJson string, uuid string) {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
func VMInitialization(relatedUuid string, apiCall string, uuid string) {
|
|
|
iaas := &ovirt{}
|
|
|
status := iaas.vmStatus(relatedUuid)
|
|
@@ -1165,7 +1155,6 @@ func VMInitialization(relatedUuid string, apiCall string, uuid string) {
|
|
|
toggleTask(uuid, 0)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
func vmStatistics(BA string, VMUUID string) (string, float64, float64) {
|
|
|
//ram,cpu,storage
|
|
|
var _disk []string
|
|
@@ -1648,9 +1637,11 @@ func (o ovirt) vmDetails(c echo.Context) error {
|
|
|
func (o ovirt) ovirtPayment(c echo.Context) error {
|
|
|
invoiceUuid := c.FormValue("invoiceUuid")
|
|
|
db, err := sql.Open("mysql", MySQLUSER+":"+MySQLPASS+"@tcp(127.0.0.1:3306)/zicloud")
|
|
|
+ //results, err := db.Query("SELECT uuid as UUID ,task_apiCall as TaskAPICall , cron_expression as CronExpression , related_uuid as Ruuid, type FROM scheduler where active=1")
|
|
|
+ ///TODO: check duplicate payment confirmation by Invoice table
|
|
|
if err != nil {
|
|
|
}
|
|
|
- update, err := db.Query("update scheduler set active=' 1' where related_uuid='" + invoiceUuid + "' and type=0")
|
|
|
+ update, err := db.Query("update scheduler set active='1' where related_uuid='" + invoiceUuid + "' and type=0")
|
|
|
defer db.Close()
|
|
|
if err != nil {
|
|
|
}
|